Hi.
I wrote a script for an item which, when used by a character, creates another item. This created item has a ControlScript and I need to pass the character who used the previous script to that ControlScript. I've tried SetObjProperty(item, "Creator", who); in the first script, and creator := GetObjProperty(item, "Creator"); in the ControlScript, but, when I want to create another item (through the ControlScript) using CreateItemInContainer(creator.backpack, [hex-type], [amount]); it doesn't seem to work :/ I think the method in itself is OK and who isn't correct. I've tried who.serial, but it doesn't seem to work either :/
Any suggestions?
How to pass a parameter to a ControlScript?
I would suggest this way.
First script (item creation):
Second script (control script):
First script (item creation):
Code: Select all
...
SetObjProperty(item, "Creator", who.serial);
...
Code: Select all
...
var createdbyserial := GetObjProperty(item, "Creator");
var creator := SystemFindObjectBySerial(createdbyserial,SYSFIND_SEARCH_OFFLINE_MOBILES);
if(creator)
...
endif
...