Jump to content

Home

Scripting question


Kalos

Recommended Posts

Probably the easiest way would be to attach a conditional script on to a dialog.

 

First create two scripts to place items in the placeable, one for a female and one for a male. I haven't got the games or KOTOR Tool installed on this computer so I'm going by memory.

void main()
{
   	object oPlaceable=GetObjectByTag(INSERT_TAG_HERE);

CreateItemOnObject("ITEM_RES_REF_HERE", oPlaceable);
}

Just replace the item you want for each of them and complie the script.

Now edit a dialog file, if you're using a custom dialog this will be easier. Create two nodes that say the same thing, on the top one put c_isfemale in the conditional field and the above script, for the female item, in the script field. On the next node, which will be for a male, leave the conditonal field empty and place the script for the male item in the script field. If you're not using a custom dialog just look through as there may already be nodes for checking if the player is male or female.

 

Now when you start the conversation, when it gets to the nodes you created it will check to see if the player is female, if it is then that script will fire, if not it will then go down to the male node.

 

Remember that the dialog you fire the script from will have to be done in the same module and also if there's more than one placeable with the same tag in the area then all of them will have the items spawnned in them.

 

I hope this makes sense, I'm terrible at explaining things. If you get stuck just post again with details of where you're trying to do this and I'll go through it with you step by step.

 

Kind Regards

--Stream

Link to comment
Share on other sites

I'm wondering if it's possible to make a script so that if the player is male, one item spawns in a container and if the player is female another item spawns.

 

Or you could check the gender in the script when spawning. For example:

void main() {
   string sItem = (GetGender(GetFirstPC()) == GENDER_MALE ? "[color=SkyBlue]MaleItem[/color]" : "[color=Red]FemaleItem[/color]");
   CreateItemOnObject(sItem, GetObjectByTag("[color=Yellow]Container[/color]"));
}

 

Where you set MaleItem to the name of the UTI file with the male item, FemaleItem to the name of the UTI file with the female item, and Container to the tag of the container to spawn the item in.

Link to comment
Share on other sites

Or you could check the gender in the script when spawning. For example:

void main() {
   string sItem = (GetGender(GetFirstPC()) == GENDER_MALE ? "[color=SkyBlue]MaleItem[/color]" : "[color=Red]FemaleItem[/color]");
   CreateItemOnObject(sItem, GetObjectByTag("[color=Yellow]Container[/color]"));
}

 

Where you set MaleItem to the name of the UTI file with the male item, FemaleItem to the name of the UTI file with the female item, and Container to the tag of the container to spawn the item in.

 

 

I tried it and it didn't work for me. :( This is the script I did.

 

void main() {

string sItem = (GetGender(GetFirstPC()) == GENDER_MALE ? "exiletunic" : "f_exilerobe");

CreateItemOnObject(sItem, GetObjectByTag("oLocker"));

}

 

Edit: And Stream, yours is kind of confusing. Could you do a step by step? My UTIs are exiletunic for male and f_exilerobe for female. I want to put it in the exile's room in that locker (So the container is oLocker I believe) and the dialoge I need to attach it to is 152kreia.

Link to comment
Share on other sites

I tried it and it didn't work for me. :( This is the script I did.

 

void main() {

string sItem = (GetGender(GetFirstPC()) == GENDER_MALE ? "exiletunic" : "f_exilerobe");

CreateItemOnObject(sItem, GetObjectByTag("oLocker"));

}

 

Are you sure the tag (set in the UTP template) of the locker really is oLocker? Sounds more like a variable name than a tag to me. If you don't specify the correct tag the script won't find the locker to put the items in.

 

Also make sure the locker in question has a unique tag. If there are multiple objects in the area with the same tag the items might get created on the wrong one.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...