Jump to content
  • 0

Question

Posted

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?

2 answers to this question

Recommended Posts

Posted

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.

Posted (edited)

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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...