• setting health to 210 and more damage
    14 replies, posted
I am making a hunter pill because I had one that has been done pretty badly so I am making my own because I love shooting people and overkilling Got everything down right, reload fires hunter flechettes primary attacks and secondary makes hunter sounds. One thing left, 210 health. Every hunter has 210 health and I want it so everytime you spawn the pill your health goes to 210. How is this done? Does it need to be done in the pill file or the weapon file (so I know what code to put here) Also, the hunter does a lot of damage with it normal attack. How do I make primary attack a lot stronger?
If it's a swep, you can try this: [b][url=wiki.garrysmod.com/?title=Entity.SetHealth]Entity.SetHealth [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] As far as damage goes, that should be fairly simplistic? Just change what ever your using as your damage, say a point hurt to X. Read a few tutorials and you'll get what I mean
It doesn't show up in the weapons list when I do that
Kinda simple isn't it? [lua] function SWEP:Deploy() self.Owner:SetHealth(210) end [/lua]
Oh I never put end. Thanks. But now the hunter doesn't show up. It shows me holding bugbait.
[QUOTE=Mixmaster1190;20027019]Oh I never put end. Thanks. But now the hunter doesn't show up. It shows me holding bugbait.[/QUOTE] You've overriden the weapon's Deploy hook that was turning you into a hunter in the first place, you should find it and add the health change line to it. Additionally if your pill is from a pill base the deploy hook might be defined in the base weapon so the simplest way would be to copy it over.
put the code in the pill base but it didn't work. The hunter works but the heath is still at 100 And pill damage? I have PILL.damage = 95. Doesn't seem to work because It takes 2 shots to kill an antlion, and I know antlions don't have more than 95 health.
if you want help, post the hunters base code here.
OK hunter weapons: pill base: if CLIENT then SWEP.PrintName = "Pill" SWEP.Slot = 0 SWEP.SlotPos = 5 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false function SWEP:DrawWeaponSelection(x, y, wide, tall, alpha) draw.SimpleText("j", "TitleFont", x + wide / 2, y + tall * 0.2, Color(255, 210, 0, 255), TEXT_ALIGN_CENTER) end else AddCSLuaFile("shared.lua") SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false end SWEP.Author = "mixmaster1190" SWEP.Contact = "" SWEP.Purpose = "" SWEP.Instructions = "" function SWEP:Deploy() self.Owner:SetHealth(210) end SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Primary.ClipSize, SWEP.Secondary.ClipSize = -1, -1 SWEP.Primary.DefaultClip, SWEP.Secondary.DefaultClip = -1, -1 SWEP.Primary.Automatic, SWEP.Primary.Automatic = false, false SWEP.Primary.Ammo, SWEP.Secondary.Ammo = "none", "none" SWEP.ViewModel = Model("models/weapons/v_bugbait.mdl") SWEP.WorldModel = Model("models/weapons/w_bugbait.mdl") function SWEP:Deploy() if CLIENT then return end if self.Owner.pill then self:Holster() end self.Owner.oldmodel = self.Owner:GetModel() local offset, length, type = string.find(self:GetClass(), "pill_(.+)") pills.Enable(self.Owner, type) self.Owner.pill:Effect() self.Owner:DrawWorldModel(false) self.Owner:SetHealth(210) self.Owner:DrawViewModel(false) timer.Create("viewmodel" .. self.Owner:UniqueID(), 0.01, 1, self.Owner.DrawViewModel, self.Owner, false) // so i use a timer return true end function SWEP:Holster() if CLIENT then return end if self.Owner.pill then self.Owner.pill:Effect() end pills.Disable(self.Owner) if self.Owner.oldmodel then self.Owner:SetModel(self.Owner.oldmodel) self.Owner.oldmodel = nil end self.Owner:DrawWorldModel(true) self.Owner:DrawViewModel(true) return true end function SWEP:PrimaryAttack() return false end function SWEP:SecondaryAttack() return false end function SWEP:Reload() return false end hunter weapon: AddCSLuaFile("shared.lua") SWEP.Base = "pill_base" SWEP.Author = "mixmaster1190" SWEP.PrintName = "Best Hunter Pill" SWEP.AdminSpawnable = true SWEP.Spawnable = true SWEP.Category = "Mixmaster1190" SWEP.DrawCrosshair = true local ShootSound = Sound( "NPC_Hunter.FlechetteShoot" ) function SWEP:Reload() local Forward = self.Owner:EyeAngles():Forward() local ent = ents.Create( "hunter_flechette" ) if ( ValidEntity( ent ) ) then ent:SetPos( self.Owner:GetShootPos() + Forward * 32 ) ent:SetAngles( self.Owner:EyeAngles() ) ent:Spawn() ent:SetVelocity( Forward * 2000 ) end ent:SetOwner( self.Owner ) end function SWEP:Deploy() self.Owner:SetHealth(210) end hunter pill: PILL.animations = { attack = random_sequence("meleeleft", "melee_02"), idle = "idle_2", run = "ACT_run", walk = "ACT_walk", } PILL.camera = {back = 45, z = 100} PILL.damage = 95 PILL.model = Model("models/hunter.mdl") PILL.sounds = { attack = Sound("NPC_Hunter.Alert"), attackHit = Sound("NPC_Hunter.MeleeHit"), attackMiss = Sound("Zombie.AttackMiss"), idle = Sound("NPC_Hunter.Idle") } PILL.speeds = {walking = 150, running = 610} function PILL:ChooseAnimation() if self.attacking or CurTime() <= self.attackingTimer then return nil end return self.base.ChooseAnimation(self) end function PILL:Enabled() self.attacking = false self.attackingTimer = 0 self.idleTimer = 0 self.base.Enabled(self) end function PILL:KeyPress(key) if key == IN_ATTACK and not attacking and CurTime() > self.attackingTimer then self.attacking = true self.attackingTimer = CurTime() + 0.7 self:ForceAnimation("attack", 1) elseif key == IN_ATTACK2 then if CurTime() > self.idleTimer then self.idleTimer = CurTime() + 2 self.player:EmitSound(self.sounds.idle) end end end function PILL:Think() if self.attacking and CurTime() > self.attackingTimer then self.attacking = false self.attackingTimer = self.attackingTimer + 0.3 if self:Melee(self.player:GetShootPos(), self.player:GetAimVector(), 50, Vector(-8, -8, -8), Vector(8, 8, 8), 15, "BloodImpact") then self.player:EmitSound(self.sounds.attackHit) else self.player:EmitSound(self.sounds.attackMiss) end end self.base.Think(self) end
is this possible?
EDit* maybe because your not returning true in your hunters deploy function. try using code tags to seperate your different files.
There is no easy way to change the damage because it is dealt trough spawned hunter_flechette entities. To effectively change it you would probably need to change the flechette damage convar if you don't mind the damage being changed for regular hunters or tag the flechettes manually and use damage hooks to change it when it is dealt.
I don't want the flechettes to have more damage, just when you attack
I tried making a hunter pill once, I pretty much had it working too. Just the animations for the hunter didn't work.
Help?
Sorry, you need to Log In to post a reply to this thread.