SAFE ZONE / PK ZONE MESSAGE DELAY EDIT/FIX (GS)
What it fixes
When you walk into or out of a safe zone (or a PK zone), the "Entering Safe Zone" / "Leave Safe Zone" message, and the protection itself, can show up several seconds late.
Why it happens
The game server (gs) checks "is this player in a safe zone or PK zone?" inside the player heartbeat (gplayer_imp::OnHeartbeat), but only on 1 heartbeat out of 8. It builds a number from the player's ID and the server clock, and only runs the check when the last 3 bits are zero. So each player is checked about once every 8 seconds.
The code looks like this:
8B 45 F4 mov eax, [ebp-0x0C] ; player id/32 + server time
83 E0 07 and eax, 7 ; <-- keeps only "1 in 8"
85 C0 test eax, eax
75 2C jne (skip the check)
... call gplayer_imp::TestSanctuaryNormal() ; safe zone check
... call gplayer_imp::TestPKRegion() ; PK zone check
The fix
Change and eax,7 to and eax,0: one byte, 07 → 00.
The result is then always 0, so both checks run on every heartbeat (about once a second). The check is only a quick "which area am I standing in", so it does not slow the server down.
How to do it
-
Stop the server and make a backup copy of
gs. -
Open
gsin a hex editor (for example HxD). -
Search for this hex string (it appears once):
8B 45 F4 83 E0 07 85 C0 75 2C -
In that match, change the 6th byte
07to00, so it reads:8B 45 F4 83 E0 00 85 C0 75 2CIn the standard ESO gs this byte is at file offset
0x3874B(address0x08080749in memory). Builds can differ, so always confirm with the search in step 3 rather than trusting the offset. -
Save, copy
gsback to the server, runchmod 755 gs, and start the server.
Checking you found the right spot (optional, Linux)
objdump -d -M intel --start-address=0x08080740 --stop-address=0x08080780 gs
You should see and eax,0x7 followed by a call to gplayer_imp::TestSanctuaryNormal before the change, and and eax,0x0 after it.
Test
Walk in and out of any safe zone. The message should now appear within about 1 second.
Notes
- Entering the world, teleporting and changing maps already check straight away. This fix only affects walking across a zone edge.
- To undo, change the byte back from
00to07(or restore your backup).