My script doesn't work as it should (RESOLVED)

Hi all,

The script I made from the script wizard doesn’t take the xps I ask it to take from the PC. Can someone tell me why?

//:: FileName at_516
//:://////////////////////////////////////////////
//:://////////////////////////////////////////////
//:: Created By: Script Wizard
//:: Created On: 2
//:://////////////////////////////////////////////
void main()
{

  {
    object vase2 = GetObjectByTag("vase2");
    object oPlayer = GetPCSpeaker();
    effect eVis = EffectVisualEffect(VFX_IMP_NEGATIVE_ENERGY);


    {
        GiveXPToCreature(GetPCSpeaker(), -500);

        DelayCommand(0.0, ActionSpeakString("Ah....your lifeforce is so sweet!"));

        DelayCommand(0.0, ActionCastFakeSpellAtObject(SPELL_NEGATIVE_ENERGY_BURST, oPlayer));

        DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_PERMANENT, eVis, oPlayer, 0.5));

        DelayCommand(2.5, AssignCommand(oPlayer, JumpToObject(vase2)));
    }
   }
 }```

From the lexicon:

“nXpAmount cannot be negative, however, SetXP() can make a PC lose experience to, for example, make a PC de-level to level 1.”

Thanks meaglyn…but you lost me…sigh sorry

I don’t want to level drain levels…just take 500 xps away from the PC. What do I use in that line of the script to do that?

I found a script that does this. Where I used a de-leveler. I found this and it works:

object oPC = GetPCSpeaker(); int nXP= GetXP(oPC); nXP = nXP -500; SetXP(oPC, nXP);

I can call this resolved then. :slight_smile:

So mark the thread with a tick if you’ve found a solution.

TR