Darth Khasei Posted June 14, 2004 Share Posted June 14, 2004 Well with just a little fiddling with the GREAT Replicator force power I was able to get enemy NPC's to spawn on command, YIPPIE. Now I need to try to refine the positioning as they are way too close to the PC at the moment. Also they leave too soon. I'll keep working at it. Ideas are welcomed. Link to comment Share on other sites More sharing options...
Darth Khasei Posted June 15, 2004 Share Posted June 15, 2004 Ok good after going through the NW script page I did not see a reference to a command that lets you spawn a NPC and then allows you to set the NPC at x location in reference to the PC. So, the best I was able to come up with as a quick fix for me was to just delay the response time of the spawned enemy NPC's, which allows me to move away from them to a more realistic distance before the fight begins. It, works pretty well actually. I wonder what would happen if I spawn them on Manaan? I will have to test it. Oh no ANOTHER trial. Well, at least I was able to get it working right. . Well, I am just in awe of the makers of the Kotor Arena and Survival/Matrix mods. I really wanted to make a full on K-1 style mod using several locations in the game. Obviously Kotor Arena,area but the Arena Area on the Unknown Planet as well as a couple of other good outdoor locations. Basically, you would fight a progressive list of other talented K-1 fighters until you make it to the championship. The levels of the fighters would go hand in hand with your progression skills in the game. Maybe 30-50 unique fighters. I was thinking about the top ten Jedi/Sith to put in there for the end of the game levels. Who should be on that list? Any thoughts comments? Link to comment Share on other sites More sharing options...
Darth333 Posted June 15, 2004 Author Share Posted June 15, 2004 Here is a sample of what I use: Doom Dealer, the script has to be attached somewhere. This scrip below was attached to the OnEnter filed of an .are file. You can also easily attached scripts to a conversation. I f the script is attached to a conversation bracnh that is not reapeated, you don't need to set a Global or a local bolean. That's what I did in for the Deadeye Duncan mod. For a full example with the source available, check svosh's Revan Redemption mod here: http://www.lucasforums.com/showthread.php?s=&threadid=129196 void main () { object oTrigger = GetObjectByTag("dustil"); if (GetLocalBoolean(oTrigger,0)) { return; } float x=117.92f; float y=108.27f; float z=18.00f; float r=0.0f; vector vecNPC=Vector(x,y,z); location locNPC=Location(vecNPC, r); object oNPC=CreateObject(OBJECT_TYPE_CREATURE,"dustil",locNPC); object oPC=GetFirstPC(); AssignCommand(oNPC,ActionMoveToObject(oPC)); AssignCommand(oNPC,ActionStartConversation(oPC,"new_dustil")); SetLocalBoolean(oTrigger,0,TRUE); } The npc can be spawned at any location within the same module with this: there is no maximum of minimum distance. Just change the coordinates. You can also use a trigger to spawn npcs (utt and .git file). It's also possible to make the npcs spawn at certain conditions only. This is an example where the npc would spawn only after the 4th starmap has been discovered and after the Dustil plot reached a certain point. void main() { int nStar = GetGlobalNumber("K_STAR_MAP"); int nResult = GetGlobalNumber("KOR_DANEL"); if ((nResult == 6) && (nStar==50)) { rest of the script... } } Hope this helps Link to comment Share on other sites More sharing options...
Darth Khasei Posted June 15, 2004 Share Posted June 15, 2004 Good news. You can fight the Sith on Manaan with no trial penalty! Just spawn the enemy and killing them has no penalty. Heck any Shelkath around and they will join in on your side:D Link to comment Share on other sites More sharing options...
Maxstate Posted August 25, 2004 Share Posted August 25, 2004 In JA you could spawn any NPC with something like npc spawn (name), is that possible in kotor. i'm using D333's spawn on demand armband a lot (even though everything under dark master jha'din doesn't work -- no problemo) cuz i like fighting when I want to fight:p but i would like to spawn someone else too. is that possible in-game? Link to comment Share on other sites More sharing options...
tk102 Posted August 25, 2004 Share Posted August 25, 2004 In JA you could spawn any NPC with something like npc spawn (name), is that possible in kotor. If it was that easy there wouldn't be a thread like this one. but i would like to spawn someone else too. is that possible in-game? Of course -- via scripting -- that's what this is all about. Link to comment Share on other sites More sharing options...
Darth333 Posted August 25, 2004 Author Share Posted August 25, 2004 Originally posted by Maxstate In JA you could spawn any NPC with something like npc spawn (name), is that possible in kotor. Unfortunately, there is no way you can do this in Kotor: you have to plant a script somewhere. i'm using D333's spawn on demand armband a lot (even though everything under dark master jha'din doesn't work -- no problemo) cuz i like fighting when I want to fight:p Some of Darth Khasei's scripts would work only with a female PC. I corrected this problem in version 2.0.1 released during the weekend. You can donwload it here: http://www.pcgamemods.com/6832 but i would like to spawn someone else too. is that possible in-game? if it was possible for the armband, then it is... The source code for the All-In-One FPM is here: http://www.lucasforums.com/showthread.php?s=&threadid=132116 (check 1st post) Link to comment Share on other sites More sharing options...
Xavier2 Posted November 21, 2004 Share Posted November 21, 2004 I am having a spawning problems: 1. I have succesfully spawned 2 npcs in Tatooine docking bay using this script by Darth333: [size=1]void main() { object oEnter = GetEnteringObject(); object oNPC1 = GetObjectByTag("tat17_NPC1"); object oNPC2 = GetObjectByTag("tat17_NPC2"); if (GetIsPC(oEnter)) { // this line checks if your custom npcs are already there: if ((GetIsObjectValid(oNPC1) == FALSE) && (GetIsObjectValid(oNPC2) == FALSE)) { // do a whereami cheat to get the coordinates where you want to spawn the npcs and replace the 0.00 by those coordinates: CreateObject(OBJECT_TYPE_CREATURE, "tat17_NPC1", Location(Vector(-22.80, -4.40, 0.13), 0.90)); CreateObject(OBJECT_TYPE_CREATURE, "tat17_NPC2", Location(Vector(-21.00, -4.30, 0.13), 01.0)); } } // This fires the original script that we renamed ExecuteScript("enter_dock", GetModule()); }[/size] The problem is that the NPC2 dialog is not trggering. The NPC1 dialog, a civilian dialog (baloons) works ok. What am i missing? Link to comment Share on other sites More sharing options...
tk102 Posted November 21, 2004 Share Posted November 21, 2004 First of all, I love the code font you used. I'm doing that from now on. Second, nowhere in the script do I see where dialog is forced to begin for NPC1 or 2... do you mean that when you go up to NPC2 to talk, he's not talking back? Link to comment Share on other sites More sharing options...
Xavier2 Posted November 21, 2004 Share Posted November 21, 2004 Originally posted by tk102 First of all, I love the code font you used. I'm doing that from now on. Second, nowhere in the script do I see where dialog is forced to begin for NPC1 or 2... do you mean that when you go up to NPC2 to talk, he's not talking back? Yep. The idea isn't to make the npc go to you but rather make him reply to your attempt to talk. NPC1 replies with civilian conversation but NPC2 that has a more complex dialog that fires global script doesn't. And the font was just my way to save space... The code is very neat. It makes perfect sense even for a modder with zero knowledge of programming like myself. As expected Darth333 is the clever mind behind that. Link to comment Share on other sites More sharing options...
tk102 Posted November 21, 2004 Share Posted November 21, 2004 Ah well then, the problem is with the dialog, the NPC's .utc, or the conditional scripts used by the dialog. Link to comment Share on other sites More sharing options...
Darkkender Posted November 22, 2004 Share Posted November 22, 2004 If I was to guess I would say that you either don't have the dialogue that will be used typed right in the utc file, or the dialogue itself has some sorta of mixup in it's tree(i've had this happen), or if the dialogue is supposed to be triggered by the event of you walking in then you probably need to set a universal trigger. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 22, 2004 Share Posted November 22, 2004 Originally posted by darkkender If I was to guess I would say that you either don't have the dialogue that will be used typed right in the utc file, or the dialogue itself has some sorta of mixup in it's tree(i've had this happen), or if the dialogue is supposed to be triggered by the event of you walking in then you probably need to set a universal trigger. The dialog uses the same name of the .utc minus the last letter. I checked that and it is set right in the npc. There isn't any script triggering it to start. The only scripts there are two "SetGlobal" ones, that fires at the end of certain dialog branches...Both .utc and .dlg are in Override... I thought of one possibility. The .utc becomes a part of the area duo to the script above. Should i use the same techinique for the dialog? or should be enough just to place it's tag in the conversation field of the .utc file as it is now? Link to comment Share on other sites More sharing options...
Darth333 Posted November 22, 2004 Author Share Posted November 22, 2004 You don't need a script to get this working unless you want your npc to walk up to your PC and automatically start the dialogue (I did not put this in the script above but it can be added). It is very likely a problem with the .dlg file. Check your starting list and your conditional scripts as tk102 mentionned above. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 23, 2004 Share Posted November 23, 2004 Originally posted by Darth333 You don't need a script to get this working unless you want your npc to walk up to your PC and automatically start the dialogue (I did not put this in the script above but it can be added). It is very likely a problem with the .dlg file. Check your starting list and your conditional scripts as tk102 mentionned above. Just to give this subject some closure i thought i'd let you know the problem. It happens the dialog file was corrupted. I am happy to say it is working perfect now. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 30, 2004 Share Posted November 30, 2004 Is there a script to spawn a certain npc in a new modded area, but only if he hasn't been killed in a previous one? Link to comment Share on other sites More sharing options...
Darth333 Posted November 30, 2004 Author Share Posted November 30, 2004 ok, I assume you now know how to track a plot with Global Variables. The script would be something like this: { int nPlot = GetGlobalNumber("MY_PLOT"); if (nPlot == 1) { if(!GetIsObjectValid(GetObjectByTag("my_npc_tag"))) CreateObject(OBJECT_TYPE_CREATURE, "my_npc_tag", Location(Vector(00.00, 00.00, 0.00), 0.0)); } } Link to comment Share on other sites More sharing options...
tk102 Posted November 30, 2004 Share Posted November 30, 2004 Is there a script to spawn a certain npc in a new modded area, but only if he hasn't been killed in a previous one?There is not a script per se, but this is exactly what Global Variables are used for. Many plot elements use numeric globals to keep track of where the PC is in the game... like Canderous' sidequest... Jagi spawns only if you haven't met him (and killed him) yet. So you .utc could have an OnDeath user-defined event that could write to a global variable, and your .utt or .are could have a script that checks that variable, and spawns the NPC if he hasn't been killed. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 30, 2004 Share Posted November 30, 2004 Originally posted by Darth333 ok, I assume you now know how to track a plot with Global Variables. The script would be something like this: { int nPlot = GetGlobalNumber("MY_PLOT"); if (nPlot == 1) { if(!GetIsObjectValid(GetObjectByTag("my_npc_tag"))) CreateObject(OBJECT_TYPE_CREATURE, "my_npc_tag", Location(Vector(00.00, 00.00, 0.00), 0.0)); } } Thanks Darth333 Where do you think should be the best place to attach this script since "MY_PLOT" is set in a new area? The npc.utc or is there a specific node or entry in the area.git i should place it?... Link to comment Share on other sites More sharing options...
Darth333 Posted November 30, 2004 Author Share Posted November 30, 2004 Use the ExecuteScript function. You'll find a tutorial here: http://www.lucasforums.com/showthread.php?s=&threadid=137370 I also sent you a script to spawn a door that was using this a few weeks ago. Link to comment Share on other sites More sharing options...
Xavier2 Posted November 30, 2004 Share Posted November 30, 2004 Originally posted by Darth333 Use the ExecuteScript function. You'll find a tutorial here: http://www.lucasforums.com/showthread.php?s=&threadid=137370 I also sent you a script to spawn a door that was using this a few weeks ago. Forgive me if its a stupid question...I noticed it was the same kind of script, but since the area where the npc should spawn (or if he is already dead shouldn't) is a custom area and there isn't a pre- made On Enter script, is this the one i should use? [size=1]void main() { StartNewModule("NEW_AREA"); }[/size] EDIT: Also, should i remove this particular npc from the creature list in the NEW_AREA.git? Link to comment Share on other sites More sharing options...
Xavier2 Posted December 2, 2004 Share Posted December 2, 2004 Originally posted by tk102 There is not a script per se, but this is exactly what Global Variables are used for. Many plot elements use numeric globals to keep track of where the PC is in the game... like Canderous' sidequest... Jagi spawns only if you haven't met him (and killed him) yet. So you .utc could have an OnDeath user-defined event that could write to a global variable, and your .utt or .are could have a script that checks that variable, and spawns the NPC if he hasn't been killed. Ok i have this script: [size=1]void main() { int nPlot = GetGlobalNumber("MY_PLOT"); if (nPlot == 4) { if(!GetIsObjectValid(GetObjectByTag("thug"))) CreateObject(OBJECT_TYPE_CREATURE, "thug", Location(Vector(107.68, 76.06, 0.00), 0.0)); } }[/size] I placed it in the OnUserDefine script field in the NEW_AREA.are, but the thug doesn't spawn. . I checkede and MY_PLOT is set to 4 allright. Which one is the right field to place this script in the AREA.are? and is there another place to put it besides the .are? Link to comment Share on other sites More sharing options...
Darth333 Posted December 2, 2004 Author Share Posted December 2, 2004 Put it in the OnEnter field. Link to comment Share on other sites More sharing options...
Xavier2 Posted December 2, 2004 Share Posted December 2, 2004 Originally posted by Darth333 Put it in the OnEnter field. hmmm...The OnEnter already has the Default script from the AREA which NEW_AREA is based on. Would it corrupt something? Link to comment Share on other sites More sharing options...
Darth333 Posted December 2, 2004 Author Share Posted December 2, 2004 Originally posted by Xavier2 hmmm...The OnEnter already has the Default script from the AREA which NEW_AREA is based on. Would it corrupt something? I sent you an identical script the other day to spawn a door that uses the Execute Script function with detailed instructions. Have a look at it Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.