Jump to content

Home

ForcePushed(); effect not working


moda

Recommended Posts

I am trying to make a power which should push the target some distance away before doing damage, as it stands the push effect is not being applied

pvoid main() {

  object oCaster = OBJECT_SELF;

  if( GetGoodEvilValue( oCaster ) < 51 ) {
     int nForce, nFP, nHP;
     effect costDamage;
     effect push = EffectForcePushed();
     push = EffectLinkEffects( push, EffectVisualEffect( VFX_IMP_FORCE_PUSH ) );
     effect ecaster, eDamage;
     object oTarget = GetSpellTargetObject();
     while( GetIsObjectValid( oTarget ) ) {
        if( !GetIsDead(oTarget) && GetIsEnemy(oTarget) ) {
           nForce = GetCurrentForcePoints( oCaster ) * 2;
           nFP = GetCurrentForcePoints( oTarget ) / 5;
           nHP = GetCurrentHitPoints( oTarget );
           ecaster = EffectHeal( nHP );
           ecaster = EffectLinkEffects( ecaster, EffectDamageForcePoints(20));  
           eDamage = EffectDamageForcePoints( nForce );
           eDamage = EffectLinkEffects( eDamage, EffectDamage( nForce, DAMAGE_TYPE_DARK_SIDE ));
     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, push, oTarget, 0.2); 
           ActionWait(0.3);
           ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oTarget );
           ApplyEffectToObject( DURATION_TYPE_INSTANT, ecaster, oCaster );

           ActionWait(0.5);
           if( GetIsDead( oTarget ) ) {  
              AdjustCreatureAttributes( oCaster, Random(6), 1 );
              AddBonusForcePoints( oCaster, nFP );
           }
           }

  }
}    
}

Link to comment
Share on other sites

yes, i have also tried using DelayCommand(); to make the damage portion fire after the push has finnished but that only causes my game to freeze

 

 

nevermind managed to fix

included below is the source i used incase anyone has trouble with this sort of thing again, and yes by turning an If Statement into its own function i was able to delay it using DelayCommand();

void Getdead (int nFP, object oTarget, object oCaster)
{
           if(GetIsDead(oTarget))
           {  
              AdjustCreatureAttributes( oCaster, Random(6), 1 );
              AddBonusForcePoints( oCaster, nFP );
           }
}

void main() {

  object oCaster = OBJECT_SELF;

  if( GetGoodEvilValue( oCaster ) < 11 ) 
  {
     int nForce, nFP, nHP;
     effect costDamage;
     effect push = EffectForcePushed();
     push = EffectLinkEffects( push, EffectVisualEffect( VFX_IMP_FORCE_PUSH ) );
     effect ecaster, eDamage;
     object oTarget = GetFirstObjectInShape(SHAPE_SPHERE, 25.0, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE );
     while( GetIsObjectValid( oTarget )) 
     {
     if(GetIsEnemy(oTarget))
      {
           nForce = GetCurrentForcePoints( oCaster ) * 4;
           nFP = GetCurrentForcePoints( oTarget ) / 5;
           nHP = GetCurrentHitPoints( oTarget );
           ecaster = EffectHeal( nHP );
           ecaster = EffectLinkEffects( ecaster, EffectDamageForcePoints(20));  
           eDamage = EffectDamageForcePoints( nForce );
           eDamage = EffectLinkEffects( eDamage, EffectDamage( nForce, DAMAGE_TYPE_DARK_SIDE ));
     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, push, oTarget, 0.8); 
           DelayCommand(0.9, ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oTarget ));
           DelayCommand(0.9, ApplyEffectToObject( DURATION_TYPE_INSTANT, ecaster, oCaster ));
           DelayCommand(1.5, Getdead(nFP, oTarget, oCaster));

      }
oTarget = GetNextObjectInShape(SHAPE_SPHERE, 25.0, GetLocation(OBJECT_SELF), FALSE, OBJECT_TYPE_CREATURE );

   }
   }
} 

 

and the single target version

void Getdead (int nFP, object oTarget, object oCaster)
{
           if(GetIsDead(oTarget))
           {  
              AdjustCreatureAttributes( oCaster, Random(6), 1 );
              AddBonusForcePoints( oCaster, nFP );
           }
}

void main() {

  object oCaster = OBJECT_SELF;

  if( GetGoodEvilValue( oCaster ) < 51 ) {
     int nForce, nFP, nHP;
     effect costDamage;
     effect push = EffectForcePushed();
     push = EffectLinkEffects( push, EffectVisualEffect( VFX_IMP_FORCE_PUSH ) );
     effect ecaster, eDamage;
     object oTarget = GetSpellTargetObject();
           nForce = GetCurrentForcePoints( oCaster ) * 2;
           nFP = GetCurrentForcePoints( oTarget ) / 5;
           nHP = GetCurrentHitPoints( oTarget );
           ecaster = EffectHeal( nHP );
           ecaster = EffectLinkEffects( ecaster, EffectDamageForcePoints(20));  
           eDamage = EffectDamageForcePoints( nForce );
           eDamage = EffectLinkEffects( eDamage, EffectDamage( nForce, DAMAGE_TYPE_DARK_SIDE ));
     ApplyEffectToObject(DURATION_TYPE_TEMPORARY, push, oTarget, 0.8); 
           DelayCommand(0.9, ApplyEffectToObject( DURATION_TYPE_INSTANT, eDamage, oTarget ));
           DelayCommand(0.9, ApplyEffectToObject( DURATION_TYPE_INSTANT, ecaster, oCaster ));
           DelayCommand(2.5, Getdead(nFP, oTarget, oCaster));





}    
}
void SP_MyApplyEffectToObject(int nDurationType, effect eEffect, object oTarget, float fDuration=0.0);

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...