DMH-Online

Dungeon Masters Helper · Est. 2005

Misc Scripts

NWN Script: jail.htm

Author Sticky: Post Working Scripts Here
bobsmods Posted: Tuesday, 09 July 12:49PM
1. Script Name -- Capture/Subdual Script

2. What It Does -- If a PC is reduced to 0 HP, teleports them virtually naked into a jail cell.

3. Notes -- Place this into a Module's OnDying script. I cobbled this together from some of the other scripts already listed in this thread. Thanks to everyone who has posted -- please keep the working scripts coming in!

NWScript:
void main()
{
//Initialize objects, variables and effects.
object oPC = GetLastPlayerDying();
object oAttacker = GetLastAttacker(oPC);
object oTarget = GetWaypointByTag("WP_CELL001"); //or whatever the tag is for your destination waypoint
int iHPs = GetCurrentHitPoints(oPC);
effect eTeleport= EffectVisualEffect(VFX_FNF_SUMMON_MONSTER_3);
effect eHeal = EffectHeal(20);
effect eGive1HP = EffectHeal(abs(iHPs)+1);
effect eDeath = EffectDeath(FALSE, FALSE);
//Main condition, If the Player is between 0 and -20 HPs they are "captured" and placed in a jail cell.
//...otherwise make them die.
if (iHPs >= -20)
{
ApplyEffectToObject(DURATION_TYPE_INSTANT, eTeleport, oPC);
AssignCommand(oPC, JumpToObject(oTarget));
//Stop the NPC from attacking the player
SetPCLike(oPC, oAttacker);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oPC);
}
else
{
//Make the Player die if at -20 or below.
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDeath, oPC);
}
}
⌂ 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