Jump to content

  •  

Bug Tracker Migration

June 3rd
Good news everyone! The staff has decided that it is time to slowly kill off this Bug Tracker. We will begin the process of slowly migrating from this Bug Tracker over to our Github Issues which can be found here: https://github.com/HerculesWS/Hercules/issues

Over the next couple of days, I will be closing off any opportunity to create new reports. However, I still will keep the opportunity to reply to existing Bug Reports. Doing this will allow us to slowly fix any bug reports we have listed here so that we can easily migrate over to our Issue Tracker.

Update - June 7th 2015: Creating new bug posts has been disabled. Please use our https://github.com/HerculesWS/Hercules/issues tracker to post bugs. Users are still able to reply to existing bug posts.

- Administration

Issue Information

  • #006206

  • 0 - None Assigned

  • Confirmed

Issue Confirmations

  • Yes (1)No (0)
Photo

getmapxy mob support

Posted by Hercules Bot on 11 July 2012 - 12:02 PM

Originally posted by Ind
you see its not like we have mobs attached to the player nor to the script, anyone have any usable ideas for this behavior? otherwise we shall drop the option #3

Originally posted by malufett
IMO we should drop it since the mobs are quite broad in terms of getting unique map id not like other options where it was attached to a player...

Originally posted by MarkZD
Thanks for "reopening" this question.
http://rathena.org/b...jects-getmapxy/

We can let the argument be the monster ID or name, but people will need the good sense to just pass an unique map named monster, because there's a lot of porings.
To fight this "amount", not all monster will need to be returned, just the first found.

IMO we should drop it since the mobs are quite broad in terms of getting unique map id not like other options where it was attached to a player...

I think it'll be usefull, usually people will not use this option to track every poring in the map, but just a special monster as event or mvp.

Edited by MarkZD, 11 July 2012 - 01:45 PM.


Originally posted by KeyWorld
I think we can let it run with OnTouchNPC ? (and forget the used of the last parameter).
It's already possible with OnTouchNPC to warp the current mob attached to the script by using the RID "0" (no idea why the dev who code this don't do the same with other unit* (unitkill, unitwalk, unitattack, unitstop, unittalk, unitemote) commands.

Originally posted by MarkZD

I think we can let it run with OnTouchNPC ? (and forget the used of the last parameter).It's already possible with OnTouchNPC to warp the current mob attached to the script by using the RID "0" (no idea why the dev who code this don't do the same with other unit* (unitkill, unitwalk, unitattack, unitstop, unittalk, unitemote) commands.


getmapxy is flexible, OnTouchNPC must be defined.

OnTouchNPC will bring overhead in case:
You want a player to be warped to where MVP is or you want to tell a player where MVP is by some script custom.
If you OnTouch the whole map to know where MVP is in case it moved out from borning center(which will usually happen), you'll have the OnTouch script beeing executed 50 times per second, because there're other monster in that map, not just the MVP.

Also, you'd need to to put a lot of copies from the OnTouchNPC, it's a bad idea and it's not the way it was projected to.

getmapxy and OnTouch performs different, and getmapxy monster should be preserved.
Otherwise, let's start using OnTouch to know where players and other things are.

Also, we could even know if a monster is alive with this command.

Edited by MarkZD, 11 July 2012 - 02:30 PM.


Originally posted by malufett

We can let the argument be the monster ID or name, but people will need the good sense to just pass an unique map named monster, because there's a lot of porings.
To fight this "amount", not all monster will need to be returned, just the first found.

hmm..so if we add an arg that will pass the mobid then how can we obtain the id?? and when we will search for a mob then where do it start? or what map? random?

Originally posted by KeyWorld
One  of the way is to return monster's rid when using monster(), but it will be the same than an old mod removed a long time ago from the emulator.

Originally posted by MarkZD

hmm..so if we add an arg that will pass the mobid then how can we obtain the id?? and when we will search for a mob then where do it start? or what map? random?


When you right click on a monster as an admin and click in kill, I think it's killed by id, otherwise every monster would die(or all die by name? I didn't see it). So this would be the id(monster GID which KeyWorld is talking about).

It will be searched by map just like the other getmapxy(if possible).
I think it can start random, or just by the start because just one monster, in the suggestion I gave, would be returned, so it doesn't matter where to start from.

Edited by MarkZD, 11 July 2012 - 02:51 PM.


Originally posted by GreenBox
The best way is monster() return the mob GID and areamonster() return the first spawned monster GID, then getmapxy will just search the mob_data on the map block list and return it info.

@edit
If I understand someone above suggested a unique name for the mob? This is worse way to add a 'key' to some object, mainly when all objects in the server have a unique ID. The string comparission overhead is just unacceptable.

Originally posted by MarkZD

The best way is monster() return the mob GID and areamonster() return the first spawned monster GID, then getmapxy will just search the mob_data on the map block list and return it info.@editIf I understand someone above suggested a unique name for the mob? This is worse way to add a 'key' to some object, mainly when all objects in the server have a unique ID. The string comparission overhead is just unacceptable.


Every getmapxy are string argument comparison, it's not really a suggestion by anyone here, my suggestion, unlike, is to include GID direct support, not just the name which is the default.
So following the logic that every objects are found by string, setting an unique name on the mob would be a way to find the desired mob but it's just an explation for how it'd work, because if every mob is named poring, what poring do you want? But if you name it poring1, so it'll be found.


Note: strcmp doesn't add so much overhead as it just compare the total bits of each variable, a little different  than when it's case insensitive.

Edited by MarkZD, 12 July 2012 - 02:29 AM.


Originally posted by GreenBox
You don't really want to compare a single cmp x, x with something like this:
mov eax, 0
loop:
test [edi]
jz end
test [esi]
jz end
cmp [edi], [esi]
jne end
inc edi
inc esi
jmp loop
end:
Want .-.?

Btw, forget it as the id2bl uses a RBTree with a int32 hash for strings, so is the same(string comparission over int is still worse).

Originally posted by Kenpachi
I think this discussion kind of belongs to the same topic: http://rathena.org/b...cript-commands/

I still don't understand why the GID commands were partly removed...

Originally posted by MarkZD

You don't really want to compare a single cmp x, x with something like this:

mov eax, 0loop:test [edi]jz endtest [esi]jz endcmp [edi], [esi]jne endinc ediinc esijmp loopend:
Want .-.?Btw, forget it as the id2bl uses a RBTree with a int32 hash for strings, so is the same(string comparission over int is still worse).


I don't know if you understand me and you're serious, because every getmapxy are searched by string.
map_nick2sd performs a strcmp(strnicmp) to search sd(rid) from the object or did you forget it?

Maybe we didn't understand each other, but what is beeing said is that getmapxy would be used like this:
getmapxy(@mapname$,@mapx,@mapy,1,"Baphomet")

and my suggestion is to be, also, used like this(But this is not so important, the first option is enough):
getmapxy(@mapname$,@mapx,@mapy,1,GID)

Although, I don't know why worrying so much about strcmp if it compares 100000+ strings in less than 0,000000 sec on a Pentium 4.

Edited by MarkZD, 12 July 2012 - 03:26 PM.


Originally posted by malufett
BTW if this already support option#3 or monster support what scenario do you think this will be useful???

Originally posted by MarkZD

BTW if this already support option#3 or monster support what scenario do you think this will be useful???



getmapxy is flexible, OnTouchNPC must be defined.
OnTouchNPC will bring overhead in case:
You want a player to be warped to where MVP is or you want to tell a player where MVP is by some script custom.
If you OnTouch the whole map to know where MVP is in case it moved out from borning center(which will usually happen), you'll have the OnTouch script beeing executed 50 times per second, because there're other monster in that map, not just the MVP.Also, you'd need to to put a lot of copies from the OnTouchNPC, it's a bad idea and it's not the way it was projected to.
...
Also, we could even know if a monster is alive with this command.


Edited by MarkZD, 12 July 2012 - 03:15 PM.


Originally posted by malufett
@MarkZD
if it is the case then better to use the function of @whereis[create another script command] then store it in an array then do the thingy over it....since getmapxy is exclusively for single/unique object and single variable....

so for me drop it and create another command for more appropriate function..... -_-

Originally posted by MarkZD

so for me drop it and create another command for more appropriate function..... -_-

Why didn't you speak it before?
I though you'd just drop and forget it.

Ok. ;D

Edited by MarkZD, 13 July 2012 - 01:06 PM.


Originally posted by Variant

BTW if this already support option#3 or monster support what scenario do you think this will be useful???


Who knows, but I'm sure making the command available is the first step to finding its uses. Let people's creativity take care of the rest!

Though I could totally see its uses in instances when you want to do some manipulation during a boss fight.

@MarkZD
if it is the case then better to use the function of @whereis[create another script command] then store it in an array then do the thingy over it....since getmapxy is exclusively for single/unique object and single variable....

so for me drop it and create another command for more appropriate function..... -_-


I know Greenbox and Kenpachi mentioned it, but I didn't see an answer. Why exactly was the GID support removed? And having the monster script command just do a...

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

instead of just spawning the mob could give a GID that could be used for the getmapxy right?

Edited by Variant, 15 July 2012 - 08:52 PM.