Issue information

Issue ID
#6540
Status
New
Severity
None
Started
Hercules Elf Bot
Aug 22, 2012 20:39
Last Post
Hercules Elf Bot
Aug 22, 2012 21:03
Confirmation
N/A

Hercules Elf Bot - Aug 22, 2012 20:39

Originally posted by [b]Mooka[/b]
[quote name='scripts_commands.txt']
*unitwalk <GID>,<x>,<y>;
*unitwalk <GID>,<mapid>;
[spoiler]
This is one command, but can be used in two ways. If only the first argument is given,
the unit whose GID is given will start walking towards the map with the given mapid
(we believe these are the map-indexes found in db/map_index.txt).

When 2 arguments are passed, the given unit will walk to the given x,y coordinates on
the map where the unit currently is.
[/spoiler]
Example(s):

//Will move/walk the poring we made to the coordinates 150,150
unitwalk .GID,150,150;

[b][color=#DAA520][1] [/color][/b][color=#ff0000][b]//Will [u]move the poring[/u] towards alberta (if my assumed map-indexes are correct).[/b][/color]
[b]unitwalk .GID, 3;[/b]

---------------------------------------

*unitkill <GID>;
*unitwarp <GID>,<Mapname>,<x>,<y>;
*unitattack <GID>,<Target ID>;
*unitstop <GID>;
*unittalk <GID>,<Text>;
*unitemote <GID>,<Emote>;

Okay, these commands should be fairly self explaining.
For the emotions, you can look in db/const.txt for prefixes with e_
PS: [b][color=#daa520][2][/color][/b] [b]unitwarp supports a <GID> of zero[/b], which causes the executor of the script to be affected. [b][color=#DAA520][3] [/color][/b][b]This can be used with OnTouchNPC to warp monsters:[/b]

OnTouchNPC:
unitwarp 0,"this",-1,-1;
[/quote]




[b][color=#DAA520][1][/color][/b] I tried three methods to catch a likely MobID and none worked, i'll explain below. (It's impossible obtain a MobID?)
[b][color=#DAA520][2] [/color][/b]I test with my char, and nothing happens. (unittalk 0, "Hello" ;).
[b][color=#DAA520][3] [/color][/b]Nothing happens. (i think this happens because bug on [2])


[b]Methods which i have used to get a possible MobID.[/b]

1. Take the MobID with GM Cloth and input this ID on npc to make an action.
[img]https://dl.dropbox.com/u/38027321/img/screenrAthena002.jpg[/img]

Script:
[CODE]
prontera,155,164,5 script TouchTest 802,5,5,{
monster("prontera", 155, 165, "--ja--", 1001, 1);
end;
OnTouchNPC:
unittalk 0, "sucess";
end;
}
[/CODE]


2. With OnTouchNPC, but not happens, as i said before.
[img]https://dl.dropbox.com/u/38027321/img/screenrAthena004.jpg[/img]

Script:


[CODE]
prontera,155,150,5 script MoveTest 801,{

input @mobid;
unittalk @mobid, "sucess";

}[/CODE]

3. Verify if anything happens with the Monster command return value. (nothing happens)

[CODE]
prontera,152,150,5 script Test 800,{

dispbottom "#"+@mobid;
set @mobid, monster("prontera", 150, 150, "--ja--", 1001, 1);
unittalk @mobid, "sucess";

}[/CODE]

This post has been edited by Mooka on Aug 22, 2012 20:41

Hercules Elf Bot - Aug 22, 2012 20:57

Originally posted by [b]Aleos[/b]
I believe the issue you are having is because the script command "monster" doesn't return the game ID. Modify the "monster" command and then you get:
[code]BUILDIN_FUNC(monster)
{
const char* mapn = script_getstr(st,2);
int x = script_getnum(st,3);
int y = script_getnum(st,4);
const char* str = script_getstr(st,5);
int class_ = script_getnum(st,6);
int amount = script_getnum(st,7);
const char* event = "";
int id;

struct map_session_data* sd;
int m;

if( script_hasdata(st,8) )
{
event = script_getstr(st,8);
check_event(st, event);
}

if (class_ >= 0 && !mobdb_checkid(class_)) {
ShowWarning("buildin_monster: Attempted to spawn non-existing monster class %d\n", class_);
return 1;
}

sd = map_id2sd(st->rid);

if( sd && strcmp(mapn,"this") == 0 )
m = sd->bl.m;
else
{
m = map_mapname2mapid(mapn);
if( map[m].flag.src4instance && st->instance_id )
{ // Try to redirect to the instance map, not the src map
if( (m = instance_mapid2imapid(m, st->instance_id)) < 0 )
{
ShowError("buildin_monster: Trying to spawn monster (%d) on instance map (%s) without instance attached.\n", class_, mapn);
return 1;
}
}
}

id = mob_once_spawn(sd,m,x,y,str,class_,amount,event);
script_pushint(st,id);

return 0;
}[/code]

That will return the monster game ID so that your script above in part 3 will work.

Hercules Elf Bot - Aug 22, 2012 21:03

Originally posted by [b]Kenpachi[/b]
Kind of related: [url="http://rathena.org/board/tracker/issue-4999-mob-control-command-reference-at-script-commands/"]http://rathena.org/board/tracker/issue-4999-mob-control-command-reference-at-script-commands/[/url]