Jump to content
  • 0
Tio Akima

function return player ID

Question

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?

Edited by Tio Akima

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites
  • 0
2 hours ago, meko said:

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.

=/

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0
31 minutes ago, meko said:

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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.