michaelsoftman Posted November 27, 2012 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Share Posted November 27, 2012 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? Quote Link to comment Share on other sites More sharing options...
Vach Posted November 28, 2012 Group: Members Topic Count: 21 Topics Per Day: 0.00 Content Count: 326 Reputation: 19 Joined: 09/27/12 Last Seen: February 27, 2021 Share Posted November 28, 2012 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. Quote Link to comment Share on other sites More sharing options...
Vach Posted November 30, 2012 Group: Members Topic Count: 21 Topics Per Day: 0.00 Content Count: 326 Reputation: 19 Joined: 09/27/12 Last Seen: February 27, 2021 Share Posted November 30, 2012 (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 December 2, 2012 by Vach Quote Link to comment Share on other sites More sharing options...
Question
michaelsoftman
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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.