View Single Post
Old 09-22-2012, 08:21 PM   #228
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,281
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
Okay, so I'm making a script for KotOR II to work in the onEndRound field for a character. Basically, this would make it so that every time you're in combat, and someone is currently attacking you, then you get a decrease to your attack stats and accuracy (dexterity). But, if you're in combat and no one is attacking you, then you get a bonus to your to your attack stats and accuracy (dexterity). And if you're not in combat, it returns your stats to their normal state. What I would like to know is if this script is actually set up correctly to do that, and if there are any holes in my scripting.

Code:
void main()
{

   object oAttacker = GetGoingToBeAttackedBy(OBJECT_SELF);

   effect eAtkBonusM = EffectAttackIncrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusO = EffectAttackIncrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonus = EffectDamageIncrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonus = EffectAbilityIncrease(ABILITY_DEXTERITY, 2);

   effect eAtkBonusMN = EffectAttackDecrease(3, ATTACK_BONUS_ONHAND);

   effect eAtkBonusON = EffectAttackDecrease(4, ATTACK_BONUS_OFFHAND);

   effect eDamBonusN = EffectDamageDecrease(3, DAMAGE_TYPE_UNIVERSAL);

   effect eDexBonusN = EffectAbilityDecrease(ABILITY_DEXTERITY, 2);

      if( oAttacker == OBJECT_INVALID)
      {

         if( GetIsInCombat(OBJECT_SELF, TRUE)
         {   

            ClearAllEffects();

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusM, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusO, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDamBonus, OBJECT_SELF);

            ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDexBonus, OBJECT_SELF);

         }

      }

      if( oAttacker != OBJECT_INVALID)
      {
         ClearAllEffects();

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusMN, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eAtkBonusON, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDamBonusN, OBJECT_SELF);

         ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDexBonusN, OBJECT_SELF);
      }

      if( !GetIsInCombat(OBJECT_SELF, TRUE)
      {
         ClearAllEffects();
      }

}


The truly fallen cannot return to the light. If someone "falls" and "returns," they never really, truly fell.

Current Work in Progress: Dantooine Tension

Released Works
Blaster Pistol Enhancement
Dustil Restoration
Ebon Hawk Texture Enhancement
Gaffi Stick Improvement
Weapon Model Overhaul Texture Rework (Thanks to Toasty Fresh!)
Sunry Murder Recording Enhancement
VP's Hi Poly Tin Cans - KotOR 1 Version
Fallen Guardian is offline   you may: quote & reply,