Skip to content

Instantly share code, notes, and snippets.

@GermanAizek
Created October 18, 2020 03:36
Show Gist options
  • Save GermanAizek/e02e02c072e7a8a240274bca8f65589c to your computer and use it in GitHub Desktop.
Save GermanAizek/e02e02c072e7a8a240274bca8f65589c to your computer and use it in GitHub Desktop.
plugin spawn for nutscript stalker rp
function CleanAnomalies()
local anomtable = {
"electra_anomaly",
"electra_anomaly_type2",
"kometa_kisel",
"kometa_electra",
"gazirovka_anomaly",
"jarka",
"tramplin_anomaly",
"kisel_anomaly",
"kometa",
"space_anomaly",
"par",
"teleport",
"maysorubka_anomaly",
"maysorubka_anomaly_type2",
"voronka_anomaly",
"anom_acidfog",
"anom_bubble"
}
for k, v in pairs(anomtable) do
local table = ents.FindByClass(v)
for k, t in pairs(table) do
t:Remove()
end
end
local loottable = ents.FindByClass("nut_loot*")
for k, v in pairs(loottable) do
v:Remove()
end
end
--if file.Exists("maps/"..game.GetMap()..".lua", "GAME") then else return end
-- for k, v in pairs( player.GetAll()) do
-- if v:getChar() then
-- if v:getChar():getMoney() > 200000 then
-- print(v:Name(), v:getChar():getMoney())
-- //v:getChar():setMoney(0)
-- end
-- end
-- end
-- for k, v in pairs(ents.FindByClass("nut_money")) do
-- v:Remove()
-- end
-- for k, v in pairs(nut.char.loaded) do
-- if v:getMoney() > 100000 then
-- print(v:getMoney())
-- end
-- for k, v in pairs(v:getInv():getItems()) do
-- //if string.find(v.uniqueID, "val") then
-- if v.price > 80000 then
-- print(v.uniqueID)
-- end
-- end
-- end
--local function SpawnFunction(position, addictive)
--end
function GetChance(num)
local higher = 1000
num = math.Clamp(num, 0, 100)
num = higher/100*num
if math.random(1, higher) < num then return true end
return false
end
function AnomalyArtifact(class, victims)
if class == "anom_dynamic_electra" then
if victims > 8 then
return "battery"
elseif victims > 3 then
return "shell"
elseif victims > 1 then
return "sparkler"
end
end
if class == "anom_dynamic_burn" then
if victims > 10 then
return "crystal"
elseif victims > 8 then
return "fireball"
elseif victims > 1 then
return "eye"
end
end
if class == "anom_static_acid" then
if victims > 10 then
return "bubble"
elseif victims > 1 then
return "vyvert"
end
end
if class == "anom_static_shoulder" then
if victims > 5 then
return "kolobok"
elseif victims > 1 then
return "sparkler"
end
end
if class == "anom_fuzz" then
if victims > 10 then
return "bubble"
elseif victims > 8 then
return "vyvert"
elseif victims > 1 then
return "vyvert"
end
end
if class == "anom_meat" then
if victims > 10 then
return "goldfish"
elseif victims > 4 then
return "gravi"
elseif victims > 2 then
return "vyvert"
elseif victims > 0 then
return "jellyfish"
end
end
end
function GetAnomaly()
local randanom = math.random(1, 16)
if randanom == 1 then
return "electra_anomaly"
elseif randanom == 2 then
return "electra_anomaly_type2"
elseif randanom == 3 then
return "kometa_kisel"
elseif randanom == 4 then
return "kometa_electra"
elseif randanom == 5 then
return "gazirovka_anomaly"
elseif randanom == 6 then
return "jarka"
elseif randanom == 7 then
return "tramplin_anomaly"
elseif randanom == 8 then
return "kisel_anomaly"
elseif randanom == 9 then
return "kometa"
elseif randanom == 10 then
return "anom_bubble"
elseif randanom == 11 then
return "par"
elseif randanom == 12 then
return "teleport"
elseif randanom == 13 then
return "maysorubka_anomaly"
elseif randanom == 14 then
return "maysorubka_anomaly_type2"
elseif randanom == 15 then
return "voronka_anomaly"
elseif randanom == 16 then
return "anom_acidfog"
end
end
/* Переменные с НПС */
npc_mutant_bloodsucker = "npc_ga_zss_bloodsucker"
npc_mutant_boar = "npc_ga_zss_boar"
npc_mutant_cat = "npc_ga_zss_cat"
npc_mutant_chimera = "npc_ga_zss_himera"
npc_mutant_controller = "npc_ga_zss_controller"
npc_mutant_dog = "npc_ga_zss_dog"
npc_mutant_flesh = "npc_ga_zss_flesh"
npc_mutant_poltergeist = "npc_ga_zss_tele_poltergeist"
npc_mutant_fire_poltergeist = "npc_ga_zss_fire_poltergeist"
npc_mutant_pseudodog = "npc_ga_zss_psevdo_dog"
npc_mutant_psidog = "npc_ga_zss_psi_dog"
npc_mutant_chernobyl_dog = "npc_ga_zss_chernobyl_dog"
npc_mutant_pseudogiant = "npc_ga_zss_psevdo_gigant"
npc_mutant_rodent = "npc_ga_zss_tushkan"
npc_mutant_snork = "npc_ga_zss_snork"
npc_mutant_zombie = "npc_ga_zss_zombie"
npc_mutant_izlom = "npc_ga_zss_izlom"
npc_player_stalker = "npc_ga_pl_stalker_private"
npc_player_stalker2 = "npc_ga_pl_stalker_expert"
npc_player_stalker3 = "npc_ga_pl_stalker_veteran"
npc_player_stalker4 = "npc_ga_pl_stalker_master"
npc_player_dolg = "npc_ga_pl_dolg_private"
npc_player_dolg2 = "npc_ga_pl_dolg_expert"
npc_player_dolg3 = "npc_ga_pl_dolg_veteran"
npc_player_dolg4 = "npc_ga_pl_dolg_master"
npc_player_freedom = "npc_ga_pl_freedom_private"
npc_player_freedom2 = "npc_ga_pl_freedom_expert"
npc_player_freedom3 = "npc_ga_pl_freedom_veteran"
npc_player_freedom4 = "npc_ga_pl_freedom_master"
npc_player_csky = "npc_ga_pl_csky_private"
npc_player_csky2 = "npc_ga_pl_csky_expert"
npc_player_csky3 = "npc_ga_pl_csky_veteran"
npc_player_csky4 = "npc_ga_pl_csky_master"
npc_player_zombify = "npc_ga_pl_zombie"
include("maps/"..game.GetMap()..".lua")
MsgC(Color(40,240,40), "[S.T.A.L.K.E.R. RP] ", Color(240,240,40), "Loaded config for map "..game.GetMap().."\n")
function GetGround(position, addictive)
local tracedata = {}
tracedata.start = position
tracedata.endpos = position - Vector(0, 0, zposition)
tracedata.mask = MASK_SOLID_BRUSHONLY + MASK_WATER
local trace = util.TraceLine(tracedata)
--if tracedata.MatType == 88 or tracedata.MatType == 85 then
--if trace.HitPos.z < 200 then print(trace.HitPos) end
return trace.HitPos + Vector(0, 0, addictive or 0)
end
--CleanAnomalies()
--function InitGMFunctions()
RadiationSpawn()
AnomalySpawn()
--EntityHandler()
timer.Create( "PeriodicSpawnEnemies", 3900, 0, SpawnEnemies)
timer.Create( "PeriodicSpawnExtra", 3900, 0, ExtraSpawn)
timer.Create( "PeriodicSpawnArt", 9900, 0, SpawnArtifact)
timer.Create( "PeriodicSpawnLoot", 4800, 0, LootSpawn)
timer.Create( "PeriodicSpawnLoot", 3000, 0, CleanAnomalies)
timer.Create( "PeriodicSpawnLoot", 3000, 0, AnomalySpawn)
concommand.Add( "lootspawn", function( ply, cmd, args )
if ply:IsAdmin() then
LootSpawn()
end
end )
concommand.Add( "extraspawn", function( ply, cmd, args )
if ply:IsAdmin() then
ExtraSpawn()
end
end )
concommand.Add( "npcspawn", function( ply, cmd, args )
if ply:IsAdmin() then
SpawnEnemies()
end
end )
concommand.Add( "artspawn", function( ply, cmd, args )
if ply:IsAdmin() then
SpawnArtifact()
end
end )
concommand.Add( "anomspawn", function( ply, cmd, args )
if ply:IsAdmin() then
AnomalySpawn()
end
end )
concommand.Add( "clearallspawn", function( ply, cmd, args )
if ply:IsAdmin() then
CleanAnomalies()
end
end )
--timer.Create( "PeriodicSpawnDoc", 5000, 0, DocSpawn)
--end
--hook.Add( "InitPostEntity", "initializing", InitGMFunctions )
function StalkerAnomOnNPCKilled(npc, attacker, inflictor)
if IsValid(attacker) and IsValid(attacker:GetParent()) then
if string.sub(attacker:GetParent():GetClass(), 0, 4) == "anom" then
local anom = attacker:GetParent()
if anom.victims then
anom.victims = anom.victims + 1
else
anom.victims = 1
end
end
end
end
hook.Add( "OnNPCKilled", "StalkerAnomOnNPCKilled", StalkerAnomOnNPCKilled )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment