DMH-Online

Dungeon Masters Helper · Est. 2005

Placeables Scripts

NWN Script: useable_training_dummy.htm

Author Sticky: Post Working Scripts Here
CainFortea Posted: Thursday, 27 June 05:25AM
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()
{
//////////////////////////////////////////////////////
//Combat Training
//by Shaun Yoder
//06/26/02
//////////////////////////////////////////////////////
//get crap into variables.
object oTrainer = GetLastDamager();
int nCurrent = GetCurrentHitPoints(OBJECT_SELF);
int nAmount = 0;
int nMax = GetLocalInt(OBJECT_SELF, "nNewMax");
//if the local int is 0, then make it 1000, for new HP.
if (nMax == 0)
    {
    SetLocalInt(OBJECT_SELF, "nNewMax", 1000);
    }
//make sure its a PC doing the damage.
    if (GetIsPC(oTrainer) == TRUE)
        {
//find out how much damage was done, and to make sure you don't put the PCs into negatives.
        int nAmount = nMax - nCurrent;
        int nGold = GetGold(oTrainer);
            if (nGold >= 1)
            {
//take away 1/4 of the damage in gold, and give the XP.
            int nGoldTake = nAmount / 4;
            TakeGoldFromCreature(nGoldTake, oTrainer, TRUE);
            GiveXPToCreature(oTrainer, nAmount);
            };
//Reset the "NewMax" Variable.
        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()
{
//where to spawn?
object oSpot = GetObjectByTag("spawnpoint", 0);
location lSpot = GetLocation(oSpot);
//spawn, and reset the NewMax varaible.
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.

⌂ All Scripts ← PreviousNext → 👁 Category List

All Placeables Scripts

📄 cast_haste 📄 check_fire 📄 chest_puzzle 📄 close_door 📄 close_door_002 📄 close_door_003 📄 close_door_004 📄 create_item_with_delay 📄 darklamp 📄 darklamp_002 📄 day_night_lights 📄 day_night_lights_002 📄 destroy_spawned_items 📄 destroy_spawned_items_002 📄 door_guard 📄 door_lock_item 📄 dragging_placeables 📄 encounter_on_open 📄 encounter_on_open_002 📄 fair_loot 📄 fire_burns 📄 guarded_chest 📄 kill_attacker 📄 kill_nearby 📄 lights_on_off 📄 linked_doors 📄 moveable_placeables 📄 multi_door 📄 open_doors 📄 poly_attacker 📄 polymorph_pc 📄 polymorph_pc_002 📄 random_teleport 📄 refil_chest 📄 refil_chest_002 📄 refil_chest_003 📄 refil_chest_004 📄 refil_chest_005 📄 refil_chest_006 📄 refil_chest_007 📄 remove_with_item 📄 respawner 📄 smart_doors 📄 spit_treasure 📄 talkable_placeables 📄 talking_door 📄 talking_sign 📄 talking_sign_002 📄 talking_sign_003 📄 talking_sign_004 📄 teleporting_chairs 📄 useable_bedroll 📄 useable_birdcage 📄 useable_cannon 📄 useable_catapult 📄 useable_chair 📄 useable_chair_002 📄 useable_chair_003 📄 useable_chair_004 📄 useable_couch 📄 useable_divining_pool 📄 useable_gong 📄 useable_kegs 📄 useable_kegs_002 📄 useable_placeables_002 📄 useable_sign 📄 useable_sign_002 📄 useable_sundial 📄 useable_sundial_002 📄 useable_sundial_003 📄 useable_sundial_004 📄 useable_sundial_005 📄 useable_sundial_006 📄 useable_training_dummy 📄 useable_training_dummy_002 📄 useable_training_dummy_003 📄 useable_training_dummy_004 📄 useable_trapdoor 📄 useable_trapdoor_002 📄 useable_trapdoor_003 📄 useable_trapdoor_004 📄 weapon_spawn_per_class 📄 worth