Informations
Jump to content

Lorem Ipsum...

Click to Dismiss this Notification
Ładowanie danych...

Recommended Posts

In this guide, I’ll delve into one of the most prevalent issues encountered when utilizing server timers within dungeons and how to effectively address them.

Understanding Timers: Normal vs. Server Timers

Normal Timers:

  • Closely linked to character pointers.
  • Execution ceases if the associated character logs out.
  • Implicitly dependent on the character being present in the game.

Server Timers:

  • Function independently of character pointers.
  • Continue their operations even if the character that initiated them logs out.
  • Provide robust timing capabilities essential for persistent gameplay.

Why Use Server Timers?

You might wonder about the necessity of implementing server timers when normal timers are available. Here are a couple of compelling reasons:

  1. Party Management: In multiplayer scenarios, if a party member with a normal timer logs out, it can disrupt gameplay, causing the dungeon instance to freeze. Server timers help prevent this disruption.
  2. Dungeon Continuity: As players frequently enter and exit dungeons, normal timers reset when a player logs out, jeopardizing progress. Server timers maintain consistent functionality.

Why Do Crashes Happen?

The crashes occur due to the fact that server timers operate without character pointers. This can create issues when:

  • Items are being distributed or dropped.
  • Specific chat commands are executed.
  • Functions that rely on character pointers are activated.

When the game can't reference a character that no longer exists, it can lead to errors or crashes.

How to Fix Server Timer Crashes

To tackle this issue, I’ve established a straightforward global function that selects the character pointer of a specified Process ID (PID) and returns a boolean indicating whether the selection was successful.

 
// questlua_global.cpp

    
This is the hidden content, please

Next, set the leaderPID flag when a player enters the dungeon for the first time. If it's not a group, it will assign the PID of the player entering:

 
This is the hidden content, please

When invoking the server timer, we first select the leader and confirm the success of that selection:

 
This is the hidden content, please

This approach allows you to safely call any function within the server timer context.

Practical Applications

This technique can be extremely beneficial. For instance, if you want to create a timer that continuously updates player information, I’ve developed a function that gathers each member's PID located in the dungeon:

 
This is the hidden content, please

With this implementation, we can maintain updated information for dungeon members:

 
This is the hidden content, please

By following this guide, you’ll ensure that crashes are minimized and gameplay remains seamless during server timer executions in dungeons. Enjoy your adventures without disruption!

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
Reply to this topic...

×   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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.

spacer.png

Disable AdBlock
The popup will be closed in 5 seconds...