Solved Kicking Players after Dungeon Clear.

Status
Not open for further replies.

alfonshal

Member
Registered
Joined
Sep 12, 2024
Messages
30
Solutions
1
Reaction score
4
Points
8
Hello everyone,I have something of a new challenge for me.

I'm trying to force players to leave a dungeon after X amounts of seconds after the dungeon is cleared, in "CInstanceDungeonBase::SetNextState" I can add the "LeaveDungeon()" function but that results in an instant exit.
So my question is, is there a way to add a sleep or timeout without freezing the main thread? I tried adding a while loop but that freezes the main thread so the world server freezes until the while loop finishes.
 
Hello everyone,I have something of a new challenge for me.

I'm trying to force players to leave a dungeon after X amounts of seconds after the dungeon is cleared, in "CInstanceDungeonBase::SetNextState" I can add the "LeaveDungeon()" function but that results in an instant exit.
So my question is, is there a way to add a sleep or timeout without freezing the main thread? I tried adding a while loop but that freezes the main thread so the world server freezes until the while loop finishes.
Hi you can try this :
Hey There!
Please login and(or) register to see this awesome content today.
Not tested and maked with chatgpt
Code Explanation
  • LeaveDungeonAfterDelay: This function uses a timer to call LeaveDungeon() after a specified delay. In this example, the delay is set to 10 seconds (but you can adjust this).
  • AddTimerEvent(): This is a hypothetical function that adds an event to a timing system. Such systems often exist in game engines like FlyFF to avoid blocking the main thread. You would need to verify in FlyFF’s code if such a function exists (or create one if necessary).
  • Lambda expression ([=]()): This captures local variables and passes them to the callback (the delayed execution of LeaveDungeon()).
 
  • Like
Reactions: alfonshal
Status
Not open for further replies.