Getting a handle on survivors - findsurvivors.nut

Just a sample you can use in your own code to find survivors. You need to call if after a delay of 10 seconds or so with a logic_auto

Something like

logic_auto > onmapspawn "logic_script_name" runscriptcode with a value of "FindSurvivors()"

Then you can iterate (loop) through the survivors like so...
foreach(s,m in survivors){
//s = name (nick, etc) //m = entity ref if (m.IsValid()){ //do something } }

// Or by name


UPDATE:, as of The Passing, you can actually reference survivors using a syntax similar to !activator, !nick, !rochelle, !ellis, !coach, !louis, etc

author: Lee Pumphret

The survivors table, once initialized, holds an entity reference to all survivors
To reference a specific survivor, you can say
survivors.nick (etc...)

survivors <-{
   coach = "models/survivors/survivor_coach.mdl",
   ellis = "models/survivors/survivor_mechanic.mdl",
   nick = "models/survivors/survivor_gambler.mdl",
   rochelle = "models/survivors/survivor_producer.mdl"

survivors_found <- 0 // flag set to true once survivors are found

Find survivors, this needs to be called after a delay. If you call it immediately,
it will fail as they have not been loaded yet, 10 sec after map load should be good.
You can call it with a logic_auto output, runscriptcode FindSurvivors()
function FindSurvivors(){
   foreach(s,m in survivors){
    printl ("looking for "+s+" mdl:"+m);
    survivor <- Entities.FindByModel(null, m)
    if (survivor){
      printl(s+" found: "+survivor);
      survivors[s] = survivor
      printl(s+" NOT FOUND!: "+survivor);
      survivors[s] = null

Scroll to top