DMH-Online

Dungeon Masters Helper · Est. 2005

Misc Scripts

NWN Script: ez_respawn.htm

Author Sticky: Post Working Scripts Here
VorpalBlade Posted: Wednesday, 17 July 06:53PM
EZ Respawner by VorpalBlade

Respawns creatures thoughout your module with no extra work for each instance.

Notes: If you want a customized creature/NPC to respawn with the same properties, you must create a template of
it with the Tag and the ResRef being the same.

Create an invisable placeable and give it a Name and Tag of "Respawner". Then place it anywhere in your module.

Add this line to main() in your Default OnSpawn script "nw_c2_default9":

NWScript:
void main()
{
    .
    .
    .
// Do not touch existing script!
    .
    .
    .
// Add this line.
    SetLocalLocation(OBJECT_SELF, "spawnpoint", GetLocation(OBJECT_SELF));
}




Add this to your default OnDeath script "nw_c2_default7":

NWScript:
// Declare this before main() so we can use it later.
void RespawnObject(int nType, string sTemp, location lRespawn);
void main()
{
    .
    .
    .
// Do not touch existing script!
    .
    .
    .
// Declare the variables we need
    location lSpawn;
    object oRespawner;
    string sTemplate;
// Assign the variables with the in data needed. 
    lSpawn = GetLocalLocation(OBJECT_SELF, "spawnpoint");
    oRespawner = GetObjectByTag("Respawner");
// Use tag as template name
    sTemplate = GetTag(OBJECT_SELF);
// Send Respawn command to the respawner so it will execute even
// after this object is dead and buried
// Set at a 5 min spawn.
    AssignCommand(oRespawner, DelayCommand(300.0, RespawnObject(OBJECT_SELF, sTemplate, lSpawn)));
}
// The command to be placed in the respawner's command queue.
void RespawnObject(int nType, string sTemp, location lRespawn)
{
CreateObject(nType, sTemp, lRespawn);
}
⌂ All Scripts ← PreviousNext → 👁 Category List

All Misc Scripts

📄 arena 📄 cast_bless_on_PC 📄 change_music 📄 chess_game 📄 climbing 📄 climbing_002 📄 common_includes_002 📄 cone_aoe 📄 cron 📄 cross_country_travel 📄 daoc_style_graves 📄 determine_time 📄 effects 📄 escort 📄 ez_respawn 📄 faction 📄 floating_text 📄 function_includes 📄 gambling 📄 include_sounds 📄 include_time_date 📄 jail 📄 jail_system 📄 journal_entry 📄 logbook 📄 manage_action_queue 📄 mmorpg_vault 📄 mod_intro 📄 mod_intro_002 📄 mod_intro_003 📄 mod_intro_005 📄 pers_world_database 📄 pers_world_database_002 📄 piller_of_fire 📄 plot_item 📄 portal_system 📄 portal_system_002 📄 puking 📄 quest_escort 📄 rep_per 📄 reward_rp 📄 rotation 📄 save_pc_location_002 📄 save_pc_location_003 📄 skill_checks 📄 skill_checks_002 📄 slot_machine 📄 story 📄 swimming 📄 take20_bypass 📄 vis_waypoint 📄 working_temple 📄 working_temple_002 📄 xp_gold_loss 📄 xp_gold_loss_002 📄 xp_loss_action