Everything is said in the title, and below is an exemple of the ingame desynch.
Description
Details
- Severity
- None
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Modding
Mod DayZPlayerImplement or any child of it, try to override the CanJump method, get ingame with the override loaded client and server side.
modded class DayZPlayerImplement { override bool CanJump() { if (75 > this.GetHealth()) { return false; } return true; } }
The desynch is NOT present if you override with the initial CanJump method content.
The desynch is NOT present if the method returns false.
Event Timeline
Hi,
The video doesn't work anymore and the code around jumping may have changed a little bit but currently this should work when returning true, and shouldn't work when it returns false ( so opposite of your issue? ), because GetHealth() can't be called on the client so it will go something like this:
- the client will not know he can't jump when < 75 health
- attempts it anyway
- becomes corrected by the server which would result in a laggy looking half jump.
It is not working when it returns false.
How is handled the health indicator ? I would like to avoid RPCs everytime a player tries to jump. Can't find anything usefull from workbench. Tried with debug monitor values, but the health returned is always 0.
Object:GetHealthLevel should achieve what you need, with a bit less precision
/** \brief Returns global health level specified in object's config class parameter healthLevels (range is usually 0..4, 0 = pristine, 1 = worn, 2 = damaged, 3 = badly damaged, 4 = ruined but can be changed). @param zoneName if empty string, returns state of global health level */ proto native int GetHealthLevel(string zone = "");
leaving the zone empty or using global should work equally