View Single Post
Old 01-26-2005, 07:30 PM   #1
Shadow Lord Of The Sith™
RedHawke's Avatar
Status: Moderator
Join Date: Mar 2004
Location: Stormreach CA.
Posts: 9,184
Current Game: DDO, Stormreach
Original Thread
This tutorial is example-oriented, with Redhawke providing an example of spawning a locker with items inside. tk102 discusses how to prevent re-entry in the second post.

If you want to spawn your own Footlocker, try this;

Extract a game footlocker, remove any items from it's invantory and scripts from the scripts fields, then change the templateresref and resref to footlker099, then change it's tag to Footlocker99 then save the .utp file as footlker099.utp.

Here is the basic script to spawn a footlocker that uses the .utp you created above in the game and place some items into it, therefore you can use the same footlocker .utp all throughout the game and it all works the same as it is the script that denotes what is in the footlocker / metalbox / plastic cylender / etc.


//note this code allows for re-entry as-is,
// you should only attach it to a dialog
// that you know will only fire once.
// To prevent re-entry in a more general sense, see tk102's notes in the next post

void main()
    vector MyVec;
    MyVec.x = 0.00f; //Here is where you add the 'whereami' cheat coordinate 1. 
    MyVec.y = 0.00f; //Here is where you add the 'whereami' cheat coordinate 2.
    MyVec.z = 0.00f; //Here is where you add the 'whereami' cheat coordinate 3 (elevation).
    float r = 0.0f;  // This is where you set the orientation of the placeable, set in degrees.
    object oLocker = CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", Location(MyVec, r));

    CreateItemOnObject("g_w_lghtsbr05", oLocker);
    CreateItemOnObject("g_a_mstrrobe01", oLocker);
    CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2);
Another simplified way to write this code could be:
void main()
object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", Location(Vector(0.00,0.00,0.00), 0.0)); 

CreateItemOnObject("g_w_lghtsbr05", oLocker);
CreateItemOnObject("g_a_mstrrobe01", oLocker);
CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2);

Copy this text paste it to notepad and then edit the file to taste, you will have to enter the coordinates for your footlocker in the appropriate lines that you got from the 'whereami' cheat.

You will likely have to test the script a couple of times to get the Footlocker's orientation correct, I suggest sticking to North or 0.00, East or 90.00, South or 180.00, and West or 270.00, but you can use any others.

Regarding the items you wish to place in the Footlocker, you can easily add more of the CreateItemOnObject lines... hundreds if you want to, all you have to do is change the item tags in the first set of quotations. The ones that look like the 'giveitem' cheat codes.

Also note the last CreateItemOnObject line in the script has a 2 on the end, this is if you wish a certain quantity of the same item to be placed into the container, so in this line when run it would place 2 of those saber crystals with the item tag of g_w_sbrcrstl04 in the locker, you can use any number, I have used up to 500 with no problems.

Save your script as... say ev_footlkr1.nss make sure you save it as an .nss file and not .txt.

Next you will have to compile it a good thread to help you with that is here.

Once you have your script compiled and you have your ev_footlkr1.ncs, you can move on to the last parts.

FYI you can delete the .ndb files that the compiler generates.

Next you will need the .dlg file from an in game cutscene. The best place for attaching placeable spawning scripts is the mandantory in game cutscenes. Example: the Sith and Republic Soldiers bantering on Manaan.
Open the module up and locate the cutscenes dialog (.dlg) file open it up in the dialogue editor of your choice, Fred's or tk102's and search for a line that is certain to be spoken, and you should see somewhere a place that says "script to run for this node" or "script that fires when spoken" and make sure it is blank, if it is then you can easily enter your script name in there, in your case it would be ev_footlkr1. Save the edited .dlg file.

Place the .dlg file you edited, the ev_footlkr1.ncs, the footlker099.utp, and all of your possible custom item files you want to place in the Footlocker into your override.

Fire up the game, and then load your save you have before entering that area or activating that dialogue, and see what happens, as I stated above you may have to test the orientation of your placeable a couple of times, but that is just a simple number change in the script and a recompile.

This is why I personally favor useing the Metal Box placeable as it's orientation doesn't really matter.

Once you get the hang of it you will find this easy to do. Wow... this is a mini-tutorial isn't it?

I hope this helps!

"Beware the form-fitting black armor-clad Drow hottie with twin Mineral II Greensteel Khopeshes!"
"Liella d'Orien says, '"You're the fool, Devil. -- Witness the power of this fully ARMED and OPERATIONAL Titan!"'"

Last edited by Darth333; 07-18-2007 at 01:16 PM. Reason: added simplified spawn script
RedHawke is offline   you may: quote & reply,