View Single Post
Old 09-23-2012, 03:47 PM   #230
Fallen Guardian
Wandering the Galaxy...
 
Fallen Guardian's Avatar
 
Join Date: Aug 2010
Location: Unknown Regions
Posts: 1,286
Current Game: Knights of the Old Republic
Veteran Modder Helpful! 
What are the ways to get around the clear all effects issues?

Also, revised the scripting as per your suggestions, here it is:

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_TEMPORARY, eAtkBonusM, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusO, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamBonus, OBJECT_SELF, 3.0);

            ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDexBonus, OBJECT_SELF, 3.0);

            SetLocalBoolean(OBJECT_SELF, 60, TRUE);

            SetLocalBoolean(OBJECT_SELF, 61, FALSE);

         }

      }

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

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusMN, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eAtkBonusON, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDamBonusN, OBJECT_SELF, 3.0);

         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDexBonusN, OBJECT_SELF, 3.0);

         SetLocalBoolean(OBJECT_SELF, 60, FALSE);

         SetLocalBoolean(OBJECT_SELF, 61, TRUE);
      }

}
And to remove all effects after combat, I put this into the heartbeat script:

Code:
void main()
{

   if( !GetIsInCombat(OBJECT_SELF, TRUE)
   {

      if( GetLocalBoolean(OBJECT_SELF, 60, TRUE) || GetLocalBoolean(OBJECT_SELF, 61, TRUE)
      {
         ClearAllEffects();

         SetLocalBoolean(OBJECT_SELF, 60, FALSE);

         SetLocalBoolean(OBJECT_SELF, 61, FALSE);
      }
   }
}


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,