25 lines
716 B
Plaintext
25 lines
716 B
Plaintext
-- Maps NPC ranks to their chance of death in anomalies (veteran and above are never affected by anomalies)
|
|
local rank_to_val = {
|
|
["novice"] = 100,
|
|
["trainee"] = 75,
|
|
["experienced"] = 50,
|
|
["professional"] = 25,
|
|
["veteran"] = 0,
|
|
["expert"] = 0,
|
|
["master"] = 0,
|
|
["legend"] = 0,
|
|
}
|
|
|
|
function npc_on_net_spawn(npc)
|
|
death_chance = rank_to_val[ranks.get_se_obj_rank_name(npc)]
|
|
-- Exclude important NPCs
|
|
if (npc:has_info("npcx_is_companion") or IsTrader(npc) or get_object_story_id(npc:id())) then
|
|
return
|
|
elseif IsStalker(npc) and math.random(1,100) < death_chance then
|
|
npc:set_enable_anomalies_damage(true)
|
|
end
|
|
end
|
|
|
|
function on_game_start()
|
|
RegisterScriptCallback("npc_on_net_spawn", npc_on_net_spawn)
|
|
end |