code testing

Anything server related here.

Moderators: Tandamar, Hellsgrim, Solomon

User avatar
LoneNurgling
Posts: 269
Joined: Mon Jun 29, 2015 7:27 am
Location: MA/USA
Contact:

code testing

Postby LoneNurgling » Thu Aug 17, 2017 8:23 am

Code: Select all

//::///////////////////////////////////////////////
//:: Summon Monster I
//:: NW_S0_Summon1
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Summons a dire badger to fight for the character
*/
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 12 , 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 25, 2001

#include "x2_inc_spellhook"
void main()
{

    /*
      Spellcast Hook Code
      Added 2003-06-23 by GeorgZ
      If you want to make changes to all spells,
      check x2_inc_spellhook.nss to find out more

    */

        if (!X2PreSpellCastCode())
        {
        // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
            return;
        }

    // End of Spell Cast Hook


    //Declare major variables
    int nMetaMagic = GetMetaMagicFeat();
    int nDuration = GetCasterLevel(OBJECT_SELF);
   int GetAlignmentGoodEvil(OBJECT_SELF);
   int GetAlignmentLawChaos(OBJECT_SELF);
   effect eSummon;
//    effect eSummon = EffectSummonCreature("NW_S_badgerdire");


      //add 7-27-17 as true summons by LN
   if((GetAlignmentGoodEvil(ALIGNMENT_GOOD) && (GetAlignmentLawChaos(ALIGNMENT_CHAOS))
       {
       eSummon = EffectSummonCreature("summon_celestialbadger",VFX_FNF_SUMMON_MONSTER_1);
       }
   else if((GetAlignmentGoodEvil(ALIGNMENT_GOOD) && (GetAlignmentLawChaos(ALIGNMENT_LAW))
       {
      eSummon = EffectSummonCreature("summon_celestialdog",VFX_FNF_SUMMON_MONSTER_1);
        }
   if((GetAlignmentGoodEvil(ALIGNMENT_EVIL) && (GetAlignmentLawChaos(ALIGNMENT_CHAOS))
       {
      eSummon = EffectSummonCreature("summon_fiendspidersmall",VFX_FNF_SUMMON_MONSTER_1);      
        }
   if((GetAlignmentGoodEvil(ALIGNMENT_EVIL) && (GetAlignmentLawChaos(ALIGNMENT_LAW))
       {
      eSummon = EffectSummonCreature("summon_fienddirerat",VFX_FNF_SUMMON_MONSTER_1);      
        }
   if(GetAlignmentGoodEvil(ALIGNMENT_GOOD))
       {
      eSummon = EffectSummonCreature("summon_celestialfirebeetle",VFX_FNF_SUMMON_MONSTER_1);      
        }
   if(GetAlignmentGoodEvil(ALIGNMENT_EVIL))
       {
      eSummon = EffectSummonCreature("summon_fiendscorpsmall",VFX_FNF_SUMMON_MONSTER_1);
        }
   if(GetAlignmentLawChaos(ALIGNMENT_LAW))
       {
      eSummon = EffectSummonCreature("summon_snowleopard",VFX_FNF_SUMMON_MONSTER_1);
        }
   if(GetAlignmentLawChaos(ALIGNMENT_CHAOS))
       {
      eSummon = EffectSummonCreature("summon_monsterviper",VFX_FNF_SUMMON_MONSTER_1);
        }
      //end of ln update      
    if(GetHasFeat(FEAT_ANIMAL_DOMAIN_POWER))
    {
        eSummon = EffectSummonCreature("NW_S_BOARDIRE");
    }
      
//    effect eVis = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_1);
    //Make metamagic check for extend
    if (nMetaMagic == METAMAGIC_EXTEND)
    {
        nDuration = nDuration *2;   //Duration is +100%
    }
    //Apply the VFX impact and summon effect
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eVis, GetSpellTargetLocation());
    ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, GetSpellTargetLocation(), TurnsToSeconds(nDuration));
}
User avatar
Clangeddin
Posts: 29
Joined: Tue Aug 04, 2015 7:19 pm

Re: code testing

Postby Clangeddin » Thu Aug 17, 2017 9:01 am

Try with the following code, it should fixes all the issues:

Code: Select all

//::///////////////////////////////////////////////
//:: Summon Monster I
//:: NW_S0_Summon1
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/* Summons a creature based on alignment to fight for the character */
//:://////////////////////////////////////////////
//:: Created By: Preston Watamaniuk
//:: Created On: April 12 , 2001
//:://////////////////////////////////////////////
//:: VFX Pass By: Preston W, On: June 25, 2001
//:: Edited by Clangeddin, 2017

#include "x2_inc_spellhook"

void main()
{
   // If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
   if (!X2PreSpellCastCode()) return;

    //Declare major variables
   object oPC = OBJECT_SELF;
   int nMETA = GetMetaMagicFeat();
   int nLVL = GetCasterLevel(oPC);
   int nALIGN = (GetAlignmentLawChaos(oPC) * 10) + GetAlignmentGoodEvil(oPC);
   float fDUR = TurnsToSeconds(nLVL);
   if (nMETA == METAMAGIC_EXTEND) fDUR = fDUR * 2.0;
   string sSUMMON;
   switch (nALIGN)
   {
      case 24: sSUMMON = "summon_celestialdog";          break; //Lawful Good
      case 21: sSUMMON = "summon_snowleopard";          break; //Lawful Neutral
      case 25: sSUMMON = "summon_fienddirerat";          break; //Lawful Evil
      case 14: sSUMMON = "summon_celestialfirebeetle";    break; //Neutral Good
      case 11: sSUMMON = "NW_S_badgerdire";             break; //Neutral Neutral
      case 15: sSUMMON = "summon_fiendscorpsmall";       break; //Neutral Evil
      case 34: sSUMMON = "summon_celestialbadger";       break; //Chaotic Good
      case 31: sSUMMON = "summon_monsterviper";          break; //Chaotic Neutral
      case 35: sSUMMON = "summon_fiendspidersmall";       break; //Chaotic Evil
      default: sSUMMON = "NW_S_badgerdire";             //In case something went wrong
   }
   if (GetHasFeat(FEAT_ANIMAL_DOMAIN_POWER, oPC, TRUE) == TRUE) sSUMMON = "NW_S_BOARDIRE";
   effect eSUMMON = EffectSummonCreature(sSUMMON, VFX_FNF_SUMMON_MONSTER_1);
        
   //Apply the summon effect
   location lSPELL = GetSpellTargetLocation();
   ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSUMMON, lSPELL, fDUR);
}

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest