Author Topic: Px lost on death  (Read 326 times)

Legacy_Talon

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +0/-0
Px lost on death
« on: June 24, 2014, 11:19:17 am »


               

I have this script for now:



void main()
{
object oDead = GetLastRespawnButtonPresser();
    int nXP = GetXP(oDead);
    int nPenalty = 50 * GetHitDice(oDead);
    int nHD = GetHitDice(oDead);
    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));
    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));
    ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectResurrection() ,oDead);
    ApplyEffectToObject (DURATION_TYPE_INSTANT, EffectHeal (GetMaxHitPoints(oDead)) , oDead);
    RemoveEffects (oDead);
}

I want add a script on module that player under level 4 lost only 50  px and money on death.


From 5 they lost 50px  per level + 10%mo.


Someone could help me?


Thanks!


 



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Px lost on death
« Reply #1 on: June 24, 2014, 11:52:58 pm »


               

Not that hard to do


 


Instead of:



int nPenalty = 50 * GetHitDice(oDead);

use


 


int nHitDice = GetHitDice(oDead);


if(nHitDice < 5) nHitDice = 1;


int nPenalty = 50 * nHitDice;


 


Instead of



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

use


 


int nGoldToTake = GetGold(oDead) / 10;


if(nHitDice == 1  && nGoldToTake > 50) nGoldToTake = 50;



               
               

               
            

Legacy_Talon

  • Jr. Member
  • **
  • Posts: 93
  • Karma: +0/-0
Px lost on death
« Reply #2 on: June 25, 2014, 08:16:51 am »


               

thanks '<img'>