ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Respwn Script

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  15:05:07  17 March 2012
profilee-mailreply Message URLTo the Top
olaf1
Senior Resident
 

 
On forum: 01/17/2012
 

Message edited by:
olaf1
03/17/2012 15:58:11
Messages: 240
Respwn Script

Can anyone say me why this code not spwan NPC´s?
when i start the game one NPC spwan but the other not why???

thanke you


local mar_clear_sky_respawn_1_counter = nil
local mar_clear_sky_respawn_2_counter = nil
local mar_clear_sky_respawn_3_counter = nil
local respwan_table_mar_clear_sky_respawn_1 = {}
local respwan_table_mar_clear_sky_respawn_2 = {}
local respwan_table_mar_clear_sky_respawn_3 = {}


local npc = 
{
"mar_clear_sky_respawn_1",
"mar_clear_sky_respawn_2",
"mar_clear_sky_respawn_3"
}



local levels = {marsh=			{x=-61.996055603027,y=0.92057931423187,z=293.67742919922}
	


		
local npc_spwan_counter = {
mar_clear_sky_respawn_1 = "mar_clear_sky_respawn_1_counter",
mar_clear_sky_respawn_2 = "mar_clear_sky_respawn_3_counter",
mar_clear_sky_respawn_3 = "mar_clear_sky_respawn_2_counter"
}


function spwan()
	if db.actor:alive() == false then return end
	local level_name = level.name()
	local who = npc[math.random(1, 3)]
		for lvl, pos in pairs(levels) do
				if level_name == lvl then
					if lvl == "marsh" then
						for npc_name,counter in pairs(npc_spwan_counter)do
							if npc_name == who then
							if who == "mar_clear_sky_respawn_1" then
								if mar_clear_sky_respawn_1_counter == nil then
								spwan_mar_clear_sky_respawn_1(who,pos)
							elseif who == "mar_clear_sky_respawn_2" then
								if mar_clear_sky_respawn_2_counter == nil then
								spwan_mar_clear_sky_respawn_2(who,pos)
							elseif who == "mar_clear_sky_respawn_3" then
								if mar_clear_sky_respawn_3_counter == nil then
								spwan_mar_clear_sky_respawn_3(who,pos)
												
										
									end
								end
							end
						end	
					end			
				end
			end	
		end
	end				
end


function spwan_mar_clear_sky_respawn_1(wer,pos)
local pos = vector():set(pos.x, pos.y, pos.z)
local lvi = db.actor:level_vertex_id()
local gvi = db.actor:game_vertex_id()
respwan_table_mar_clear_sky_respawn_1[alife():create(wer, pos, lvi, gvi).id] = true
mar_clear_sky_respawn_1_counter = false
end

function spwan_mar_clear_sky_respawn_2(wer,pos)
local pos = vector():set(pos.x, pos.y, pos.z)
local lvi = db.actor:level_vertex_id()
local gvi = db.actor:game_vertex_id()
respwan_table_mar_clear_sky_respawn_2[alife():create(wer, pos, lvi, gvi).id] = true
mar_clear_sky_respawn_2_counter = false
end

function spwan_mar_clear_sky_respawn_3(wer,pos)
local pos = vector():set(pos.x, pos.y, pos.z)
local lvi = db.actor:level_vertex_id()
local gvi = db.actor:game_vertex_id()
respwan_table_mar_clear_sky_respawn_3[alife():create(wer, pos, lvi, gvi).id] = true
mar_clear_sky_respawn_3_counter = false
end



i will later writ in this code a timer and then a respwaner

thank you.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2021 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.