Aller au contenu

Photo

No penalty?


  • Veuillez vous connecter pour répondre
1 réponse à ce sujet

#1
Who said that I

Who said that I
  • Members
  • 492 messages

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! :D

 

#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));
}
}
 

 

 

 



#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

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);
}

  • Who said that I aime ceci