Author Topic: No penalty?  (Read 320 times)

Legacy_Who said that I

  • Hero Member
  • *****
  • Posts: 931
  • Karma: +0/-0
No penalty?
« on: July 22, 2015, 05:36:05 am »


               

Okay scripts are weird...yup very much so...


 


but here I got a script for my module that makes you go to either heaven or hell depending on alignment....though here is the thing that is troubling me....it does NOT give the character a penalty when the character respawns (So no money and experience loss) I believed I included it but of course always could have inserted it wrong, could someone take a look at it? THANKS! '<img'>


 




#include "nw_i0_generic"

#include "nw_i0_plot"

// * Applies an XP and GP penalty

// * to the player respawning

void ApplyPenalty(object oDead)

{

    int nXP = GetXP(oDead);

    int nPenalty = 50 * GetHitDice(oDead);

    int nHD = GetHitDice(oDead);

    // * You can not lose a level with this respawning

    int nMin = ((nHD * (nHD - 1)) / 2) * 1000;

 

    int nNewXP = nXP - nPenalty;

    if (nNewXP < nMin)

       nNewXP = nMin;

    SetXP(oDead, nNewXP);

    int nGoldToTake =    FloatToInt(0.10 * GetGold(oDead));

    // * a cap of 10 000gp taken from you

    if (nGoldToTake > 10000)

    {

        nGoldToTake = 10000;

    }

    AssignCommand(oDead, TakeGoldFromCreature(nGoldToTake, oDead, TRUE));

    DelayCommand(4.0, FloatingTextStrRefOnCreature(58299, oDead, FALSE));

    DelayCommand(4.8, FloatingTextStrRefOnCreature(58300, oDead, FALSE));

 

}

 

 

void main()

{

object oTargetHeaven = GetWaypointByTag("WP_HEAVEN");

location lTargetHeaven = GetLocation(oTargetHeaven);

object oTargetHell = GetWaypointByTag("WP_HELL");

location lTargetHell = GetLocation(oTargetHell);

object oTargetPurg = GetWaypointByTag("WP_PURG");

location lTargetPurg = GetLocation(oTargetPurg);

effect eRespawnHell = EffectVisualEffect(VFX_FNF_SUMMON_GATE);

effect eRespawnPurg = EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);

effect eRespawnHeaven = EffectVisualEffect(VFX_FNF_SUMMON_CELESTIAL);

object oRespawner = GetLastRespawnButtonPresser();

if (GetGoodEvilValue(oRespawner) <= 29)

{

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnHell, oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);

AssignCommand(oRespawner, JumpToLocation(lTargetHell));

}

else if ((GetGoodEvilValue(oRespawner) >= 30) && (GetGoodEvilValue(oRespawner) <= 70))

{

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnPurg, oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);

AssignCommand(oRespawner, JumpToLocation(lTargetPurg));

}

else if (GetGoodEvilValue(oRespawner) >= 71)

{

ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnHeaven, oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);

AssignCommand(oRespawner, JumpToLocation(lTargetHeaven));

}

}

 

 



 



 



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
No penalty?
« Reply #1 on: July 22, 2015, 05:48:44 am »


               

You have the function to apply the penalty above the void main but you didn't put the line to implement it down in the void main().


 


    ......


    ApplyEffectToObject(DURATION_TYPE_INSTANT, eRespawnHeaven, oRespawner);

    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);

    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);

    AssignCommand(oRespawner, JumpToLocation(lTargetHeaven));

    }

    ApplyPenalty(oRespawner);

}