Issue information

Issue ID
#6206
Status
Confirmed
Severity
None
Started
Hercules Elf Bot
Jul 11, 2012 12:02
Last Post
Hercules Elf Bot
Jul 15, 2012 19:37
Confirmation
Yes (1)
No (0)

Hercules Elf Bot - Jul 11, 2012 12:02

Originally posted by [b]Ind[/b]
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

Hercules Elf Bot - Jul 11, 2012 12:09

Originally posted by [b]malufett[/b]
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...

Hercules Elf Bot - Jul 11, 2012 13:27

Originally posted by [b]MarkZD[/b]
Thanks for "reopening" this question.
[url="http://rathena.org/board/tracker/issue-6078-get-position-for-mob-objects-getmapxy/"]http://rathena.org/b...jects-getmapxy/[/url]

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.

[quote name='malufett' timestamp='1342008582' post='11795']
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...
[/quote]
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.

This post has been edited by MarkZD on Jul 11, 2012 13:45

Hercules Elf Bot - Jul 11, 2012 13:33

Originally posted by [b]KeyWorld[/b]
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.

Hercules Elf Bot - Jul 11, 2012 14:23

Originally posted by [b]MarkZD[/b]
[quote name='KeyWorld' timestamp='1342013636' post='11804']
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.
[/quote]

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.

This post has been edited by MarkZD on Jul 11, 2012 14:30

Hercules Elf Bot - Jul 11, 2012 14:27

Originally posted by [b]malufett[/b]
[quote][color=#282828][font=helvetica, arial, sans-serif][size=3]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.[/size][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif][size=3]To fight this "amount", not all monster will need to be returned, just the first found.[/size][/font][/color][/quote]
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?

Hercules Elf Bot - Jul 11, 2012 14:35

Originally posted by [b]KeyWorld[/b]
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.

Hercules Elf Bot - Jul 11, 2012 14:39

Originally posted by [b]MarkZD[/b]
[quote name='malufett' timestamp='1342016835' post='11810']
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?
[/quote]

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.

This post has been edited by MarkZD on Jul 11, 2012 14:51

Hercules Elf Bot - Jul 11, 2012 21:37

Originally posted by [b]GreenBox[/b]
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.

This post has been edited by GreenBox on Jul 11, 2012 21:40

Hercules Elf Bot - Jul 12, 2012 2:26

Originally posted by [b]MarkZD[/b]
[quote name='GreenBox' timestamp='1342042658' post='11831']
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.
[/quote]

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.

This post has been edited by MarkZD on Jul 12, 2012 2:29

Hercules Elf Bot - Jul 12, 2012 3:44

Originally posted by [b]GreenBox[/b]
You don't really want to compare a single cmp x, x with something like this:
[code]
mov eax, 0
loop:
test [edi]
jz end
test [esi]
jz end
cmp [edi], [esi]
jne end
inc edi
inc esi
jmp loop
end:
[/code]
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).

Hercules Elf Bot - Jul 12, 2012 9:06

Originally posted by [b]Kenpachi[/b]
I think this discussion kind of belongs to the same topic: [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]

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

Hercules Elf Bot - Jul 12, 2012 14:17

Originally posted by [b]MarkZD[/b]
[quote name='GreenBox' timestamp='1342064656' post='11840']
You don't really want to compare a single cmp x, x with something like this:[code]mov eax, 0loop:test [edi]jz endtest [esi]jz endcmp [edi], [esi]jne endinc ediinc esijmp loopend:[/code]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).
[/quote]

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:
[CODE]
getmapxy(@mapname$,@mapx,@mapy,1,"Baphomet")
[/CODE]

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

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.

This post has been edited by MarkZD on Jul 12, 2012 15:26

Hercules Elf Bot - Jul 12, 2012 14:27

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

Hercules Elf Bot - Jul 12, 2012 15:11

Originally posted by [b]MarkZD[/b]
[quote name='malufett' timestamp='1342103248' post='11878']
BTW if this already support option#3 or monster support what scenario do you think this will be useful???
[/quote]


[quote name='MarkZD' timestamp='1342016599' post='11809']
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.
[/quote]

This post has been edited by MarkZD on Jul 12, 2012 15:15

Hercules Elf Bot - Jul 12, 2012 15:28

Originally posted by [b]malufett[/b]
@MarkZD
[size=4]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 [background=rgb(247, 247, 247)][font="helvetica, arial, sans-serif"][color="#282828"]getmapxy is exclusively for single/unique object and single variable....[/color][/font][/background][/size]

[color=#282828][font=helvetica, arial, sans-serif][background=rgb(247, 247, 247)] [/background][/font][/color][size=4][background=rgb(247, 247, 247)][font="helvetica, arial, sans-serif"][color="#282828"]so for me drop it and create another command for more appropriate function..... -_-[/color][/font][/background][/size]

Hercules Elf Bot - Jul 13, 2012 13:05

Originally posted by [b]MarkZD[/b]
[quote name='malufett' timestamp='1342106916' post='11887']
[size=4][background=rgb(247, 247, 247)][font=helvetica, arial, sans-serif][color=#282828]so for me drop it and [b]create another command for more appropriate function[/b]..... -_-[/color][/font][/background][/size]
[/quote]
Why didn't you speak it before?
I though you'd just drop and forget it.

Ok. ;D

This post has been edited by MarkZD on Jul 13, 2012 13:06

Hercules Elf Bot - Jul 15, 2012 19:37

Originally posted by [b]Variant[/b]
[quote name='malufett' timestamp='1342103248' post='11878']
BTW if this already support option#3 or monster support what scenario do you think this will be useful???
[/quote]

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.

[quote][color=#282828][font=helvetica, arial, sans-serif][size=3]@MarkZD[/size][/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]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 [background=rgb(247, 247, 247)]getmapxy is exclusively for single/unique object and single variable....[/background][/font][/color]

[color=#282828][font=helvetica, arial, sans-serif][background=rgb(247, 247, 247)]so for me drop it and create another command for more appropriate function..... -_-[/background][/font][/color][/quote]

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...

[CODE]script_pushint(st,mob_once_spawn(sd,m,x,y,str,class_,amount,event)); [/CODE]

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

This post has been edited by Variant on Jul 15, 2012 20:52