darthrichard Posted July 13, 2005 Share Posted July 13, 2005 i no my endless stupedity must get annoying but... void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { //check if the object is already there to avoid multiple objects if (!GetIsObjectValid(GetObjectByTag("o"))) { //Note that the script uses OBJECT_TYPE_CREATURE instead of OBJECT_TYPE_PLACEABLE - that's the only difference with the container: CreateObject(OBJECT_TYPE_CREATURE, "my_npc_tag", Location(Vector(43.41,-0.28,9.66), 0.0)); // this portion is optional and will only work if you spawn the npc not too far from where you enter the area - careful if there are scripted cutscenes too. // You can also use the On perception event instead of the on enter script for this. NoClicksFor(0.5); //Make the NPC walk towards you: AssignCommand((GetObjectByTag("my_npc_tag")),ActionMoveToObject(oPC)); //Make the npc initiate the converstation after approcahing you: AssignCommand((GetObjectByTag("my_npc_tag")), ActionDoCommand(ActionStartConversation(oPC))); } ExecuteScript("old_a_306onenter", GetModule()); } } can u simplyfy this again and put what i need to spawn a non-conversation npc on the endorspire Link to comment Share on other sites More sharing options...
Mono_Giganto Posted July 13, 2005 Share Posted July 13, 2005 I'm no scripting guru, but I'll take a shot, it'll give D333 and stoffe a laugh. void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("your_npc_tag_here"))) { CreateObject(OBJECT_TYPE_CREATURE, "your_npc_tag here", Location(Vector(43.41,-0.28,9.66), 0.0)); } ExecuteScript("old_a_306onenter", GetModule()); } } All I did was remove the part that cause the npc to walk up to you and begin talking. Heh, wait for D333 to come in and correct me though. Edit: Bah, didn't mean to fatten my post... Link to comment Share on other sites More sharing options...
Darth333 Posted July 13, 2005 Share Posted July 13, 2005 What Mono give you is good: void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("your_npc_tag_here"))) { CreateObject(OBJECT_TYPE_CREATURE, "your_npc_template", Location(Vector(43.41,-0.28,9.66), 0.0)); } ExecuteScript("old_a_306onenter", GetModule()); } } Just insert the tag of you object (look at the *.utc file to get it) where it says your_npc_tag_here (doN,t remove the quotes from the script) Where it says (43.41,-0.28,9.66), theses are the xyz coordinates of the location where you want to spawn your npc. For Kotor 1, use the whereami cheat to get the coordinates and for TSL use my whereami armband from starwarsknights.com/tools.php . As explained in the tutorial, You will need to extract the OnEnter script from the Endar Spire, rename it and fire it with this line: ExecuteScript("old_on_enter_script_goes_here", GetModule()); Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 when and if i learn this im una make a tribute module to d33 t7 and D_D(i just like him lol) lol Link to comment Share on other sites More sharing options...
Mono_Giganto Posted July 13, 2005 Share Posted July 13, 2005 Originally posted by Darth333 What Mono give you is good That's a first for me. Usually I'm just barely in the ball-park. Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 im stuped ExecuteScript("old_on_enter_script_goes_here", GetModule()); the old on enter script??! for is the file type that i extract Link to comment Share on other sites More sharing options...
Darth333 Posted July 13, 2005 Share Posted July 13, 2005 Read steps 1,2, 4 under "How to spawn a npc" in the 3rd post of this tutorial: http://www.lucasforums.com/showthread.php?s=&threadid=143536 I would tell you whichi script to extract exactly but I don't have the game with me so I can't. Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 kk d333 u rule...and u mono...cant forget you Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 ok i found the .ncs file...witch is sort of useless to me atm, what do i open it with? Link to comment Share on other sites More sharing options...
stoffe Posted July 13, 2005 Share Posted July 13, 2005 Originally posted by Mono_Giganto I'm no scripting guru, but I'll take a shot, it'll give D333 and stoffe a laugh. CreateObject(OBJECT_TYPE_CREATURE, "your_npc_tag here" (snip) ExecuteScript("old_a_306onenter", Just two minor things. It's not the Tag of the creature you specify as a parameter to CreateObject, it's the ResRef. They don't necessarily have to be identical even if they sometimes are. As a rule of thumb, you use the ResRef when creating a new object or accessing static resources, while you use the Tag to access already existing objects in the game. Also, I'd use OBJECT_SELF rather than GetModule() as the target of the ExecuteScript() function, as some scripts set or check for variables on (their) OBJECT_SELF. If you make the Module execute a script that was originally run by another object those checks will be messed up since OBJECT_SELF will become the module rather than the original object when the script runs. OBJECT_SELF is always the object that runs the current script, so it'd make the object running your modified script run the old one as well. Link to comment Share on other sites More sharing options...
Darth333 Posted July 13, 2005 Share Posted July 13, 2005 You don't need to open it. Just note down the name of your .ncs file, let's say it's endar_spire.ncs as I don't know the real name. the rename it to let's say blabla.ncs (or whatever) then, in your custom script, in this line, insert the new name without the extension in this line: ExecuteScript("blabla", GetModule()); and save your custom script as endar_spire.nss and compile: it will give you a new endar_spire.ncs file. When you're done, just drop both files ( blabla.ncs and the new endar_spire.ncs) in your override folder. The effect will be that The new endar_spire.ncs file which contains your spawn script, will overwrite the original one but it will also fire the old one that was renamed blabla.ncs err...hope this is clear. Edit: what stoffe said about the tag thing. However in the line: (!GetIsObjectValid(GetObjectByTag("your_npc_tag_here"))) make sure you have the tag Link to comment Share on other sites More sharing options...
Mono_Giganto Posted July 13, 2005 Share Posted July 13, 2005 Gee stoffe, thanks for taking away my pride at getting a script right. I'll keep that in mind. Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 endless chain of n00bness "then, in your custom script" ok...what custem script...do i start one on or sunnin? ARGHHH im a retard Link to comment Share on other sites More sharing options...
Darth333 Posted July 13, 2005 Share Posted July 13, 2005 Originally posted by darthrichard "then, in your custom script" ok...what custem script... That one: void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("your_npc_tag_here"))) { CreateObject(OBJECT_TYPE_CREATURE, "your_npc_template", Location(Vector(43.41,-0.28,9.66), 0.0)); } ExecuteScript("blabla", GetModule()); } } Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 entirely new question! what do i put the script on i.e wordpad Link to comment Share on other sites More sharing options...
darthrichard Posted July 13, 2005 Author Share Posted July 13, 2005 void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("n_richard"))) { CreateObject(OBJECT_TYPE_CREATURE, "jedi_white_male_02", Location(Vector(34.44,162.62,0.00), 0.0)); } ExecuteScript("k_pend_area01test(new one, if u need the old one take out test bit)", OBJECT_SELF()); } } filled out everything...correct? Link to comment Share on other sites More sharing options...
Darth333 Posted July 14, 2005 Share Posted July 14, 2005 where did you picked up the jedi_white_male_02 template? are you sure you didn't refered to the appearance? use a custom file: custom tag, custom template resref and custom filename (template resref and file name have to be the same and I suggest you use the same thing for the tag as well) Link to comment Share on other sites More sharing options...
darthrichard Posted July 14, 2005 Author Share Posted July 14, 2005 lol it said "your_npc_tag_here" lol Link to comment Share on other sites More sharing options...
darthrichard Posted July 14, 2005 Author Share Posted July 14, 2005 void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("n_richard"))) { CreateObject(OBJECT_TYPE_CREATURE, "n_richard", Location(Vector(34.44,162.62,0.00), 0.0)); } ExecuteScript("k_pend_area01old", OBJECT_SELF()); } } correct this time? Link to comment Share on other sites More sharing options...
Darth333 Posted July 14, 2005 Share Posted July 14, 2005 Originally posted by stoffe -mkb- Also, I'd use OBJECT_SELF rather than GetModule() as the target of the ExecuteScript() function, as some scripts set or check for variables on (their) OBJECT_SELF. If you make the Module execute a script that was originally run by another object those checks will be messed up since OBJECT_SELF will become the module rather than the original object when the script runs. OBJECT_SELF is always the object that runs the current script, so it'd make the object running your modified script run the old one as well. Well in this case, the script is planted on the OnEnter event of the .are file... I really don't see how OBJECT_SELF could be something else than the Module itself OBJECT_SELF being the module, then GetModule works just as well. Link to comment Share on other sites More sharing options...
stoffe Posted July 14, 2005 Share Posted July 14, 2005 Originally posted by Darth333 Well in this case, the script is planted on the OnEnter event of the .are file... I really don't see how OBJECT_SELF could be something else than the Module itself OBJECT_SELF being the module, then GetModule works just as well. If it's an OnEnter script for an area, then the Area object is OBJECT_SELF, not the Module. Areas are objects too, you can set local vars on areas just like you can on creatures, waypoints, placeables, triggers, the active module etc... I don't know if that's the case in this particular script, but some area OnEnter scripts use local booleans and numbers set on the Area to track when things have been done. If you make the Module run the script instead, it will check for those Locals on the Module object, as well as set any Locals set on OBJECT_SELF on the Module rather than the area. This can cause trouble when other scripts check or set those Locals on the Area. (While KotOR only has one area per module, theoretically there is no such limit in the engine. NWN, which the Odyssey engine branched off from, can have any number of areas per module. Some of the bigger ones have hundreds of areas in a single module.) GetArea() will return a reference to the the Area object that the object specified as a parameter exists within. In KotOR this would always be the active area since there's only one area per module (provided that the object used as a parameter is valid and not an area or the module, that is ). GetModule() will return a reference to the Module object that is currently loaded. The game can only have one module loaded at the same time. Link to comment Share on other sites More sharing options...
darthrichard Posted July 14, 2005 Author Share Posted July 14, 2005 anyway... void main() { object oEntering = GetEnteringObject(); object oPC=GetFirstPC(); if (GetIsPC(oEntering)) { if (!GetIsObjectValid(GetObjectByTag("n_richard"))) { CreateObject(OBJECT_TYPE_CREATURE, "n_richard", Location(Vector(34.44,162.62,0.00), 0.0)); } ExecuteScript("k_pend_area01old", OBJECT_SELF()); } } is that rite? simple awnser please...unless its no Link to comment Share on other sites More sharing options...
darthrichard Posted July 14, 2005 Author Share Posted July 14, 2005 is there a program im supposed to save it on? nothing supports .nss Link to comment Share on other sites More sharing options...
tk102 Posted July 14, 2005 Share Posted July 14, 2005 Yes darthrichard, it looks fine. Use whatever text editor you want (ie. notepad) to write the text. Just make sure when you're done, the file has an extension of .nss (not .nss.txt ). To be sure, in Windows Explorer you should choose Tools: Folder Options: View Tab and make sure "Hide File Extensions of Known Types" is unchecked. As for "file support" of .nss files -- I answered your question about that here. Link to comment Share on other sites More sharing options...
darthrichard Posted July 14, 2005 Author Share Posted July 14, 2005 yea it was doing .nss.txt ok configuration time update: whoa everything flashed...*epeleptic fit* update 2:so i extract 1 file from kt (k_pend_area01) and make a new one i rename the extracted one with old in it ... in the new one io put execute script thing with the k_pend_area01OLD put both of them in the swkotor directory then run conpiler... then? update 3?.how do i conpile it lol Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.