Name: Dummy Trainer
What it does: This script will allow you to set up Training Dojo's around
your world. Basically when a PC damages the training dummy, they receive an
amount of XP equal to the amount of damage done, and they loose 2 gold. You
can play with the numbers that are in there to change it to whatever you
want.
Implementation:
You need a custom placable, use the CombatDummy as a template. It needs to
have 0 hardness, 1000 HP. Make the object usable.
You will also need to place a waypoint at the same location, with a tag
called "spawnspot".
Put this script in the "OnDamaged" script.
NWScript: void main()
{
object oTrainer = GetLastDamager();
int nCurrent = GetCurrentHitPoints(OBJECT_SELF);
int nAmount = 0;
int nMax = GetLocalInt(OBJECT_SELF, "nNewMax");
if (nMax == 0)
{
SetLocalInt(OBJECT_SELF, "nNewMax", 1000);
}
if (GetIsPC(oTrainer) == TRUE)
{
int nAmount = nMax - nCurrent;
int nGold = GetGold(oTrainer);
if (nGold >= 1)
{
int nGoldTake = nAmount / 4;
TakeGoldFromCreature(nGoldTake, oTrainer, TRUE);
GiveXPToCreature(oTrainer, nAmount);
};
SetLocalInt(OBJECT_SELF, "nNewMax", nCurrent);
}
}
This set needs to go in the "OnDeath" script. This way when the PCs do
eventually destroy the object, it respawns imediately.
NWScript: void main()
{
object oSpot = GetObjectByTag("spawnpoint", 0);
location lSpot = GetLocation(oSpot);
CreateObject (OBJECT_TYPE_PLACEABLE, "cmbtdummy001", lSpot, TRUE);
SetLocalInt(OBJECT_SELF, "nNewMax", GetCurrentHitPoints(OBJECT_SELF));
}
Note: The thing must be damaged at least once before it will start
functioning. It doesn't matter WHO damages it, as long as it's a PC.
|