diff --git a/game/base-combat/init.twee b/game/base-combat/init.twee index 2aefbc1d99cc4208325df415c9c219797eafa44d..172fa6a58683b95ce755a9df4d91c790c62915dc 100644 --- a/game/base-combat/init.twee +++ b/game/base-combat/init.twee @@ -954,23 +954,27 @@ otherwise there's no easy way of stopping NPC from shoving their stuff in PC's f <<wetnessCalculate>> <</widget>> -<<widget "inactiveNPC">> /* How to use: -* Call this widget as <<inactiveNPC _n>> where _n is any number between 0 and 5, and is an active NPC. -* This will prevent said NPC from entering combat, , reduce the overall max health by said NPC's max health, and reduce $enemyno by 1. -* Reducing $enemyno is important because of the single-damage formula. -* Can be expanded into arousal as well. -* Why use this? -* When an active NPC is not supposed to be present in combat but still active. E.g. the NPC is in the audience. +* Call this widget as <<deactivateNPC _n>> where _n is any number between 0 and 5, and is an active NPC. +* This will prevent said NPC from entering combat plus deal with all the rest of the math. +* Optional arguments [1] and [2] for health and arousal respectivelly. If the original health or arousal values for the NPCs haven't been changed, no need to use those arguments. */ -<<if _args[0]>> - <<set $NPCList[_args[0]].active to "inactive">> - <<set $enemyhealthmax -= $NPCList[_args[0]].healthmax>> - <<set $enemyarousalmax -= $enemyarousalmax/$enemyno>> - <<set $enemyno-->> -<<else>> - <span class="red">inactiveNPC ERROR: No index specified.</span> -<</if>> +<<widget "deactivateNPC">> + <<set $_hpToReduce to _args[1] || $NPCList[_args[0]].healthmax>> + <<set $_arousalToReduce to _args[2] || $enemyarousalmax/$enemyno>> + <<if _args[0] isnot undefined and $NPCList[_args[0]]>> + <<if $NPCList[_args[0]].active isnot "inactive">> + <<set $NPCList[_args[0]].active to "inactive">> + <<set $enemyhealth -= $_hpToReduce>> + <<set $enemyhealthmax to $enemyhealth>> + <<set $enemyarousalmax -= $_arousalToReduce>> + <<set $enemyno-->> + <<else>> + <span class="red">deactivateNPC ERROR: NPC _args[0] is already inactive.</span> + <</if>> + <<else>> + <span class="red">deactivateNPC ERROR: Invalid or missing index specified.</span> + <</if>> <</widget>> <<widget "man">>