NWN2Wiki
Advertisement


Build a Combat Dummy or Archery target. Remove all the scripts on it and make sure it is NOT Plot. Give it a fair amount of Hit Points to keep it from being destroyed after one hit. Also, for harder targets to hit, increase the AC on the Dummy.

Place this script in the OnPhysicalAttacked and OnSpellCastAt nodes to keep the Dummy from Attacking back.

//::///////////////////////////////////////////////
//:: patchnoattack
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Derrick's script to make combat dummies not attack
    you.
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
void main()
{
    object oPC = GetLastAttacker();
    SetIsTemporaryFriend(oPC,OBJECT_SELF,FALSE,0.001);
    DelayCommand(0.001,SetIsTemporaryEnemy(oPC));
}

And place the XP script in the OnDamaged node

void main()
{
    int nXP = 2; // amount of xp per damage point
    int nXPMax = 2000; // Max amount of xp a PC can get from the Dummy
    int nMaxLevel = 3; // Max level the PC can be to still gain xp from betting up a Dummy
    int nDam = GetTotalDamageDealt();
    object oPC = GetLastDamager();
    if(GetIsPC(oPC) && GetHitDice(oPC) <= nMaxLevel && GetLocalInt(OBJECT_SELF,GetName(oPC)) < nXPMax+1)
        {
        GiveXPToCreature(oPC,nDam*nXP);
        SetLocalInt(OBJECT_SELF,GetName(oPC),GetLocalInt(OBJECT_SELF,GetName(oPC)) + nDam*nXP);
        // Heal the dummy so it don't get destroyed
        ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(nDam),OBJECT_SELF);
        }
    else
        {
        SendMessageToPC(oPC,"You have exceeded Level "+IntToString(nMaxLevel));
        SendMessageToPC(oPC,"Or you have gained "+IntToString(nXPMax)+" amount of xp");
        ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(nDam),OBJECT_SELF);
        }
}

The script is just a simple/basic XP giveing script and it heals the Dummy so it don't get destroyed. Alter / Modify the script as needed.

Note: The PC will be able to move to a different Dummy and start gaining XP again off the new dummy. If you want the PC to only gain nXPMax total. Then use this script

void main()
{
    int nXP = 2; // amount of xp per damage point
    int nXPMax = 2000; // Max amount of xp a PC can get from the Dummy
    int nMaxLevel = 3; // Max level the PC can be to still gain xp from betting up a Dummy
    int nDam = GetTotalDamageDealt();
    object oPC = GetLastDamager();
    if(GetIsPC(oPC) && GetHitDice(oPC) <= nMaxLevel && GetLocalInt(GetModule(),"Dummy"+GetName(oPC)) < nXPMax+1)
        {
        GiveXPToCreature(oPC,nDam*nXP);
        SetLocalInt(GetModule(),"Dummy"+GetName(oPC),GetLocalInt(GetModule(),"Dummy"+GetName(oPC)) + nDam*nXP);
        // Heal the dummy so it don't get destroyed
        ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(nDam),OBJECT_SELF);
        }
    else
        {
        SendMessageToPC(oPC,"You have exceeded Level "+IntToString(nMaxLevel));
        SendMessageToPC(oPC,"Or you have gained "+IntToString(nXPMax)+" amount of xp");
        ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(nDam),OBJECT_SELF);
        }
}
Advertisement