Announcement to local map only. (MVP reward)

karazu

New member
Messages
1,115
Points
0
- script MVPREWARD -1,{OnNPCKillEvent: if ( !getmonsterinfo( killedrid, MOB_MVPEXP ) ) end; if ( getcharid(1) ) { getpartymember getcharid(1), 1; getpartymember getcharid(1), 2; for ( .@i = 0; .@i < $@partymembercount; .@i++ ) { if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) ) { // what happens if someone in the party member is offline =/ .@partymemberaid[.@c] = $@partymemberaid[.@i]; .@c++; } } getitem 7615, 1, .@partymemberaid[ rand( .@c ) ]; announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } else { getitem 7615, 1; announce "Player ["+ strcharinfo(0) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0; } end;} 
How to change this that it will only announce to the local map? I don't want to this to spam to all map.

 
*mapannounce "<map name>","<text>",<flag>{,<fontColor>{,<fontType>{,<fontSize>{,<fontAlign>{,<fontY>}}}}}};This command will work like 'announce' but will only broadcast to characters currently residing on the specified map. The flag and optional parameters parameters are the same as in 'announce', but target and source flags are ignored.
example:

mapannounce "bat_a01", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00"; 

@edit:

Or use strcharinfo(3)

3 - The name of the map the character is in.

Code:
mapannounce ""+strcharinfo(3)+"", "Group [1] has taken the work shop, and will now respawn there.",bc_map,"0xFFCE00";
 
Last edited by a moderator:
Related to previous kyeme response here's a tip: you can use strcharinfo(3) to get the map name the user is currently in.

Will let you do that and test on your own.

 
announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;the 0 at the back, is actually bc_allits defined in dbconst.txt

you can actually just change it into bc_map

Code:
announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ), bc_map;
 
announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ) +" at "+ strcharinfo(3), 0;the 0 at the back, is actually bc_allits defined in dbconst.txt

you can actually just change it into bc_map

announce "Party ["+ strcharinfo(1) +"] has killed "+ getmonsterinfo( killedrid, MOB_NAME ), bc_map;
I will test this one, Thank you very much.

Thank you also to jabote. 

 
Back
Top