Author Topic: Fall Damage Resistance  (Read 1133 times)

This is the code that I tried and that didn't work:
Code: [Select]
package SpiderMan
{
function PlayerSpiderMan::damage(%this, %obj, %sourceObject, %position, %damage, %damageType)
{
if(%damageType $= "$DamageType::Fall" || %damageType $= "$DamageType::Impact")
{
%damage = 0;
parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
else
{
parent::damage(%this, %obj, %sourceObject, %position, %damage, %damageType);
}
}
};
activatepackage(SpiderMan);

I'm not into playertypes or anything for that matter but are damageTypes supposed to be strings? Try removing the "'s

I'm not into playertypes or anything for that matter but are damageTypes supposed to be strings?
Um... I think so. Might want to look into that.

Try changing this
Code: [Select]
%damageType $= "$DamageType::Fall" || %damageType $= "$DamageType::Impact"
to this

Code: [Select]
%damageType == $DamageType::Fall || %damageType == $DamageType::Impact
« Last Edit: February 27, 2015, 07:38:02 PM by Pie Crust »

Also you could replace the inside of the if statement with a return, since you don't actually need to damage the player. In fact, since you're doing this for a playertype, you could just add minImpactSpeed = 250; to your datablock.

In fact, since you're doing this for a playertype, you could just add minImpactSpeed = 250; to your datablock.
What does the variable mean?

What does the variable mean?
Engine variable that determines how fast you have to hit something to cause the camera to shake and trigger the onImpact callback, which is where fall damage is applied. The speed limit for players is 200, so setting it to 250 basically makes you immune.

And if you hit something at 251 such as jet+crouch+jump into a wall? It would make the callback.

Engine variable that determines how fast you have to hit something to cause the camera to shake and trigger the onImpact callback, which is where fall damage is applied. The speed limit for players is 200, so setting it to 250 basically makes you immune.
Ok thanks.
And if you hit something at 251 such as jet+crouch+jump into a wall? It would make the callback.
Quick solution: set it to 1000.

Set it to 255 in case its an 8-bit unsigned int.

You're missing the part where
The speed limit for players is 200

You're missing the part where
Oh LoL. But could a player be going much faster in a vehicle and then accidentaly (Or otherwise) jump out?

I think you're greatly understanding just how fast 200 is
The jeep's speed is like 30

I think you're greatly understanding just how fast 200 is
The jeep's speed is like 30
:D

Is the number actually based on something or is it something that the engine creator(s) punched into the code?