Jump to content

Home

FP Cost Per Target Hit


Kl0kw3rk

Recommended Posts

For my Force Power mod I'm trying to change the aoe powers to use FP per target hit rather than the flat array value. To do this I need to get an alignment modified FP in the sp1_force_inc. Is there a known way to do this? I could do it with just the alignment value.

Link to comment
Share on other sites

In my script I have it correctly charging the cost of Storm via self-inflicted eForce damage for each additional target after the first. Now I need a way to check the caster's FP pool to break if it runs out. Anyone know a variable that holds that?

Link to comment
Share on other sites

GetCurrentForcePoints(GetFirstPC()) will return the PC's current force points.

 

So something like:

 

Show spoiler
(hidden content - requires Javascript to show)
if(GetCurrentForcePoints(GetFirstPC()) <= 25){

(damage force points code)

}

 

I'm assuming the cost is 25 FP for each enemy, but you might have chosen a different number.

Link to comment
Share on other sites

The final solution as applied to Storm:

 

Show spoiler
(hidden content - requires Javascript to show)
        /*
       FORCE STORM
       */
       case FORCE_POWER_FORCE_STORM:
       {
           SWFP_HARMFUL = TRUE;
           SWFP_PRIVATE_SAVE_TYPE = SAVING_THROW_WILL;
           int nDamage = GetHitDice(OBJECT_SELF);
           //if(nDamage > 10) -Unlimited level scaling. -Caley M
           //{
           //    nDamage = 10;
           //}
           SWFP_DAMAGE = d6(nDamage);
           SWFP_DAMAGE_TYPE = DAMAGE_TYPE_ELECTRICAL;
           effect eBeam = EffectBeam(2061, OBJECT_SELF, BODY_NODE_HEAD);
           effect eVis = EffectVisualEffect(VFX_PRO_LIGHTNING_L);
           effect eForce;
           effect eDam;
           int SkipFirst = 0; // -Caley M
           object oUse = GetFirstObjectInShape(SHAPE_SPHERE, 48.0, GetLocation(oTarget), FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE);
           while(GetIsObjectValid(oUse))
           {
               //Make Immunity Checks
               if(GetIsEnemy(oUse))
               {
                   SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));
                   if(GetCurrentForcePoints(GetFirstPC()) < 20 && SkipFirst > 0){ break; } // Check whether sufficient force points remaining to hit next target. -Caley M
                   if(!ResistForce(OBJECT_SELF, oUse))
                   {
                       ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oUse);
                       ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oUse, fLightningDuration);
                       if(!WillSave(oUse, Sp_GetJediDCSave()))
                       {
                           eDam = EffectDamage(SWFP_DAMAGE, SWFP_DAMAGE_TYPE);
                           eForce = EffectDamageForcePoints(SWFP_DAMAGE);
                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oUse);
                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, oUse);
                           if(SkipFirst++ > 0) // Check whether past first hit, then subtract force points from caster . -Caley M
                           {
                               eForce = EffectDamageForcePoints(20);
                               ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, OBJECT_SELF);
                           }
                       }
                       else
                       {
                           eDam = EffectDamage(SWFP_DAMAGE/2, SWFP_DAMAGE_TYPE);
                           eForce = EffectDamageForcePoints(SWFP_DAMAGE/2);
                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oUse);
                           ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, oUse);
                           if(SkipFirst++ > 0) // Check whether past first hit, then subtract force points from caster. -Caley M
                           {
                               eForce = EffectDamageForcePoints(20);
                               ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, OBJECT_SELF);
                           }
                       }
                   }
                   else
                   {
                       ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectForceFizzle(), OBJECT_SELF);
                   }
               }
               oUse = GetNextObjectInShape(SHAPE_SPHERE, 12.0, GetLocation(oTarget), FALSE, OBJECT_TYPE_CREATURE | OBJECT_TYPE_PLACEABLE);
           }
       }
       break;

 

The compiler apparently does not recognize smaller variables than "int".

Link to comment
Share on other sites

I made a few tweaks to the above. Heal was a bit more work.

Show spoiler
(hidden content - requires Javascript to show)
       /*
       HEAL
       */
       case FORCE_POWER_HEAL:
       {
           SWFP_HARMFUL = FALSE;
           int SkipFirst = 0; // -Caley M
           effect eForce; // -Caley M
           int nHeal = GetAbilityModifier(ABILITY_WISDOM) + GetAbilityModifier(ABILITY_CHARISMA) + GetHitDice(OBJECT_SELF);
           effect eVis =  EffectVisualEffect(VFX_IMP_HEAL);
           int nCnt = 0;
           object oParty;
           if(IsObjectPartyMember(OBJECT_SELF))
           {
               oParty = GetPartyMemberByIndex(nCnt);
           }
           else
           {
               oParty = OBJECT_SELF;
           }
           while(nCnt < 3)
           {
               if(oParty == OBJECT_SELF && GetCurrentHitPoints(OBJECT_SELF) == GetMaxHitPoints(OBJECT_SELF)) // Check whether refund needed for initial cost. -Caley M
               {
                   eForce = EffectDamageForcePoints(-20);
                   ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, OBJECT_SELF);
               }
               if(GetCurrentForcePoints(OBJECT_SELF) < 20 && SkipFirst > 0){ break; } // Check whether sufficient force points remaining to hit next target. -Caley M
               if(GetIsObjectValid(oParty) &&
                  GetRacialType(oParty) != RACIAL_TYPE_DROID &&
                  GetDistanceBetween(OBJECT_SELF, oParty) < 24.0)
               {
                   SignalEvent(oParty, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));
                   Sp_RemoveSpecificEffect(EFFECT_TYPE_POISON, oParty);
                   Sp_RemoveSpecificEffect(EFFECT_TYPE_STUNNED, oParty);
                   Sp_RemoveSpecificEffect(EFFECT_TYPE_PARALYZE, oParty);
                   Sp_RemoveSpecificEffect(EFFECT_TYPE_FRIGHTENED, oParty);
                   ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oParty);
                   ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(nHeal), oParty);
                   if((SkipFirst++ > 0) && GetCurrentHitPoints(oParty) < GetMaxHitPoints(oParty) && (GetCurrentHitPoints(oParty) > 0)) // Check whether past first hit and target needs vitality and not dead, then subtract force points from caster . -Caley M
                   {
                       eForce = EffectDamageForcePoints(20);
                       ApplyEffectToObject(DURATION_TYPE_INSTANT, eForce, OBJECT_SELF);
                   }
               }
               nCnt++;
               if(IsObjectPartyMember(OBJECT_SELF))
               {
                  oParty = GetPartyMemberByIndex(nCnt);
               }
               else
               {
                  oParty = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_FRIEND, OBJECT_SELF, nCnt, CREATURE_TYPE_RACIAL_TYPE, RACIAL_TYPE_HUMAN);
               }
           }
       }
       break;

 

-Initial FP cost is refunded if caster is uninjured.

-Dead PCs incur no FP cost.

- I still have to factor in the effect removals.

Link to comment
Share on other sites

For adding or removing effects, as in Insanity, I'm still looking for a function that gets the effects on a target. Otherwise retrying to get everything in a mob will be rather costly and cures will have to be free.

--------

I've been trying to change the buff powers into toggles. I tested this:

effect eDamage = EffectDamageForcePoints(-10);
...
SP_InterativeDamage(eDamage, 9999, oTarget);

 

That should start a noticeable drain/gain of 10 FP per second. I can't figure why that would not work. OBJECT_SELF as the object argument also did not work.

Link to comment
Share on other sites

I'm finding the functions to check things in nwscript, though for my own game I decided to remove the alignment modifier because it breaks RP having to choose dialogs just to get cheaper powers. Horror/Insanity are giving me a hard time. I just need to get those working for the release.

 

For the non-vanilla version I'm thinking of making the normally useless Int attribute a factor in some powers. So, genius toons would be more viable with hardcore mods.

Link to comment
Share on other sites

Did you figure out how to Remove Specific Effects? This is a common head-scratcher, which was "fixed" for TSL by indexing the effects. Alas, K1 lacks this, so it has to be done by looping. nw_io_lightningbolt.nss contains an example of this; you can also find a thread here in HL I made on the subject a couple years ago.

 

Glad to see things are working forward for you! Considering your successes thus far, this post is probably TLTL :p

Link to comment
Share on other sites

I haven't seen how TSL does it yet. The Sp_RemoveSpecificEffect function does it in K1. What is wonky is that it uses a loop to cycle every effect and check whether it is x. You would think there would just be a flag for each effect. Silly programmers. What I needed was just to check whether the effect was there to verify the need to charge FP. Thankfully that function is actually in k_inc_force. So, I can either copy that function and change it a bit or maybe add flags to the effect application part. We'll see.

Link to comment
Share on other sites

It will be virtually irrelevant until some AI work anyway.

 

I was going to add a Force Body for K1 and then changed my mind because it is essentially a heal cheat.

 

I'm messing around with scaling of various aspects of powers by Int, Wis and Cha attributes. I'm using Int to alter strength/duration of powers. It's just a question of which attributes should go into DC and which should go into strength. The easiest is using Int for strength and leaving DC as is. That said, I use no clothing items with stats when I play. The house rules of the user make a big difference.

 

For the toggled buff idea I found that "SP_InterativeDamage" only works on enemies due to a GetIsEnemy condition.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...