Emperor Devon Posted August 13, 2005 Share Posted August 13, 2005 Everyone must be getting sick of these threads by now... I have run into yet another scripting problem. I do not think the script has any errors in it, I was able to compile it with KOTOR tools' project manager without trouble, edit Nemo's dialgoue to spawn the container without trouble... Yet for some reason, the container will not spawn. This is the script I used: void main() { float x=122.34f; float y=138.21f; float z=1.50f; float r=1.0f; vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", oLocker); CreateItemOnObject("g_a_mstrrobe01", oLocker); CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2); } Thanks for any help. Link to comment Share on other sites More sharing options...
Darth333 Posted August 13, 2005 Share Posted August 13, 2005 Script looks ok. Could be a problem with the *.utc file...is it in your override folder? Obvious but it happened to me in the past Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 Nope. The placeable is unique. Link to comment Share on other sites More sharing options...
ChAiNz.2da Posted August 13, 2005 Share Posted August 13, 2005 Nope. The placeable is unique. Is the footlker099.utp in your override? and is it's "Name" and "Tag" fields named the same (footlker099)... Even though the scripts are spawning the contents and the locker, you still need to have a 'physical' .utp file in your override Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 Yep, that's in my Override. I guess what's wrong is the dialogue to spawn the container. This is what I did for it: Nemo: It is good, sometimes {snip} Speaker: Listener: Script that determines availability: Script that fires when spoken: footlker099.ncs VO_ResRef: {snip} Sound: Link to comment Share on other sites More sharing options...
stoffe Posted August 13, 2005 Share Posted August 13, 2005 Yep, that's in my Override. I guess what's wrong is the dialogue to spawn the container. This is what I did for it: Script that fires when spoken: footlker099.ncs If you have specified the .ncs suffix in the dialog file, remove it and it will probably work. Resrefs don't include the file suffix, it should just be footlker099. Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 Thank you very much! One last question. If I wanted spawn two objects with one script, would it look like this? void main() { float x=122.34f; float y=138.21f; float z=1.50f; float r=1.0f; vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", oLocker); CreateItemOnObject("g_a_mstrrobe01", oLocker); CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2); } void main() { float x=132.34f; float y=148.21f; float z=2.50f; float r=1.0f; vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker098", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", oLocker); CreateItemOnObject("g_a_mstrrobe01", oLocker); CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2); } Link to comment Share on other sites More sharing options...
RedHawke Posted August 13, 2005 Share Posted August 13, 2005 ^^^^ No it wouldn't. ED here is an example script for spawning multiple placeables. void main() { //Spawn Placeable 1... float a=0.00f; // Placeable 1 Coordinates Here float b=0.00f; float c=0.00f; float d=0.0f; vector MyVec1 = Vector(a,b,c); //line 1 location MyLoc1 = Location(MyVec1, d); //line 2 object oLocker1=CreateObject(OBJECT_TYPE_PLACEABLE, "PLACEABLETAG1HERE", MyLoc1); //line3 //Spawn Placeable 2... float x=0.00f; // Placeable 2 Coordinates Here float y=0.00f; float z=0.00f; float r=0.0f; vector MyVec2 = Vector(x,y,z); //line 1 location MyLoc2 = Location(MyVec2, r); //line 2 object oLocker2=CreateObject(OBJECT_TYPE_PLACEABLE, "PLACEABLETAG2HERE", MyLoc2); //line3 //Now Place items in them... Placeable 1. CreateItemOnObject("g_w_lghtsbr05", oLocker1); CreateItemOnObject("g_a_mstrrobe01", oLocker1); CreateItemOnObject("g_w_sbrcrstl04", oLocker1, 2); //Now items for Placeable 2. CreateItemOnObject("g_w_lghtsbr05", oLocker2); CreateItemOnObject("g_a_mstrrobe01", oLocker2); CreateItemOnObject("g_w_sbrcrstl04", oLocker2, 2); // Add more lines for each placeable to taste. } I hope this helps! Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 Are you sure? KOTOR tool won't compile this, since it uses "MyLoc" and "MyVec" too many times. void main() { float a=50.54f; float b=358.96f; float c=36.37f; float d=1.0f; vector MyVec = Vector(a,b,c); //line 1 location MyLoc = Location(MyVec, d); //line 2 object oLocker1=CreateObject(OBJECT_TYPE_PLACEABLE, "footlker098", MyLoc); //line3 float x=66.60f; float y=345.31f; float z=36.37f; float r=1.0f; vector MyVec = Vector(x,y,z); //line 1 location MyLoc = Location(MyVec, r); //line 2 object oLocker2=CreateObject(OBJECT_TYPE_PLACEABLE, "footlker097", MyLoc); //line3 CreateItemOnObject("g_w_lghtsbr05", oLocker1); CreateItemOnObject("g_a_mstrrobe01", oLocker1); CreateItemOnObject("g_w_sbrcrstl04", oLocker1, 2); CreateItemOnObject("g_w_lghtsbr05", oLocker2); CreateItemOnObject("g_a_mstrrobe01", oLocker2); CreateItemOnObject("g_w_sbrcrstl04", oLocker2, 2); } Link to comment Share on other sites More sharing options...
Det. Bart Lasiter Posted August 13, 2005 Share Posted August 13, 2005 Try this: void main() { vector vLoc1 = Vector(50.54f, 358.96f, 36.37f); location lLoc1 = Location(vLoc1, 1.0f); object oLock1 = CreateObject(64, "footlker98", lLoc1); //---------------------------------- //Now create the next footlocker... //---------------------------------- vector vLoc2 = Vector(66.60f, 345.31f, 36.37f); location lLoc2 = Location(vLoc2, 1.0f); object oLock2 = CreateObject(64, "footlker97", lLoc2); //-------------------------------------------------------------------------- //Now spawn the items, although you could just edit the .utp's inventory... //-------------------------------------------------------------------------- CreateItemOnObject("g_w_lghtsbr05", oLock1); CreateItemOnObject("g_a_mstrrobe01", oLock1); CreateItemOnObject("g_w_sbrcrstl04", oLock1, 2); CreateItemOnObject("g_w_lghtsbr05", oLock2); CreateItemOnObject("g_a_mstrrobe01", oLock2); CreateItemOnObject("g_w_sbrcrstl04", oLock2, 2); } That should work Link to comment Share on other sites More sharing options...
RedHawke Posted August 13, 2005 Share Posted August 13, 2005 Are you sure? Yes... I fixed the minor errors in the script I posted above. In the future when posting a script please use code tags. Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 Thanks, the script works now. I have one final question, this time about spawning multiple NPCs. Can you see anything wrong with this script? KOTOR tool doesn't seem to want to compile it. void main() { float a=25.87f float b=92.90f; float c=23.10f; float d=0.0f; vector MyVec1 = Vector(a,b,c); //line 1 location MyLoc1 = Location(MyVec1, d); //line 2 object oLocker1=CreateObject(OBJECT_TYPE_CREATURE, "holy", MyLoc1); //line3 float x=255.88f; float y=79.93f; float z=21.51f; float r=0.0f; vector MyVec2 = Vector(x,y,z); //line 1 location MyLoc2 = Location(MyVec2, r); //line 2 object oLocker2=CreateObject(OBJECT_TYPE_CREATURE, "tusken1", MyLoc2); //line3 } Link to comment Share on other sites More sharing options...
stoffe Posted August 13, 2005 Share Posted August 13, 2005 Thanks, the script works now. I have one final question, this time about spawning multiple NPCs. Can you see anything wrong with this script? KOTOR tool doesn't seem to want to compile it. void main() { float a=25.87f (snip) You are missing a semicolon after the line where you assign a value to the a variable. However, if you don't intend to do anything else with those creatures than spawn them, this should be enough: void main() { CreateObject(OBJECT_TYPE_CREATURE, "holy", Location([ 25.87, 92.90, 23.10], 0.0)); CreateObject(OBJECT_TYPE_CREATURE, "tusken1", Location([255.88, 79.93, 21.51], 0.0)); } In my personal opinion it's a bit excessive to declare 14 variables when you don't really need any of them, but I guess it doesn't matter much in the end. It'll work either way, and the speed difference would be negligible. Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 void main() { CreateObject(OBJECT_TYPE_CREATURE, "holy", Location([ 25.87, 92.90, 23.10], 0.0)); CreateObject(OBJECT_TYPE_CREATURE, "tusken1", Location([255.88, 79.93, 21.51], 0.0)); } I tried using this script, and it caused the game to crash. Link to comment Share on other sites More sharing options...
stoffe Posted August 13, 2005 Share Posted August 13, 2005 I tried using this script, and it caused the game to crash. Hmm, odd. Are you sure your creature templates are working? Shouldn't be anything else in that script that could cause it to crash AFAIK. All it does it spawn the two creatures. Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 The templates are working. I re-did the script, tried it with some different NPCs, and I still have the same results. Link to comment Share on other sites More sharing options...
stoffe Posted August 13, 2005 Share Posted August 13, 2005 The templates are working. I re-did the script, tried it with some different NPCs, and I still have the same results. Odd, I've done dozens of such scripts for both NWN and TSL and never had any problems. This is for KotOR1, right? Just in case vector constants somehow are broken in KotOR1, try this variant instead: void main() { CreateObject(OBJECT_TYPE_CREATURE, "holy", Location(Vector(25.87, 92.90, 23.10), 0.0)); CreateObject(OBJECT_TYPE_CREATURE, "tusken1", Location(Vector(255.88, 79.93, 21.51), 0.0)); } If that fails too, verify that the coordinates are correct. I don't know how the game would react if you try to spawn a creature outside the map. Link to comment Share on other sites More sharing options...
Emperor Devon Posted August 13, 2005 Author Share Posted August 13, 2005 This is for KOTOR I. I'm absolutely certain the coordinates are correct, yet whenever I talk to Tanis' wife, the game crashes. Link to comment Share on other sites More sharing options...
stoffe Posted August 13, 2005 Share Posted August 13, 2005 This is for KOTOR I. I'm absolutely certain the coordinates are correct, yet whenever I talk to Tanis' wife, the game crashes. Hmm, I just created two creature templates with those resrefs and tested that exact script (with only the coordinates changed to a valid location within my test area) with both TSL and NWN, and it worked just fine in both games. The creatures were spawned without indicent. I don't have KotOR1 installed currently so I can't test it with that, unfortunately. I haven't done much modding for KotOR1 so I am unsure if the scripting there would work any different than how it does in TSL and NWN. I don't know what else to suggest if your templates and locations are correct. Hopefully someone else who's better at this than me can help you. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.