Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add *getunittype and update *getmapxy #871

Closed
wants to merge 4 commits into from

Conversation

AnnieRuru
Copy link
Contributor

rathena has this custom stuff
rathena/rathena@2cee5b6
and this makes hercules members jealous
of course, I think hercules should add them as well

however, when I review their code, its SUPER SUCKS
I will tell how bad of their code later, 1 by 1
and I do this very very slowly to ensure nothing goes wrong

so this particular one,
... ok let me laugh 1st ...
their getunittype seems to insert some random value
BUT we will follow using the value from existing getmapxy
of course, CONSTANTS !

this has been tested with

prontera,155,188,5  script  sdkfjshdkfd 1_F_MARIA,{
    skill 238, 1, 0; // alchemist skills
    skill 243, 1, 0;
    skill 244, 1, 0;
    skill 247, 1, 0;
    .@id = monster( "this", -1,-1, "--ja--", PORING, 1, "" );
    getmapxy .@map$, .@x, .@y, 3, .@id;
    dispbottom .@map$ +" "+ .@x +" "+ .@y;
    end;
OnPCDieEvent:
    if ( !killerrid ) end;
    getmapxy .@map$, .@x, .@y, getunittype(killerrid), killerrid;
    dispbottom .@map$ +" "+ .@x +" "+ .@y;
    end;
}
prontera    mapflag pvp

I used homunculus, pets, monsters, etc to kill that player
that player can shows coordinates of the killer object without failure

in this case, their getunitdata that return coordinate is useless
I already coded setmobdata/getmobdata
http://upaste.me/ed6c2196382229bc7
but I still need to finalize the code
when I'm ready, I'll pull request that one

- unlike rathena, hercules' getunittype use the value from getmapxy
- getmapxy now can search object position using GID
@MishimaHaruna MishimaHaruna added the status:inprogress Issue is being worked on / the pull request is still a WIP label Nov 16, 2015
@MishimaHaruna MishimaHaruna added type:enhancement Issue describes an enhancement or feature that should be implemented component:core:scriptengine Affecting the script engine or the script commands labels Nov 18, 2015
@MishimaHaruna MishimaHaruna added codereview:accepted Code review was positive and the pull request can be accepted as is status:code-review Awaiting code review and removed status:inprogress Issue is being worked on / the pull request is still a WIP labels Nov 27, 2015
@AnnieRuru
Copy link
Contributor Author

can merge now ?
I'm writing something that touches map->nick2sd now
if I pull request that now without merging this, will create conflict with that patch later

@Emistry
Copy link
Member

Emistry commented Dec 14, 2015

just curious, does it able to retrieve the coordinate X and Y for dead monster that triggered the event ??

OnKill:
    getmapxy( .@map$,.@x,.@y, getunittype(killerrid), killerrid );
    dispbottom "Die location - "+ .@map$ +" "+ .@x +" "+ .@y;
    end;

@dastgirp
Copy link
Member

If monster is dead, possibly all its info is free'd, so maybe not?

@AnnieRuru
Copy link
Contributor Author

@Emistry
OnPCDieEvent -> killerrid is set to the GID of the monster
https://github.com/HerculesWS/Hercules/blob/master/src/map/pc.c#L7501 <- src->id is GID
OnNPCKillEvent -> killedrid set to the mob_id of the monster
https://github.com/HerculesWS/Hercules/blob/master/src/map/mob.c#L2601 <- md->class is mob_id
monster with event label -> nothing is set
since you know which monster by manipulating event label

yes, dastgir is correct, for that kind of information, have to do it by *mobevent script command
by pushing a custom variable $@mob_x and $@mob_y,
monster with MOBEVENT_DEAD will be another else if condition,
which doesn't trigger with OnNPCKillEvent or having an event label
since monster with event label cannot trace the ID, so have do something like this
... I always say I plan to code *mobevent, by never start yet LOL

well I guess after I finish up setmobdata/getmobdata, *mobevent will be next
but this pull request have to merge 1st !! since they come in parts

@AnnieRuru AnnieRuru closed this in dbe5f22 Dec 18, 2015
@MishimaHaruna MishimaHaruna removed the status:code-review Awaiting code review label Dec 18, 2015
@MishimaHaruna
Copy link
Member

Merged, thank you!

@MishimaHaruna MishimaHaruna removed the codereview:accepted Code review was positive and the pull request can be accepted as is label Dec 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core:scriptengine Affecting the script engine or the script commands type:enhancement Issue describes an enhancement or feature that should be implemented
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants