Advertisement
Guest User

stalker script

a guest
May 12th, 2014
1,265
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. -------GLOBALS------
  3.         local spawn_timer = time_global() + 60000
  4.         local spawn_active = true
  5.        
  6. function random_spawner_main()
  7.     local actor_rank = ranks.get_obj_rank_name(db.actor)
  8.     local current_level = level.name()                     
  9.     local coords_spawn = math.random(1, 2)                                                                     
  10.     local max_to_spawn = math.random(1,3)
  11.  
  12.   local levels = {
  13.  
  14.                 ["la01_escape"] = { coords = { [1] = {x = -128.11, y = 4.07, z = 236.48}, [2] = {x = 306.26, y = 12.75, z = 290.55}  } },      
  15.                 ["la02_garbage"] = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } },
  16.                 ["la03_agroprom"] = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } },
  17.                 ["la04_darkdolina"] = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } },
  18.                 ["la05_bar_rostok"] = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } },
  19.                 ["la07_military"] = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } },
  20.                 ["la08_yantar"]  = { coords = { [1] = {x = -178.97, y = -4.62, z = -142.04}, [2] = {x = -243.97, y = -7.62, z = -138.04}  } }      
  21.         }      
  22.        
  23.    
  24.   if spawn_active == true and (spawn_timer == nil or spawn_timer < time_global() ) then
  25.    for level,content in pairs(levels) do
  26.      if ( current_level == level and db.actor:alive() ) then
  27.       for min_to_spawn = 1,max_to_spawn do
  28.         alife():create(rs_npc_select(), vector():set(levels[level].coords[coords_spawn].x,levels[level].coords[coords_spawn].y,levels[level].coords[coords_spawn].z), db.actor:level_vertex_id(), db.actor:game_vertex_id())
  29.       end
  30.       spawn_active = true  
  31.      end
  32.     spawn_timer = time_global() + 60000
  33.    end
  34.   end
  35. end
  36.  
  37. function rs_npc_select()
  38.  
  39. local human_npc_groups = { ["military"] = { "esc_soldier_respawn_1", "rad_specnaz_respawn_specnaz", "rad_soldier_master", "val_soldier_respawn_1", "agr_soldier_regular" },
  40.                             ["stalker"] = { "agr_stalker_regular", "gar_stalker_respawn_1", "gar_stalker_respawn_2", "ds_stalker_respawn_2", "bar_stalker_respawn_4"  },
  41.                             ["monolith"]= { "pri_monolith_respawn_1", "rad_monolith_respawn_1", "rad_monolith_respawn_2", "pri_monolith_respawn_2", "pri_monolith_respawn_3"},
  42.                             ["killer"] = { "cit_killer_respawn_1", "ros_killer_respawn_3", "ros_killer_respawn_2", "mil_killer_respawn_1", "mil_killer_respawn_4"  },
  43.                             ["ecolog"] = { "yan_ecolog_respawn_1" },
  44.                             ["bandit"] = { "agr_bandit_respawn_1", "agr_bandit_respawn_2", "gar_bandit_respawn_2", "ds_bandit_respawn_3", "cit_bandit_respawn_2"  }
  45.                           }
  46.                          
  47.         local groups_total = 0
  48.            
  49.         for _ in pairs(human_npc_groups) do
  50.          groups_total = groups_total + 1
  51.         end
  52.        
  53.   local npc_group = math.random(1,groups_total)
  54.   local human_group = ""
  55.  
  56.     if(npc_group == 1) then
  57.      human_group = "military"
  58.     elseif(npc_group == 2) then
  59.      human_group = "stalker"
  60.     elseif(npc_group == 3) then
  61.      human_group = "monolith"
  62.     elseif(npc_group == 4) then
  63.      human_group = "killer"
  64.     elseif(npc_group == 5) then
  65.      human_group = "ecolog"
  66.     elseif(npc_group == 6) then
  67.      human_group = "bandit"
  68.     end
  69.    
  70.    local human_group_npc = math.random(1,#human_npc_groups[human_group])
  71.  
  72.     return human_npc_groups[human_group][human_group_npc]
  73. end
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement