Originally posted by [b]Ihades[/b]
http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=3050
Okay. There are two ways of fixing this bug and I'm going to list both ways.
The getitem() function documentation:-
CODE
*getitem <item id>,<amount>{,<character ID>};
*getitem "<item name>",<amount>{,<character ID>};
This command will give a specific amount of specified items to the target
character. If the character is not online, nothing will happen.
If <character ID> is not specified, items will be created in the invoking
character inventory instead.
For one of my scripts, I tried passing the character ID for each of the party member's char ID (
$@partymembercid[0]) to the getitem function and it didn't work. So, I decided to take a look at the code and this is what I found.
CODE
if( script_hasdata(st,4) )
sd=map_id2sd(script_getnum(st,4)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
It clearly states it's an account ID, so:
- Either you can just fix the typo in script_commands.txt or
- Fix the code to accept char ID for which,
you need to replace this:
CODE
if( script_hasdata(st,4) )
sd=map_id2sd(script_getnum(st,4)); // <Account ID>
else
sd=script_rid2sd(st); // Attached player
with this:
CODE
if( script_hasdata(st,4) )
sd=map_charid2sd(script_getnum(st,4)); // <Character ID>
else
sd=script_rid2sd(st); // Attached player
I've tested my fix and it works as well.
This post has been edited by Ihades: May 4 2009, 08:16 PM