PDA

View Full Version : Merchant Issues


gamerlj
10-24-2009, 09:37 PM
I have created some items that I would to place in Geeda's shop inventory so he can sell them to me. The problem, is my items don't appear when I talk to him. I have even tried adding a non-custom item to his inventory. It doesn't appear either. To spawn my custom items I am using the following script:


//This script adds Padawan's Experience, Knight's Experience, and Master's Experience
//To Geeda's store inventory.
//Written by: Lee Johnson 10/24/2009


void main()
{
if(GetGlobalNumber("V_Geeda") == 0)
{
SetGlobalNumber("V_Geeda", 1);
}
if(GetGlobalNumber("V_Geeda") > 0)
{
CreateItemOnObject("padawan_exp", GetObjectByTag("GeedaStore",0), 1, 0);
CreateItemOnObject("knight_exp", GetObjectByTag("GeedaStore", 0), 1, 0);
CreateItemOnObject("master_exp", GetObjectByTag("GeedaStore", 0), 1, 0);
}
}


Any ideas why the items are not appearing in his inventory? Any help on this would be much appreciated thanks.

harIII
10-24-2009, 09:46 PM
Try adding them in .utm file or make sure they're in there.

Try starting a new game. This happens to me a lot in K1, not sure about K2 though starting a new game for some reason fixes a lot of things that I put in module files.

gamerlj
10-24-2009, 10:00 PM
Thanks for the suggestion Harlll. I'll give it a go.

stoffe
10-25-2009, 07:40 AM
I have created some items that I would to place in Geeda's shop inventory so he can sell them to me. The problem, is my items don't appear when I talk to him. I have even tried adding a non-custom item to his inventory. It doesn't appear either. To spawn my custom items I am using the following script:


Have you added a global variable named V_Geeda to the globalcat.2da file? Otherwise the value you first set and then check for would never be stored and thus returned as 0.

Also, the whole variable check serves no purpose in that script from what I can see. If the variable isn't set it will get set first thing at script execution, and if it's set (which subsequently would be 100% of the time) the items get added to the store. If you want to make sure the items only get added once you can re-arrange the variable checks like:


void main() {
if(!GetGlobalBoolean("V_Geeda")) {
object oStore = GetObjectByTag("GeedaStore");

CreateItemOnObject("padawan_exp", oStore);
CreateItemOnObject("knight_exp", oStore);
CreateItemOnObject("master_exp", oStore);

SetGlobalBoolean("V_Geeda", TRUE);
}
}


Try adding them in .utm file or make sure they're in there.


Adding items via scripts is generally preferable since it always work (depending on where the script is run from), while if you add it to the UTM template it will only work if the player hasn't been in the area where the store is located yet. Otherwise the store will already be instantiated and stored in the savegame and the UTM file isn't used by the game any more.