View Issue Details

IDProjectCategoryView StatusLast Update
0005815New Feature Requests[All Projects] Generalpublic2017-06-18 20:56
ReporterMaddDogg14Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
Status newResolutionopen 
Summary0005815: [Request] onPlayerHealthChange/onClientPlayerHealthChange
Description

I would like to see a new event server- and client-side, which gets called, whenever the health of a player is changed.

I'm requesting this, because I'm currently working on a health system, which for example deactivates the sprint control for the player, when he dropped down to a certain level of health.
But now to get the control activated again, as soon as the player is healed, I would either have to constantly check, if the health has changed or I would have to write my own function to set a player's health, but then I wouldn't be able to use setElementHealth on players anymore without running into problems.
The code to deactivate the sprint key and some other stuff is currently done at onClientPlayerDamage.
But here is another problem: When I manually "damage" the player (e.g. car crash -> setElementHealth), this function is not called, since setElementHealth doesn't trigger the mentioned event.

The event should always be triggered, when setElementHealth is used on a player. Maybe this idea could also be extended to also work with any element type (e.g. a vehicle).

Thanks.

TagsNo tags attached.

Activities

GhOsT[X]

2011-01-18 21:02

viewer   ~~0012614

What about checking health changes in Render? Doesn't solves your problems? By using this you can create your own event. (Clientside).

For serverside, there is just a option. Timer's. But clientside isn't enough?.

I support this in parts.

Zango

2011-01-18 21:13

viewer   ~~0012617

GhOsT the point of a feature is to ask for things :P there are a lots of requested events which can be accomplished via scripting, but it's rather "dirty"

I never thought about this one, I always used on(Client)PlayerDamages' loss parameter, but as you said that doesn't work with setElementHealth (although fixVehicle triggers onVehicleDamage with positive parameter as loss (bug though))

If anything I believe it should be onElementHealthChange or similar, triggering for players and vehicles

qaisjp

2014-12-27 20:56

administrator   ~~0022736

Just catch events that naturally "heal" the player (onPlayerSpawn) and control your use of setElementHealth. This can be implemented in Lua. I don't think any change is needed.

lopezloo

2015-01-01 11:56

developer   ~~0022770

Last edited: 2015-01-01 11:57

View 3 revisions

If you don't want use triggers, onRender or timers you can also toggle sprint off and bind own function to sprint key which activate sprint whenever you want (setControlState).

Issue History

Date Modified Username Field Change