Jump to content
  • 0

using getmapxy to monster


hakuren

Question


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

help me with this script:

this script allow an npc to announce where is $@hehe_gid location coordinates but it doesnt work when announce it says that 0,0 help me with this please

prontera,152,150,5 script eqweq 912,{

set $@hehe_gid,bg_monster(0,"prontera",152,152,"Monster?",1004,"eqweq::OnDied");

getmapxy .@map$, .@x1, .@y1, 3,$@hehe_gid;

announce ""+.@x1+","+.@y1+"",0;

end;

OnDied:

getmapxy .@map$, .@x1, .@y1, 3,$@hehe_gid;

announce ""+.@x1+","+.@y1+"",0;

end;

Link to comment
Share on other sites

14 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})
 0 - Character object
 1 - NPC object
 2 - Pet object
 3 - Monster object.
While 3 is meant to look for a monster object, no searching will be done if you
specify type 3, and the function will always return -1.

Afaik, "search string" won't work with monsters. What exactly are you trying to do?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  05/19/12
  • Last Seen:  

Im try to create a npc that announce the monster that he/she summoned randomly

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

Since monster summon commands include x,y coordinates, you could set those using a variable beforehand and call that variable in the announce.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  10
  • Reputation:   0
  • Joined:  05/19/12
  • Last Seen:  

Could you give me example

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

Using variables in the spawn:

set .@mapname$,"prontera";
set .@x,150;
set .@y,150;
monster .@mapname$,.@x,.@y,"Poring",1002,1,"eqwep::OnMonsterKilled;
announce "I have spawned a Poring on the map "+.@mapname$+" at the coordinates "+.@x+" "+.@y,0;
end;

OnMonsterKilled:
getmapxy(.@mapname2$,.@x2,.@y2,3,"Poring");
announce "The monster has been killed at the coordinates "+.@x2+" "+.@y2+" on the map "+.@mapname2$,0;
end;

You could also use input commands to set the coordinates and map of the spawn.

Like this:

input .@mapname$;
next;
input .@x;
next;
input .@y;
mes "Are you sure you want it spawned here?: "+.@mapname$+" "+.@x+" "+.@y;
menu "Yes",L_spawn,"No",L_cancel;

L_spawn:
monster .@mapname$,.@x,.@y,"Poring",1002,1,"eqwep::OnMonsterKilled";
announce "I have spawned a Poring on the map "+.@mapname$+" at the coordinates "+.@x+" "+.@y,0;
end;
L_cancel:
mes "Very well.";
close;

OnMonsterKilled:
getmapxy(.@mapname2$,.@x2,.@y2,3,"Poring");
announce "The monster has been killed at the coordinates "+.@x2+" "+.@y2+" on the map "+.@mapname2$,0;
end;

Note: I haven't tested the getmapxy like that, but I'm fairly sure that's how it's used.

Also, I'm not sure if it will work because of the monster being dead when it's executed. My guess is that it won't though.

Edited by Joey
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

sir i think its not work when it died heres the picture

post-631-0-74442200-1339041461_thumb.jpg

the coordinate is still 0,0 help me please

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

As I thought, using getmapxy on a monster after it's dead won't work. You'll have to use the coordinates of the spawn in the broadcast instead.

Preset in script variables:

set .@mapname$,"prontera";
set .@x,150;
set .@y,150;
monster .@mapname$,.@x,.@y,"Poring",1002,1,"eqwep::OnMonsterKilled;
announce "I have spawned a Poring on the map "+.@mapname$+" at the coordinates "+.@x+" "+.@y,0;
end;

OnMonsterKilled:
announce "The monster has been killed at the coordinates "+.@x+" "+.@y+" on the map "+.@mapname$,0;
end;

Spawn input:

input .@mapname$;
next;
input .@x;
next;
input .@y;
mes "Are you sure you want it spawned here?: "+.@mapname$+" "+.@x+" "+.@y;
menu "Yes",L_spawn,"No",L_cancel;

L_spawn:
monster .@mapname$,.@x,.@y,"Poring",1002,1,"eqwep::OnMonsterKilled";
announce "I have spawned a Poring on the map "+.@mapname$+" at the coordinates "+.@x+" "+.@y,0;
end;
L_cancel:
mes "Very well.";
close;

OnMonsterKilled:
announce "The monster has been killed at the coordinates "+.@x+" "+.@y+" on the map "+.@mapname$,0;
end;

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

so the getmapxy doesn't work on mobs? I'm actually making a monster with died it will drop a custom item by chance of the xy coordinates where the monster died /sob I'm failed

but thank you so much sir joey and sir euphy

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

You can use getmapxy on monsters, but it won't work if they're dead.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

ohh i see thank you so much ^_^

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

you can try modify src let it return dead x ,y coordinate

mob.c

find

#include "quest.h"

add after

#include "mapreg.h"

find

  if( md->npc_event[0] && !md->state.npc_killmonster )

add after

mapreg_setreg(add_str("$@mobdead_x"), md->bl.x);
mapreg_setreg(add_str("$@mobdead_y"), md->bl.y);

recompile...

It should return last mob dead coordinate x ($@mobdead_x) and y($@mobdead_y)

Edited by QQfoolsorellina
  • Love 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   10
  • Joined:  05/14/12
  • Last Seen:  

Since I don't know anything about SRC, what would it be to add the mapname as well?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  120
  • Topics Per Day:  0.03
  • Content Count:  295
  • Reputation:   6
  • Joined:  12/02/11
  • Last Seen:  

it still same hmm i think theres a problem with the script i think

wooo it works! thanks QQfoolsorellina ^_^

Edited by hakuren
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

Since I don't know anything about SRC, what would it be to add the mapname as well?

for return mapname just add this line

mapreg_setregstr(add_str("$@mobdead_m$"+0), map[md->bl.m].name);

variable $@mobdead_m$ will save last mob dead map

@hakuren

U R welcome , glad to help :)

  • Love 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...