Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local level_vertexes={
- l01_escape = {lvid=595580, gvid=44},
- l02_garbage = {lvid=384039, gvid=265},
- l03_agroprom = {lvid=438379, gvid=693},
- l03u_agr_underground = {lvid=4892, gvid=703},
- l04_darkvalley = {lvid=392517, gvid=813},
- l04u_labx18 = {lvid=7446, gvid=1166},
- l05_bar = {lvid=99538, gvid=1233},
- l06_rostok = {lvid=69283, gvid=1311},
- l07_military = {lvid=915663, gvid=1546},
- l08_yantar = {lvid=141470, gvid=1438},
- l08u_brainlab = {lvid=8004, gvid=1537},
- l10_radar = {lvid=796328, gvid=1868},
- l10u_bunker = {lvid=8187, gvid=2661},
- --l11_pripyat = {lvid=295965, gvid=2269},
- l11_pripyat = {lvid=260787, gvid=2269},
- l12_stancia = {lvid=459597, gvid=2386},
- l12u_sarcofag = {lvid=10618, gvid=2427},
- l12u_control_monolith = {lvid=3981, gvid=2478},
- l12_stancia_2 = {lvid=264180, gvid=2646},
- }
- function get_event_position() --deprecated
- local lvid, gvid
- if level.name() == "l07_military" or level.name() == "l10_radar" then
- lvid = 200000 + math.random(-100000,100000)
- else
- lvid = math.random(level_vertexes[level.name()]["lvid"])
- end
- gvid = level_vertexes[level.name()]["gvid"]
- return lvid, gvid
- end
- function getpos(lev)
- local sec = anon_resources.event_points
- --local lev = level.name()
- local ran = math.random(#sec[lev]) --doh, forgot that recalling math.random fucks shit up
- return sec[lev][ran].p[1], sec[lev][ran].p[2], sec[lev][ran].p[3], sec[lev][ran].name
- end
- function testEvent(section)
- --[[if level.name() == "l05_bar" or level.name() == "l10_radar" or level.name() == "l11_pripyat" or level.name() == "l12_stancia" or level.name() == "l12_stancia_2" or level.name() == "l03u_agr_underground" or level.name() == "l04u_labx18" or level.name() == "l08u_brainlab" or level.name() == "l10u_bunker" or level.name() == "l12u_control_monolith" or level.name() == "l12u_sarcofag" then
- return
- end]]
- local lname = level.name()
- for invalid = 1, (#anon_resources.event_invalid_levels) do
- if lname == anon_resources.event_invalid_levels[invalid] then
- return
- end
- end
- local x,y,z, str
- x,y,z, str = getpos(lname)
- local lelvec = vector():set(x,y,z)
- local dist = vector():distance_to(db.actor:position(), lelvec)
- blowoutext.SendHudMessage("DEBUG:", "LOCATION IS:" .. str, "eventnews", 20, nil)
- if math.random() < 0.5 then
- blowoutext.SendHudMessage("DEBUG:", "MUTANTS:", nil, 20, nil)
- local curTable = anon_resources.event_table[lname].mutant
- local eventnum = math.random(#curTable)
- local mutieindex = math.random(#curTable[eventnum].names)
- local mutantname = curTable[eventnum].names[mutieindex]
- local numindex = math.random(#curTable[eventnum].number)
- local number = curTable[eventnum].number[numindex]
- if number < 1 or number == nil then
- number = 1
- blowoutext.SendHudMessage("DEBUG:", "NUMBER NIL OR 0", nil, 20, nil)
- end
- local basePos = lelvec
- for ind = 1, number do
- alife():create(mutantname, basePos, 1, level_vertexes[lname]["gvid"])
- basePos.x = basePos.x + (math.random()*4) - (math.random()*4)
- basePos.z = basePos.z + (math.random()*4) - (math.random()*4)
- end
- basePos = lelvec
- if curTable[eventnum].victim_data[1] == true then
- local victimnum = math.random(curTable[eventnum].victim_data[3])
- for ind = 1, victimnum do
- local victim = curTable[eventnum].victims[math.random(#curTable[eventnum].victims)]
- if math.random() < curTable[eventnum].victim_data[2] then
- alife():create(victim, basePos, 1, level_vertexes[lname]["gvid"])
- basePos.x = basePos.x + (math.random()*2) - (math.random()*2)
- basePos.z = basePos.z + (math.random()*2) - (math.random()*2)
- end
- end
- end
- else
- blowoutext.SendHudMessage("DEBUG:", "BATTLE", nil, 20, nil)
- local curTable = anon_resources.event_table[lname].battle
- local eventnum = math.random(#curTable)
- local basePos = lelvec
- --Begin Side 1 spawning
- local s1num = curTable[eventnum].side1[2]
- if curTable[eventnum].side1[3] == true then
- s1num = math.random(s1num)
- end
- --Select a random direction and offset
- local r = (math.random()*3) + 10
- local theta = math.random()*(2*math.pi)
- --apply the offset
- basePos.x = basePos.x + (r*math.cos(theta))
- basePos.z = basePos.z + (r*math.sin(theta))
- --Do the spawning
- for ind = 1, s1num do
- local s1 = curTable[eventnum].side1_troops[math.random(#curTable[eventnum].side1_troops)]
- alife():create(s1, basePos, 1, level_vertexes[lname]["gvid"])
- basePos.x = basePos.x + (math.random()*2) - (math.random()*2)
- basePos.z = basePos.z + (math.random()*2) - (math.random()*2)
- end
- --------------------------------------------------------------------------------------------------
- --Begin Side 2 spawning
- local s2num = curTable[eventnum].side2[2]
- if curTable[eventnum].side2[3] == true then
- s2num = math.random(s2num)
- end
- --Reset basePos and reverse the offset
- basePos = lelvec
- r = -r
- --apply the offset
- basePos.x = basePos.x + (r*math.cos(theta))
- basePos.z = basePos.z + (r*math.sin(theta))
- --Do the spawning
- for ind = 1, s2num do
- local s2 = curTable[eventnum].side2_troops[math.random(#curTable[eventnum].side2_troops)]
- alife():create(s2, basePos, 1, level_vertexes[lname]["gvid"])
- basePos.x = basePos.x + (math.random()*2) - (math.random()*2)
- basePos.z = basePos.z + (math.random()*2) - (math.random()*2)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment