Jump to content

Home

Offensive Force Power Script Help


Hando

Recommended Posts

I've made a new force power for KOTOR1, and everything works, except the damage. It does no damage when I put in 20. Now, I'm a beginner at scripting, so I cannot see a flaw in my code.

#include "k_inc_force" 

void main() 
{ 
   SWFP_DAMAGE_TYPE = DAMAGE_TYPE_ELECTRICAL; 

   object oSource = OBJECT_SELF; 
   object oTarget = GetSpellTargetObject(); 


   effect eVFX = EffectVisualEffect(3011);
   effect eDamage = EffectDamage(20);
   ApplyEffectToObject(1, eVFX, oTarget, 4.0f);

} 

 

Any help would be greatly appreciated.

Link to comment
Share on other sites

Well, you aren't applying the damage to your opponent. This should work:

 

#include "k_inc_force" 

void main() 
{ 
   SWFP_DAMAGE_TYPE = DAMAGE_TYPE_ELECTRICAL; 

   object oSource = OBJECT_SELF; 
   object oTarget = GetSpellTargetObject(); 


   effect eVFX = EffectVisualEffect(3011);
   effect eDamage = EffectDamage(20);
   ApplyEffectToObject(1, eVFX, oTarget, 4.0f);
   ApplyEffectToObject(0, edamage, oTarget, 4.0f);

} 

 

Hope that helps! :)

Link to comment
Share on other sites

Can I also get the script for a knockdown and stun effect like in force wave?

 

This variant should knock down and stun as well:

 

void main() { 
   object oTarget = GetSpellTargetObject(); 
   effect eVFX    = EffectVisualEffect(VFX_FNF_GRENADE_ION);
   effect eDamage = EffectDamage(20, DAMAGE_TYPE_ELECTRICAL);
   effect ePushy  = EffectForcePushTargeted( GetLocation(oTarget) );

   [color=PaleGreen]// ST: Trigger the SpellCastAt AI event on the victim as offensive power.[/color]
   SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), TRUE));

   [color=PaleGreen]// ST: Check for Force immunity/resistance[/color]
   if(!ResistForce(OBJECT_SELF, oTarget)) {
       [color=PaleGreen]// ST: Show blast and apply the damage[/color]
       ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eVFX, oTarget, 4.0f);
       ApplyEffectToObject(DURATION_TYPE_INSTANT, eDamage, oTarget);

       [color=PaleGreen]// ST: Knock down and stun victim if they fail a Reflex saving throw.[/color]
       if (!ReflexSave(oTarget, GetSpellSaveDC())) {
           ApplyEffectToObject(DURATION_TYPE_TEMPORARY, ePushy, oTarget, 0.1);
           DelayCommand(2.55, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectStunned(), oTarget, 6.0));
       }
   }
   else {
       ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF);
   }
}

Link to comment
Share on other sites

The stun effect is fairly simple. If you want to put it into a script, the function and call should look something like this:


Object oObject = GetFirstPC();
Effect eStun = EffectStunned();

ApplyEffectToObject(1, eStun, oObject, 4.0f);

Please not that this is not a complete script as it is. I think there is an EffectKnockDown, although it may in fact be called EffectPushed. I would recommend searching through nwscript.nss to find the relevant script function, however. :)

 

EDIT: Beaten to it by stoffe!

Link to comment
Share on other sites

Thanks again, guys.

After a bit of trial and error, I managed to get force lightning to come out of both of the PC's hands, and I modified the damage level to be half of the PC's HP.

(Can barley see the lightning with the huge ion explosion.)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...