Jump to content

Home

Trouble with scripting an item to Inventory


harIII

Recommended Posts

Posted

I am working on a mod for K1 and there is a script that I need to take affect. I've tried to script an item into your inventory but for some reason it has yet to take effect. I've tried three different Lucasforums examples and two or three source game examples and yet it doesn't take effect.

 

I am inserting the script in a dialog and the preticular section of dialog is an option that you select.

 

I'm not sure if the script is correct or wrong or if I am placeing it in area where it isn't taking affect.

Posted

void main()

{

object oItem=CreateItemOnObject("k33_itm_sithmdln", GetFirstPC());

}

 

The k33_itm_sithmdln is the tag or templateresref of my custom item.

Posted

I'm not a scripting expert, but your code looks fine to me. What dialog is supposed to fire the script?

 

You could try adding a feedback message to your code to see if it even fires at all.

 

DelayCommand(4.0, SendMessageToPC(GetPartyLeader(), "MY SCRIPT IS RUNNING!"));

 

- Star Admiral

Posted

Thanks, I'll try it. This is new dialog that I am working with and I've done a few things to recruit others, turn them hostile, make merchants, but this one has be stumpped as to what to do. I'm not sure if it is the dialog or the script but should this help for anything, my dialog does indeed work. I'm placing the script in an area where you have to select what the you want to say to the NPC.

Posted

Yes, I know that it's the same name as the Sith Medallion that you use on Korriban but I have the new item which is called the Master's Medallion in the override folder.

Posted

The ingame name doesn't matter. What matters is the file name: make sure that it is the same as the one in your script unless you want to replace an actual game item.

Posted
void main()

{

object oItem=CreateItemOnObject("k33_itm_sithmdln", GetFirstPC());

}

 

The k33_itm_sithmdln is the tag or templateresref of my custom item.

 

Actually, what you've done is to declare an action as an object, and that is wrong. Here is the correct form:

 

void main()
{
object oItem = GetObjectByTag("k33_itm_sithmdln");
object oPC = GetFirstPC();

CreateItemOnObject(oItem, oPC);
}

 

This works for K2 and should work for K1, too!;)

 

EDIT: @D3 Well I didn't know that, since I script mainly for TSL and that seems wrong. But if you say it isn't, I have no reason to doubt that.;)

 

|I|

Posted

Thanks for you input and I will try it some more tonight. I do know about the compiling and do have an idea about how to fire scripts but I just don't know wheather the problem is in the section of fireing the script or the programming of the script itself.

 

I will do more testing and tell what happens.

Archived

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

×
×
  • Create New...