| Blockland Forums > Modification Help |
| How to add defense. |
| (1/1) |
| Blockhead36001:
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? |
| jes00:
What does BRPG Supposed to stand for? |
| Treynolds416:
You package the projectile collision, and do damage based on a multiplier |
| Slicks555:
I prefer to package damage. Something like this: --- Code: ---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; } }; --- End code --- |
| Blockhead36001:
--- Quote from: jes00 on May 24, 2012, 07:53:49 PM ---What does BRPG Supposed to stand for? --- End quote --- Broze's Role Playing Game. |
| Navigation |
| Message Index |