Jump to content

Home

Need help with force power script...


mrdefender

Recommended Posts

Ok... I was looking at the k_inc_force script, trying to figgure out how to do 100% damage or 50% if the target saves something for the force crush power...

 

[b]I've Changed This Line:[/b]
SWFP_DAMAGE = Sp_CalcDamage( oTarget, nDice, 10 );

[b]To this:[/b]
SWFP_DAMAGE = GetMaxHitPoints( oTarget );

 

I noticed this part too:

// Half damage.
eDamage = EffectDamage(SWFP_DAMAGE/2, SWFP_DAMAGE_TYPE);

 

From what I think I'm doing, this will get the maximum number of hit points the target has and do that much damage to it... If it does a save, it will do half the ammount of his hitpoints...

 

So if he has 500 hit points, he gets 500 damage or 250 if he does a save...

 

Correct? :giveup:

Link to comment
Share on other sites

Correct. You just need to check for the saves. For instance:

void main() {
   int nResist, nDamage;
   effect eDamage;
   object oTarget;

   oTarget = GetSpellTargetObject();
   nDamage = GetMaxHitPoints(oTarget);
   nResist = /*This is where you get oTarget's saves for whatever save type*/;
   eDamage = EffectDamage(nDamage, /*Damage type*/);

   if(nResist <= /*Save minimum*/) {
       ApplyEffectToObject(0, eDamage, oTarget);
   } else {
       eDamage = EffectDamage(nDamage/2, /*Damage type*/);
       ApplyEffectToObject(0, eDamage, oTarget);
   }
}

Link to comment
Share on other sites

Correct. You just need to check for the saves. For instance:

void main() {
   int nResist, nDamage;
   effect eDamage;
   object oTarget;

   oTarget = GetSpellTargetObject();
   nDamage = GetMaxHitPoints(oTarget);
   nResist = /*This is where you get oTarget's saves for whatever save type*/;
   eDamage = EffectDamage(nDamage, /*Damage type*/);

   if(nResist <= /*Save minimum*/) {
       ApplyEffectToObject(0, eDamage, oTarget);
   } else {
       eDamage = EffectDamage(nDamage/2, /*Damage type*/);
       ApplyEffectToObject(0, eDamage, oTarget);
   }
}

 

Thats the only thing so far I'm having alot of problems with, I don't know how the resist/saves work here... could you give me an example? Is there something like SAVE_ALL or SAVE_WILL or RESIST_WILL or something? :(

 

It's somewhat easier now that I found out k_inc_force has to go in the same dir as nwscomp (or whatever the filename is...)

Link to comment
Share on other sites

I have no idea what an acceptable number would be for a saving throw minimum would be, but you could go about getting the saves for an object's reflex, fortitude, or will with any of the following functions:

// Fortitude...
int nResist = GetFortitudeSavingThrow(oTarget);

// Reflex...
int nResist = GetReflexSavingThrow(oTarget);

// Will...
int nResist = GetWillSavingThrow(oTarget);

// For all of them you'll need a custom function...
int GetAverageSavingThrow(oTarget) {
   float fFort, fRef, fWill;

   fFort = IntToFloat(GetFortitudeSavingThrow(oTarget));
   fRef  = IntToFloat(GetReflexSavingThrow(oTarget));
   fWill = IntToFloat(GetWillSavingThrow(oTarget));

   return FloatToInt((nFort + nRef + nWill)/3);
}

Link to comment
Share on other sites

Thats the only thing so far I'm having alot of problems with, I don't know how the resist/saves work here... could you give me an example? Is there something like SAVE_ALL or SAVE_WILL or RESIST_WILL or something? :(

 

Look at the example I posted in the Force Crush thread, it shows how you can do both to make saving throw check (either SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL), and how you can do to check for Force Resistance and other immunities.

 

If you want your power to allow more than one saving throw of different types, you'll just have to add extra if-statements making extra saving throw checks in whatever order you intend.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...