Jump to content

Home

When does a script get executed ?


Desmond5

Recommended Posts

I just started learning modding so this question might sound quite stupid...

 

I wan't to make a script that adds money to the container where you get your initial equipment when you start the game (in tutorial level). I went through some tutorials I found out that I would probably have to use this function:

 

void main()

{

CreateItemOnObject("G_I_CREDITS001", The Container , 1000);

}

 

But ...

 

What now ? I know the function but how can I add it to the game ? I can't just compile it and copy it to the override folder, right ? How do I define when the script gets executed (in what area) ?

And how do I know what is the name of the container I want to use (the initial equipment container) ?

 

Regards, Desmond

Link to comment
Share on other sites

Hey, I think I can actually help out here. :)

 

I did something pretty similar for my first mod, putting my Godslayer of Hitpoints and my Invulnerability Suit in Revan's footlocker on the Endar Spire.

 

What I did was to modify Trask's opening dialog to fire my script. Entry #73 "So hurry up and grab your gear..." should pretty much always occur in that conversation.

 

Simply change the "script" field to the name of your script and place both the compiled script and the modified .dlg in the override folder and you should be good to go.

 

The container in question is named "end_locker01," which is a logical enough name. I imagine you'd have to employ the guess-and-check method to find any container you didn't know the name of (someone else handed me the name for that one.) Unless there's a list of what placables are where somewhere?

 

Anyway, if you want to look at or adapt my mod, it can be found here

 

If anyone knows alternate ways this can be done, I'm interested too.

Link to comment
Share on other sites

BobRichter you are spot on! :D

 

And I think this is the only way to add items to anything in the initial footlocker or the first room down the hall's republic soldier corpse and metalbox, and any other placeable on that first level as well.

 

Desmond5 in Kotor Tool look in RIM's / Modules / end_m01aa_s.rim / placeables to find the different containers used in the first level, and they are;

 

backpack001.utp Script Tag "Backpack" on the bridge.

 

footlocker001.utp Script Tag "end_locker01" your beginning rooms locker.

 

footlocker003.utp Script Tag "FootLker" the first rooms locker, with the combat vest.

 

metalbox001.utp Script Tag "MetalBox" the first rooms box with 10Cr and a Medpack.

 

partpile001.utp Script Tag "PartPile" the pile of parts at the end of the hall next to the droid that dies as you approach.

 

rsldcrps002.utp Script Tag "RSldCrps" the soldier corpce in the first room down the hall.

 

Any of these can have items added to them with a script that fires in the initial dialogue with Trask using the "Hurry up and grab your gear" line.

 

And your script for the credits into the first locker would be;

 

void main()
{
CreateItemOnObject("g_i_credits001", GetObjectByTag("end_locker01"), 1000);
}

 

But why stop there while you are at it you could add this to it;

 

void main()
{
CreateItemOnObject("g_i_credits001", GetObjectByTag("end_locker01"), 5000);
CreateItemOnObject("g_w_hvyblstr01", GetObjectByTag("end_locker01"), 2);
CreateItemOnObject("g_w_rptnblstr01", GetObjectByTag("end_locker01"));
CreateItemOnObject("g_w_blstrcrbn001", GetObjectByTag("end_locker01"));
CreateItemOnObject("g_a_class5010", GetObjectByTag("end_locker01"));
CreateItemOnObject("g_w_lghtsbr05", GetObjectByTag("Backpack"));
CreateItemOnObject("g_w_shortsbr05", GetObjectByTag("Backpack"));
CreateItemOnObject("g_w_dblsbr005", GetObjectByTag("Backpack"));
CreateItemOnObject("g_i_credits001", GetObjectByTag("Backpack"), 5000);
CreateItemOnObject("g_w_fraggren01", GetObjectByTag("MetalBox"), 24);
CreateItemOnObject("g_i_medeqpmnt01", GetObjectByTag("MetalBox"), 24);
CreateItemOnObject("g_i_parts01", GetObjectByTag("PartPile"), 23);
CreateItemOnObject("g_i_drdrepqp001", GetObjectByTag("PartPile"), 24);
}

 

This is just an example to show you that the possibilities are pretty wide open.

 

I hope this helps! :D

Link to comment
Share on other sites

Originally posted by BobRichter

...

The container in question is named "end_locker01," which is a logical enough name. I imagine you'd have to employ the guess-and-check method to find any container you didn't know the name of (someone else handed me the name for that one.) Unless there's a list of what placables are where somewhere?

...

If anyone knows alternate ways this can be done, I'm interested too.

You can look at the .git file: it lists all the placeables with their coordinates ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...