| Author: | Craig Vincent |
| Author Email: | 2bunnyhop@rogers.com |
| Author Website: | n/a |
| Script Name: | Useable Training Dummy 2 |
| Description: | Improved version of the script by Shaun Yoder, no longer requires the OnDeath portion of the script. Also now can be modified to determine which damage types will result in experience. Also will notify a player if they don't have enough money for training. |
| Instructions on Use: | Simply create the training object (such as the combat dummy) and add this script to the OnDamaged Event. |
Script 1 (OnDamaged):
| void main() { ////////////////////////////////////////////////////// //Combat Training //by Shaun Yoder //06/26/02 //Updated 07/12/02 by Craig Vincent ('Exp dungeon' social) ////////////////////////////////////////////////////// // Find last person who attacked object, GetLastAttacker would work too object oTrainer = GetLastDamager(); // Determine how much damage was done // This method allows one to discourage use of a particualar damage type for training // by removing the appropriate GetDamageDealthByType function int nDamage = GetDamageDealtByType(DAMAGE_TYPE_FIRE) + GetDamageDealtByType(DAMAGE_TYPE_ACID) + GetDamageDealtByType(DAMAGE_TYPE_COLD) + GetDamageDealtByType(DAMAGE_TYPE_ELECTRICAL) + GetDamageDealtByType(DAMAGE_TYPE_SONIC) + GetDamageDealtByType(DAMAGE_TYPE_NEGATIVE) + GetDamageDealtByType(DAMAGE_TYPE_MAGICAL) + GetDamageDealtByType(DAMAGE_TYPE_DIVINE) + GetDamageDealtByType(DAMAGE_TYPE_BLUDGEONING) + GetDamageDealtByType(DAMAGE_TYPE_SLASHING) + GetDamageDealtByType(DAMAGE_TYPE_PIERCING); // Heal the combat dummy so it doesn't ever get destroyed ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nDamage), OBJECT_SELF, 0.0f); //make sure its a PC doing the damage. if (GetIsPC(oTrainer) == TRUE) { // Checks to make sure player has enough gold to cover the damage // Otherwise they get no experience int nGold = GetGold(oTrainer); // This determines the cost for the attack, currently it is damage / 4 int nGoldTake = nDamage / 4; if (nGold >= nGoldTake) { TakeGoldFromCreature(nGoldTake, oTrainer, TRUE); GiveXPToCreature(oTrainer, nDamage); } else { // Notify player they don't have enough gold ActionSpeakString("You can't afford training", 10); } } } |