function return player ID

Tio Akima

New member
Messages
349
Points
0
Age
36
Discord
TioAkima#0636
Github
Tio Akima
Emulator
Hi guys,
in map.c I want to create a basic function
a function that returns the player ID, without parameters
only with return ID from the player.
If anyone knows

Something like this:

int map_get_id() {
    struct map_session_data* sd;

    sd = map->id2sd(?);
    return sd->bl.id;
}


EDIT: It does not have to be exactly in map.c
but must be a function that returns the player ID

Can someone help me?

 
Last edited by a moderator:
You can't just get the player ID (account id) out of thin air, you have to get it from somewhere.

  • If you have a ScriptState (st) you can get it from st->rid
  • if you have a block_list (bl) you can get it from bl->id
  • if you have a map_session_data (sd) you can get it from sd->bl.id
  • if you have a nickname you can get the sd with map->nick2sd(nick) and then get the id with sd->bl.id
 
You can't just get the player ID (account id) out of thin air, you have to get it from somewhere.

  • If you have a ScriptState (st) you can get it from st->rid
  • if you have a block_list (bl) you can get it from bl->id
  • if you have a map_session_data (sd) you can get it from sd->bl.id
  • if you have a nickname you can get the sd with map->nick2sd(nick) and then get the id with sd->bl.id
that is, there is no solution to my problem.

=/

 
if you explain what you are trying to accomplish I could help you find a suitable solution

 
if you explain what you are trying to accomplish I could help you find a suitable solution
In skill.c
I did an area skill. This skill summon a mob.
I sumono a mob and make him walk (I shoot this mob in one direction) with unit-> walktoxy ();

That is, because of the unit-> walktoxy (), this mob will go through the functions:

unit-> walktoxy ();
unit-> walktoxy_sub ();
unit-> walktoxy_timer ();


right?

When this mob dies (or stops walking) I want to call a skill ... skill Lord of Vermilion (WZ_VERMILION)

The function that defines whether the mob has stopped walking is unit-> walktoxy_timer ();

So, I need to call the skill (WZ_VERMILION) inside the function
unit-> walktoxy_timer ();

But for this skill to work, I need the data from the player.

The information that arrives to unit-> walktoxy_timer (); are data from the MOB that walked and stopped ...
The skill (WZ_VERMILION) will only work, if I call it with player data.

This is a way of doing a skillshot ... Throwing the mob in one direction, and when it hits an enemy, an area skill is invoked.
It sounds complicated, but it's a simple logic up to it. @meko
If you can help me, I'll be very grateful. <3

 
Back
Top