I Know That I Posted A Similar Thread And Everybody Was Telling Me "Just Stop" And That Was A Recent Thread But Some Also Advised Me To Use My EXACT Code...
That`s What I Need Help On!
Please Not That The Code Was Made For Test Purposes, I Need Help To Finish It And Then The Explode On Death Code Will Be Added
The Combine Guard Was My Code... Not Scrapped From Devmon, Xystus And Definately Not Silverlans... This Was What Should`ve Been My First Working Code...
The Code Below - (It Is Unfinished And Is Supposed To Explode On Death)
[code]//AddCSLuaFile( "shared.lua" )
//AddCSLuaFile( "cl_init.lua" )
include('shared.lua')
ENT.Model = "models/combine_guard.mdl"
ENT.Class = CLASS_COMBINE
ENT.Health = 5203
ENT.iBloodType = false
ENT.MeleeDamage = 25
ENT.CannonChargeTime = 6
ENT.CannonDamage = 4353
ENT.fMeleeDistance = 34
ENT.fRangeDistance = 1092
ENT.Pain1 = "sound/npc/combineguard/pain1.wav" ENT.Pain2 = "sound/npc/combineguard/pain2.wav"
ENT.Pain3 = "sound/npc/combineguard/pain3.wav" ENT.Idle1 = "sound/npc/combineguard/refind_enemy1.wav"
ENT.Idle2 = "sound/npc/combineguard/refind_enemy2.wav" ENT.Idle3 = "sound/npc/combineguard/refind_enemy3.wav"
ENT.Death1 = "sound/npc/combineguard/die1.wav" ENT.Death2 = "sound/npc/combineguard/die2.wav"
ENT.Death3 = "sound/npc/combineguard/die3.wav" ENT.WarpCannonCharge = "sound/npc/strider/charging.wav" ENT.WarpCannonFire = "sound/npc/strider/fire.wav"
end
self:SetModel( self.Model )
self:SetHullType( HULL_LARGE )
self:SetHullSizeNormal()
self:SetSolid( SOLID_BBOX )
self:SetMoveType( MOVETYPE_STEP )
self:CapabilitiesAdd( CAP_MOVE_GROUND )
self:SetMaxYawSpeed( 300 )
self:SetHealth(self.health)
end
function ENT:Think()
//---------------
local function setmeleefalse()
if self:Health() < 0 then return end
self.MeleeAttacking = false
self.Leaping = false
self:SetSchedule(SCHED_CHASE_ENEMY)
end
//---------------
local function Attack_Melee()
if self:Health() < 0 then return end
local entstoattack = ents.FindInSphere(self:GetPos() + self:GetForward()*75,47)
local hit = false
if entstoattack != nil then
for _,v in pairs(entstoattack) do
if ( (v:IsNPC() || ( v:IsPlayer() && v:Alive())) && (v != self) && (v:GetClass() != self:GetClass()) || (v:GetClass() == "prop_physics")) then
v:TakeDamage( self.Damage, self )
if v:IsPlayer() then
v:ViewPunch(Angle(math.random(-1,1)*35,math.random(-1,1)*35,math.random(-1,1)*35))
end
if v:GetClass() == "prop_physics" then
local phys = v:GetPhysicsObject()
if phys != nil && phys != NULL then
phys:ApplyForceOffset(self:GetForward()*1000,Vector(math.random(-1,1),math.random(-1,1),math.random(-1,1)))
end
end
hit = true
end
end
end
local randomsound = math.random(1,4)
if hit == false then
self:StopSound(self.idle1)
self:StopSound(self.idle2)
self:StopSound(self.idle3)
self:StopSound(self.idle4)
if randomsound == 1 then
self:EmitSound( self.attackmiss1,500,math.random(94,106))
elseif randomsound == 2 then
self:EmitSound( self.attackmiss2,500,math.random(94,106))
elseif randomsound == 3 then
self:EmitSound( self.attackmiss3,500,math.random(94,106))
elseif randomsound == 4 then
self:EmitSound( self.attackmiss4,500,math.random(94,106))
end
else
local randomsound = math.random(1,6)
//make the sound
self:StopSound(self.idle1)
self:StopSound(self.idle2)
self:StopSound(self.idle3)
self:StopSound(self.idle4)
if randomsound == 1 then
self:EmitSound( self.attack1,500,math.random(94,106))
elseif randomsound == 2 then
self:EmitSound( self.attack2,500,math.random(94,106))
elseif randomsound == 3 then
self:EmitSound( self.attack3,500,math.random(94,106))
elseif randomsound == 4 then
self:EmitSound( self.attack4,500,math.random(94,106))
elseif randomsound == 5 then
self:EmitSound( self.attack5,500,math.random(94,106))
elseif randomsound == 6 then
self:EmitSound( self.attack6,500,math.random(94,106))
end
function ENT:InitSandbox()
if !self:GetSquad() then self:SetSquad(self:GetClass() .. "_sbsquad") end
if #ents.FindByClass("npc_cguard") == 1 && math.random(1,10) == 1 then
local cspSoundtrack = CreateSound(self, self.sSoundDir .. "music/combineguard_theme.mp3")
cspSoundtrack:SetSoundLevel(0.2)
cspSoundtrack:Play()
self:StopSoundOnDeath(cspSoundtrack)
end
end
self:EmitSound( "npc/combineguard/throw_grenade2.wav",500,math.random(94,106))
end
timer.Create( "melee_done_timer" .. self.Entity:EntIndex( ), 0.3, 1, setmeleefalse )
end
//---------------
local function tossgrenade()
local shoot_vector = (self:GetEnemy():GetPos() - self:GetPos())
shoot_vector:Normalize()
local rocket = ents.Create("grenade_frag")
rocket:SetPos(self:GetPos() + self:GetRight() * 10 + self:GetUp() * 50 + shoot_vector * 40)
rocket:SetAngles(shoot_vector:Angle())
rocket:Activate()
rocket:Spawn()
local phy = rocket:GetPhysicsObject()
if phy:IsValid() then
phy:ApplyForceCenter((shoot_vector * 1000))
end
[/code]
So... I Did Use A Little Strider Touch To Try The Warp Cannon... If Anybody Can Help Then It Would Be Appreciated.
And I Am £1£v£N So PLZ Dont Destroy Me With Get Out Comments....
you realize you are mixing lua with c++
[QUOTE=victormeriqui_1;32117503]you realize you are mixing lua with c++[/QUOTE]
*Facepalm - Okay... Change AGAIN
-----------------
Ok... Done
you need to learn how to code first, start with something small, simple.
Read this
[url]http://wiki.garrysmod.com/?title=Lua_Tutorial_Series[/url]
[QUOTE=victormeriqui_1;32117556]you need to learn how to code first, start with something small, simple.
Read this
[url]http://wiki.garrysmod.com/?title=Lua_Tutorial_Series[/url][/QUOTE]
Damn! (I Have Only Just Realised that a guard would be too advanced
Okay - I Am Making The Turok Scarface... Can I Make The Scarface Search For Herbivore Entities On A Map?
Sorry, you need to Log In to post a reply to this thread.