New item member: gottenby
Posted: Sat Jul 05, 2008 4:42 am
When an item is picked up by player, core marks it for the character. While holding, dragged item can be retrieved using character method GetGottenItem(). Nice and useful.
But, if scripter only wants to check if the item is gotten by someone, without knowing whom to check, one has to use a script like this:
Which, while a working solution, isn't really a neat one. So I'm suggesting that whenever an item is picked up by player, not only the item is marked to be gotten by character, but also the character is marked to be carrying the item.
That would item.gottenby, which would return character reference of carrier, if there is one.
Either so or the information could be saved in container member, like done when item is equipped, and the new item member could be just item.gotten, returning true or false, to tell apart equipped and gotten item.
Ideas, solutions?
But, if scripter only wants to check if the item is gotten by someone, without knowing whom to check, one has to use a script like this:
Code: Select all
function IsGotten( item )
foreach char in EnumerateOnlineCharacters()
if (char.GetGottenItem() == item)
return char;
endif
endforeach
endfunction
That would item.gottenby, which would return character reference of carrier, if there is one.
Either so or the information could be saved in container member, like done when item is equipped, and the new item member could be just item.gotten, returning true or false, to tell apart equipped and gotten item.
Ideas, solutions?