Author Topic: How to add defense.  (Read 1253 times)

So guys, Uxie and I are starting up BRPG and I'm real excited about it, but we are having problems with a script, how do you make it so when you equip a item it reduces the damage taken to that player by a certain amount?

What does BRPG Supposed to stand for?

You package the projectile collision, and do damage based on a multiplier

I prefer to package damage.

Something like this:

Code: [Select]
package damageDamp {
function Player::Damage(%this, %projectile, %position, %damage, %type)
{
%dd = %this.getDamageDamp();
%damage *= (%dd !$= "" ? %dd : 1);
parent::damage(%this, %projectile, %position, %damage, %type);
}
function Player::getDamageDamp()
{
%calc = 1; //Whatever you need to do to calculate how much damage to
//dampen by. To reduce damage, return a value less than 1. To increase,
//return higher than one. For example, 90% damage is 0.9. Half the damage is 0.5.
return %calc;
}
};
« Last Edit: May 24, 2012, 09:16:03 PM by Slicks555 »

What does BRPG Supposed to stand for?
Broze's Role Playing Game.