Jump to content

Home

Force Power scripts?


Pikmin

Recommended Posts

I'm writing new force powers that combine existing effects.

 

The first attempts to push enemies and apply the whirlwind effect to simulate the effect of someone squirming while being pushed. I want to make sure my script will work:

#include "k_inc_force"
// Include file of the original Bioware Force Scripts
// We are including this to gain access to a number of very useful functions
// developed by Bioware
// See Notes below

int FORCE_POWER_UNLEASHED_PUSH = 283;
//  This variable must match the Row ID of your power in spells 2da, so change this to match your spells.2da


void main()
{
    /*****************************************/
    /* STEP 1 - DECLARE THE VARIABLES NEEDED */    
    /*****************************************/

    object oTarget = GetSpellTargetObject();    
    // This will set oTarget equal to who you cast the spell at
    // In this case it will be yourself


    SWFP_HARMFUL = TRUE;
    //  The variable SWFP_HARMFUL has already been declared in the include file
    //  It is used by the signal event command to let the target know if this is 
    //  an attack spell or not.


    /****************************************/
    /* STEP 3 - SIGNAL THE SPELL CAST EVENT */
    /****************************************/
    // Signal SpellCast Trigger
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));


    /**********************************/
    /* STEP 4 - DETERMINE THE EFFECTS */
    /**********************************/


    // Build Visual Effects
    //  These are the visual effects that will be played when the spell is cast
    // A listing of all visual effects is in the 2da visualeffects
    ePush1 = EffectForcePushed();
    ePush2 = EffectLinkEffects(ePush1, EffectVisualEffect(VFX_IMP_FORCE_PUSH));
    ePush3 = EffectWhirlWind();
    ePush4 = EffectLinkEffects(ePush3, EffectVisualEffect(VFX_IMP_FORCE_WHIRLWIND));
    effect eDamage = EffectDamage(SWFP_DAMAGE, SWFP_DAMAGE_TYPE);

    }


    /******************************/
    /* STEP 5 - APPLY THE EFFECTS */
    /******************************/


    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FORCE_PUSH), oTarget));
    ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_FORCE_WHIRLWIND), oTarget));
}

 

 

 

The second adds the lightning effect to force wave so that it appears the enemies are pushed away by the lightning:

#include "k_inc_force"
// Include file of the original Bioware Force Scripts
// We are including this to gain access to a number of very useful functions
// developed by Bioware
// See Notes below

int FORCE_POWER_UNLEASHED_LIGHTNING = 282;
//  This variable must match the Row ID of your power in spells 2da, so change this to match your spells.2da


void main()
{


    object oTarget = GetSpellTargetObject();    
    // This will set oTarget equal to who you cast the spell at
    // In this case it will be yourself



    SWFP_HARMFUL = TRUE;
    //  The variable SWFP_HARMFUL has already been declared in the include file
    //  It is used by the signal event command to let the target know if this is 
    //  an attack spell or not.



    // Signal SpellCast Trigger
    SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, GetSpellId(), SWFP_HARMFUL));






    // Build Visual Effects
    //  These are the visual effects that will be played when the spell is cast
    // A listing of all visual effects is in the 2da visualeffects
    effect eWave = EffectVisualEffect(VFX_FNF_FORCE_WAVE);
    effect eLightning = EffectBeam(VFX_BEAM_LIGHTNING_DARK_L, OBJECT_SELF, BODY_NODE_HAND);






    //Apply Visual Effects - they will last 3 seconds
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLightning, 9.0);
    ApplyEffectAtLocation(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_FNF_FORCE_WAVE), GetLocation(OBJECT_SELF));


}

 

 

I would like help to make sure these scripts execute the proper functions. Thankyou.

Link to comment
Share on other sites

So you need to post the source from the script files so we can better assist you with troubleshooting. You're giving us errors for broken scripts and the changes in k_inc_force.nss, but nothing from your actual scripts themselves. All of the errors I'm seeing listed are all related to incorrect syntax usage and not declaring variables before or multiple variable declarations.

Link to comment
Share on other sites

Where is the "void main()" portion of your script? There is alot you are leaving out from your script either to hide what your doing from others in attempt to keep others from stealing the work or because your just cutting and pasting from other scripts without knowing what else needs to be included. If it is the first of those 2 reasons show us everything so we can help you. If it is the second reason and everything you have posted above is the entire script then your missing alot of parts to your script.

Link to comment
Share on other sites

CASE statements must reside within a SWITCH block.

 

In the case of k_inc_force.nss, they reside within

switch (GetSpellId())
{
...
}

You don't need to do any SWITCH / CASE branching in a custom script.

 

It looks like you've tried to excise a section of k_inc_force changed a little and tried to get it to stand on its own. A better approach would be script the new force power from scratch with the k_inc_force as a reference, creating your own constants, "saving throw" subroutines, etc.

 

Alternatively you could create a CASE branch in k_inc_force.nss Sp_RunForcePowers subroutine. You get the advantage of being able to use k_inc_force subroutines and constants, but you have to hardcode the spells.2da row that you end up using for your force power.

Link to comment
Share on other sites

Unleashed push has alot of ePush variables without any declaration of the variables.

 

Such as "ePush1 = EffectForcePushed();" this should be "effect ePush1 = EffectForcePushed();" unless it has been previously declared in another program as a global variable.

 

It would also be good if you showed us what the new error reports are with the scripts since you made your changes.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...