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);

}

}