Hello. I've decided that my next gamemode project will be a coop gamemode, kinda like Insurgency 2's coop.
So, here are some features I plan to add:
-No NPCs, pure players controlled by nextbot AI
-Capture Points
-Good UI
-Good weapon base
What I need help with(Look here, this is where I need help)
-Learning how to reskin derma
-Creating a viewbob code for my SWEP base
-Making bots(code shown below) do the following things:
-React to sound
-Patrol
-Automatically have their state set to attack
-Use ents.FindInSphere() to find enemies instead of just targeting one no matter where they are
-Create a timer that makes them disconnect upon them being killed
Bot code so far:
[CODE]local BOTS = {}
local botsName = {"Dakota",
"Bret",
"Marhta",
"Ayako",
"Kyle",
"Elena",
"Aurore",
"Zetta",
"Hannelore",
"Arron"}
concommand.Add("create_bot",function(ply)
local b = player.CreateNextBot(botsName[math.random(#botsName)])
table.insert(BOTS,b)
b.Owner = ply
end)
hook.Add("PlayerSay","Bots",function(ply,text)
if(text == "!follow") then
ply.State = 1
end
if(text == "!quiet") then
ply.State = 0
end
if(text == "!attack") then
ply.State = 2
end
if(text == "!defend") then
ply.State = 3
end
end)
hook.Add("EntityTakeDamage","Defend!",function(ent,dmg)
if(ent:IsPlayer() && !ent:IsBot() && !dmg:GetAttacker():IsWorld()) then
for k,v in pairs(player.GetBots()) do
if(v.Owner == ent) then
v.Target = dmg:GetAttacker()
end
end
end
if(dmg:GetAttacker():IsPlayer() && !ent:IsWorld()) then
MsgN(ent)
for k,v in pairs(player.GetBots()) do
if(v.Owner == dmg:GetAttacker()) then
v.Target = ent
end
end
end
end)
hook.Add("StartCommand","MoveBots",function(ply,cmd)
if(IsValid(ply.Owner)) then
cmd:ClearMovement()
cmd:ClearButtons()
if(ply.Owner.State == nil) then
ply.Owner.State = 1
end
local ow = ply.Owner
local ang = ((ply:EyePos() - Vector(0,0,10))-(ow:EyePos() - Vector(0,0,10))):Angle()
local lClamp = ang + Angle(0,180,0)
ply:SetEyeAngles(Angle(math.Clamp(lClamp.p,-180,180),lClamp.y,math.Clamp(lClamp.r,-180,180)))
cmd:SetViewAngles(Angle(math.Clamp(lClamp.p,-180,180),lClamp.y,math.Clamp(lClamp.r,-180,180)))
if(ow.State == 1 or ow.State == 3) then
if(ow:GetPos():Distance(ply:GetPos()) > 128) then
cmd:SetForwardMove(750)
end
end
if(ow.State == 2) then
if(ow:GetPos():Distance(ply:GetPos()) < 72 && ow:Alive() or (ply.Ranged or false)) then
if(ow:Alive()) then
cmd:SetButtons(IN_ATTACK)
if(ow:GetPos():Distance(ply:GetPos()) < 72) then
ply:SelectWeapon("weapon_crowbar")
ply.Ranged = false
end
end
end
if(ow:GetPos():Distance(ply:GetPos()) > 256) then
if(ply:GetActiveWeapon():GetClass() != "weapon_ar2") then
ply:SelectWeapon("weapon_ar2")
ply.Ranged = true
end
end
if(ow:GetPos():Distance(ply:GetPos()) > 64) then
cmd:SetForwardMove(750)
end
cmd:SetSideMove(math.cos(RealTime())*400)
end
if(ow.State == 3) then
if(IsValid(ply.Target)) then
local ang = (ply:GetShootPos()-ply.Target:GetPos()):Angle()
if(ply.Owner:KeyDown(IN_ATTACK)) then
ang = (ply:GetShootPos()-ply.Owner:GetEyeTrace().HitPos):Angle()
end
local lClamp = ang + Angle(90,180,0)
ply:SetEyeAngles(lClamp)
cmd:SetViewAngles(lClamp)
if(ply.Target:GetPos():Distance(ply:GetShootPos()) > 256) then
if(ply:GetActiveWeapon():GetClass() != "weapon_ar2") then
ply:SelectWeapon("weapon_ar2")
ply.Ranged = true
end
else
ply:SelectWeapon("weapon_crowbar")
if(ply.Target:GetPos():Distance(ply:GetPos()) > 64) then
cmd:SetForwardMove(750)
end
end
cmd:SetButtons(IN_ATTACK)
end
end
end
end)
[/CODE]
Now, other stuff again:
-I need to learn how to make entities communicate with my gamemode(capture point entities)
-Make bots spawn at certain places depending on which capture point the players are on(maybe make capture points a, b, c as different entities?)
--If any experienced coders are willing to help, add me on steam: name: Von Kaiser( AKA A Fighter Pilot )--
I'll be updating what I plan to add and what I need help with daily; stay tuned!
Sorry, you need to Log In to post a reply to this thread.