Jump to content
  • 0

Out of combat flag?


michaelsoftman

Question


  • Group:  Members
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  410
  • Reputation:   29
  • Joined:  04/04/12
  • Last Seen:  

I was wondering if there's a way to determine if a player is not in combat.

I had an idea where, if a player was out of combat for 20 seconds, they would be fully healed. But this would require 2 checks:

No mobs could have hit them (even counts a miss, since they'd still be in combat)

No mobs must be chasing them.

Is this possible?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

An interesting and useful check. I can imagine using this myself for something different, but just as cool.

Although I don't know where it is in the source, a good place to put the check would be in the same check that doesn't let you disconnect unless you don't get attacked or attack for 10 seconds.

Could be simple I think? I'm not perfectly sure, though.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.00
  • Content Count:  326
  • Reputation:   19
  • Joined:  09/27/12
  • Last Seen:  

EDIT: There is actually something I would need this for soon, actually, that I discovered; making consensus on this modification more urgent for me. Essentially, I need to check if a player is in combat and prevent them from using certain items until they are not in combat.

Anyone have any ideas?

UPDATE:

I found this in clif.c


void clif_parse_QuitGame(int fd, struct map_session_data *sd)
{
/* Rovert's prevent logout option fixed [Valaris] */
if( !sd->sc.data[sC_CLOAKING] && !sd->sc.data[sC_HIDING] && !sd->sc.data[sC_CHASEWALK] && !sd->sc.data[sC_CLOAKINGEXCEED] &&
(!battle_config.prevent_logout || DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout) )
{
set_eof(fd);
clif_disconnect_ack(sd, 0);
} else {
clif_disconnect_ack(sd, 1);
}
}

Based off my original theory... I'm assuming something in there is checking if combat was more recent (or maybe I'm in the wrong function); but I am not experienced enough with the source code yet and don't want to make an assumption.

Edited by Vach
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...