Author Topic: Editing fall damage when crouching?  (Read 1000 times)

So, like the title says, I want to edit ammount of damage player gets when he crouches. How do I do that?
Example: Player falls, dies from lethal damage. Player falls from the same height, but when crouching, he has 25 or less HP left after impact. I want to edit that so he gets left with 75 damage or something.

Package the damage function and check if the damage type is fall impact.
If it is, check if the player is crouching

seeing as you haven't responded, I decided to go a bit more in depth.
Code: [Select]
package Rololol
{
function Armor::onTrigger(%datablock,%player,%slot,%val)
{
Parent::onTrigger(%datablock,%player,%slot,%val);
if(%slot == 3) //Here we check if a player is crouching and return a value if he is.
%player.isCrouching = %val; //Here we modify the value depending on if they are crouching. 1 for yes, 0 for no.
announce(%player.isCrouching);
}
function player::damage(%obj, %sourceObject, %position, %damage, %damageType)
{
if($DamageType_Array[%damageType] $= "Fall" && %obj.isCrouching == 1) //We check here if the damage they are recieving is from falling, and if they are crouching.
%damage = %damage*(%value/100); //Here we reduce damage if both of the above are true. This converts numbers into percents, incase I want a player to recieve only 75% of the damage.
parent::damage(%obj, %sourceObject, %position, %damage, %damageType);
}

};
activatePackage(Rololol);

I would've gotten away with it if it weren't for you meddling kids!


Code: [Select]
code
Thanks for the code, although I really only needed a small hint on what to do like you did in first post.
I didn't respond because I was a lil' busy with scripting :V

I would've gotten away with it if it weren't for you meddling kids!
Your funny sometimes Kalphiter :)