Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Corpse health is unreadable (api problem)

Here you can find ScriptAPI suggestions implemented in the game.
Forum rules
By using the forum you agree to the following rules.
Locked
User avatar
Danger Ross
Superfighter
Superfighter
Posts: 154
Joined: Thu Mar 31, 2016 12:56 am
Title: Dangerous
SFD Alias: Danger Ross
Started SFD: 14 june 2012 (launch day)
Location: California
Gender:
Age: 23

Corpse health is unreadable (api problem)

Post by Danger Ross » Fri Mar 27, 2020 7:52 am

My memory is hazy but I believe IObject.GetHealth() used to return the corpse object's health after the player dies. At this moment, IObject.GetHealth() only returns the player's PlayerModifier.CurrentHealth property, so if the player is dead it always returns zero.
IObject.SetHealth() has no effect on corpse objects either.

This makes it impossible to interact with the health of a corpse object as a result.

If this is by design then take it as a suggestion to add the functionality necessary to be able to interact with corpse objects.
1 x
sorry bucko, you can't punch with swords 8-)

User avatar
Gurt
Lead Programmer
Lead Programmer
Posts: 1884
Joined: Sun Feb 28, 2016 3:22 pm
Title: Lead programmer
Started SFD: Made it!
Location: Sweden
Gender:
Age: 34

Post by Gurt » Fri Mar 27, 2020 7:04 pm

You can't revive dead players and dead players should return 0 health.
The GetHealth and SetHealth is IObject interfaces and the IPlayer overrides these as you're not allowed to set health directly however you want if the player is dead. The proper way to "revive" a player is to create a new IPlayer instance with the same skin.

Adding IPlayer.GetCorpseHealth(), SetCorpseHealth(float value), GetCorpseMaxHealth() to the next update (after v.1.3.5).
Gets/Sets the player's corpse health. This health starts counting once the player is dead.
Once this reaches 0 and the player takes additional damage, the player will be gibbed.
1 x
Gurt

Locked