• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
So I can't use render.SetBlend or render.SetColorModulation?
[QUOTE=G4MB!T;52612001]Is it possible to use render.DrawQuad as an "overlay? Much like the "overlay"/"soft light" blend modes in photoshop.[/QUOTE] If you mean what I think you mean, you can use the 'multiply' [url=https://developer.valvesoftware.com/wiki/$detail#.24detailblendmode_.3Cint.3E]blend mode[/url] if you feel like starting to deal with the screen render target and stuff like that.
[QUOTE=NeatNit;52611481][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/CanSecondaryAttack]SWEP:CanSecondaryAttack[/url]? [b][i]1[/i][/b][/QUOTE] Thanks for that, I think it's getting me somewhere with [URL="http://wiki.garrysmod.com/page/WEAPON/CanPrimaryAttack"]http://wiki.garrysmod.com/page/WEAPON/CanPrimaryAttack[/URL], but I don't know how to incorporate it to actually function and prevent it from firing. I'll also need to be able to change it to still fire with 1 bullet left when it's in cqc mode. I tried this: [CODE] if self.Owner:KeyDown(IN_ATTACK) then SWEP.CanPrimaryFire(clip - 4) end[/CODE] But it just crashes my game when I fire in ranged mode. It's more so the difference between full and semi-auto, not a secondary attack. If the whole firemode code can help someone in diagnosing my problem, here you go (It's probably just me not knowing what to do, though): [CODE] function SWEP:CycleFiremodes() t = self.FireModes if not t.last then t.last = 2 else if not t[t.last + 1] then t.last = 1 else t.last = t.last + 1 end end if self.dt.State == CW_AIMING or self:isBipodDeployed() then if self.FireModes[t.last] == "safe" then t.last = 1 end end if self.FireMode != self.FireModes[t.last] and self.FireModes[t.last] then CT = CurTime() if IsFirstTimePredicted() then self:SelectFiremode(self.FireModes[t.last]) end self:SetNextPrimaryFire(CT + 1.05) self:SetNextSecondaryFire(CT + 1.05) self.ReloadWait = CT + 1.8 end if self.FireMode == "ranged" then self.ForegripParent = "ranged" clip = self:Clip1() cycle = 0.0 rate = 2 anim = "" prefix = "" suffix = "" self:sendWeaponAnim(prefix .. "changetosmg" .. suffix, rate, cycle) self.FireDelay = 1 self.AmmoPerShot = 5 self.Primary.Automatic = false self.ReloadSpeed = .9 if self.Owner:KeyDown(IN_ATTACK) then SWEP.CanPrimaryFire(clip - 4) end elseif self.FireMode == "cqc" then self.ForegripParent = "cqc" clip = self:Clip1() cycle = 0.0 rate = 2 anim = "" prefix = "" suffix = "" self:sendWeaponAnim(prefix .. "changetorifle" .. suffix, rate, cycle) self.FireDelay = 1/12 self.AmmoPerShot = 1 self.Primary.Automatic = true self.ReloadSpeed = 1.42 end -- I don't know what I'm doing end[/CODE]
[QUOTE=NeatNit;52612205]If you mean what I think you mean, you can use the 'multiply' [url=https://developer.valvesoftware.com/wiki/$detail#.24detailblendmode_.3Cint.3E]blend mode[/url] if you feel like starting to deal with the screen render target and stuff like that.[/QUOTE] Thanks I'll give it a go. New question, is it possible to use the render library to render a tiled material in 3d space?
[QUOTE=Fartnewgettz;52612238]Thanks for that, I think it's getting me somewhere with [URL="http://wiki.garrysmod.com/page/WEAPON/CanPrimaryAttack"]http://wiki.garrysmod.com/page/WEAPON/CanPrimaryAttack[/URL], but I don't know how to incorporate it to actually function and prevent it from firing. I'll also need to be able to change it to still fire with 1 bullet left when it's in cqc mode. I tried this: [CODE] if self.Owner:KeyDown(IN_ATTACK) then SWEP.CanPrimaryFire(clip - 4) end[/CODE] But it just crashes my game when I fire in ranged mode.[/QUOTE] No idea what you're doing there. You're not using the syntax right, CanPrimaryFire isn't even a function, but either way it makes no sense. I was thinking more like: [lua]function SWEP:CanSecondaryAttack() if ( self.Weapon:Clip1() < 5 ) then self.Weapon:EmitSound( "Weapon_Pistol.Empty" ) self.Weapon:SetNextSecondaryFire( CurTime() + 0.2 ) return false end return true end[/lua] literally the example from the wiki, but changed to use Clip1 instead of Clip2 and <5 instead of <=0. [editline]25th August 2017[/editline] [QUOTE=G4MB!T;52612253]Thanks I'll give it a go. New question, is it possible to use the render library to render a tiled material in 3d space?[/QUOTE] Yeah, but you have to mess with the material's scale with [url=https://developer.valvesoftware.com/wiki/$basetexturetransform#Additional_parameters]$basetexturetransform[/url] (using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/IMaterial/SetString]IMaterial:SetString[/url] or a custom material).
[QUOTE=NeatNit;52612313]No idea what you're doing there. You're not using the syntax right, CanPrimaryFire isn't even a function, but either way it makes no sense. [/QUOTE] I don't know what I'm doing either. I see the code you have, and it makes sense, I just don't know what to do with it to make it function. And what's the difference between this and using CanPrimaryAttack? I'm confused because both the semi and full-auto rely on the primary attack key, or is this so I can have the CanPrimaryAttack have it be for the full auto mode separately?
So, currently i'm trying to see if a player is behind a prop that can be in any angle and basically sort of in any direction. Basically this problem has two approaches. 1. Checking if the player is in a certain angle from the prop. 2. Checking if the player is in a square area predefined from the prop. Note, that again, this prop will be rotated and else. And, if my words aren't enough: [IMG]https://i.gyazo.com/92b0624cb4665c21b6f86c95c71f0d39.png[/IMG] Which of this two approaches would be the better one, and most optimized/easier to do? (currently i'm a noob when talking about doing things in 3D space) [EDITLINE]asdf[/EDITLINE] Found a way to do it.
When I holster my weapon, it won't reset my player speed back to normal. (Equipping it causes you to lose player speed and jump power) [CODE] function SWEP:Holster() if CLIENT and IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end if SERVER then self.Owner:SetWalkSpeed(250) self.Owner:SetRunSpeed(500) self.Owner:SetJumpPower(200) self.Owner:SetArmor(0) end return true end return true end[/CODE]
[QUOTE=Asian Aimbot;52613686]When I holster my weapon, it won't reset my player speed back to normal. (Equipping it causes you to lose player speed and jump power) [CODE] function SWEP:Holster() if CLIENT and IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end if SERVER then self.Owner:SetWalkSpeed(250) self.Owner:SetRunSpeed(500) self.Owner:SetJumpPower(200) self.Owner:SetArmor(0) end return true end return true end[/CODE][/QUOTE] Because you're making an if in which you're checking if the player is valid and if its being executed on the client, and then inside of that if you're checking if its in the server instance, making this statement always false as the first IF will only pass if its being executed on the server.
[QUOTE=geferon;52613732]Because you're making an if in which you're checking if the player is valid and if its being executed on the client, and then inside of that if you're checking if its in the server instance, making this statement always false as the first IF will only pass if its being executed on the server.[/QUOTE] I tried that earlier and it didn't work, but only because I did something else which broke SWEP:Holster. It works now, thank you very much!
Don't use Set*Speed in weapons. Instead, scale the speed in a [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Move]GM:Move[/url] hook with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CMoveData/SetMaxSpeed]CMoveData:SetMaxSpeed[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/CMoveData/SetMaxClientSpeed]CMoveData:SetMaxClientSpeed[/url] if the weapon is out.
[QUOTE=NeatNit;52612313]No idea what you're doing there. You're not using the syntax right, CanPrimaryFire isn't even a function, but either way it makes no sense. [/QUOTE] Thanks for trying to help. I decided to just make it so that when in ranged mode, if it has fewer than 5 bullets in it, it'll just forcefully unload it. It actually works quite well, and only slightly gets rid of the function of switching to cqc mode after that. Again, thanks for trying to put up with my incompetence, and have a good day. Now if only I could have it play the empty sound after unloading instead of constantly playing it until the reload finishes. [CODE]if self:Clip1() >= 5 then self.AmmoPerShot = 5 else self:unloadWeapon() end[/CODE] [B]Edit:[/B] Why did I have to put the AmmoPerShot in the if statement? That's dumb
Gday i am trying to make my HUD disappear when the scoreboard appears, on using GAMEMODE:ScoreboardShow/Hide it will either remove the scoreboard or show the default sandbox one. any help would be appreciated.
You could probably use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/HUDShouldDraw]GM:HUDShouldDraw[/url] and return false for CHudGMod when the scoreboard is open. This will only work t HUDs that use HUDPaint so if you were yo (for example) use this for PERP or old GMS then it wouldn't work since they hide the HUD and create vgui panels.
[CODE]function SWEP:Bash() local trace = self.Owner:GetEyeTrace(); if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 90 then if( trace.Entity:IsPlayer() or trace.Entity:IsNPC() or trace.Entity:GetClass()=="prop_ragdoll" ) then self.Owner:EmitSound("weapons/ar2/npc_ar2_altfire.wav"); util.ScreenShake( Vector(self.Owner:EyePos()) ), 1, 1, 3, 400 ); else self.Owner:EmitSound("weapons/ar2/npc_ar2_altfire.wav"); util.ScreenShake( Vector(self.Owner:EyePos()) ), 1, 1, 3, 400 ); end bullet = {} bullet.Num = 5 bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector(.07, .05, .03) bullet.Tracer = 0 bullet.Force = 500 bullet.Damage = painoose2 self.Owner:FireBullets(bullet) end end[/CODE] returns the errors [CODE] [ERROR] addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:625: unexpected symbol near ',' 1. unknown - addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:0 [ERROR] addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:625: unexpected symbol near ',' 1. unknown - addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:0 [Gaius Marius Quintilius|2|STEAM_0:0:91442540] Lua Error: [ERROR] addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:625: unexpected symbol near ',' 1. unknown - addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:0 [My Waifu|3|STEAM_0:0:59752963] Lua Error: [ERROR] addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:625: unexpected symbol near ',' 1. unknown - addons/gladius/lua/weapons/weapon_praetorian_gladius/shared.lua:0 [/CODE] help?
[del]Decimal values should start with 0. Change the bullet spread amd add a zero before each number[/del] I am dumb:P
@Gmod4Phun thats not a requirement nor the problem. The problem is that the bullet table is missing commas.
[QUOTE=G4MB!T;52616579]@Gmod4Phun thats not a requirement nor the problem. The problem is that the bullet table is missing commas.[/QUOTE] I'm a little blind (and very new to Lua) where am I missing them specifically?
You need to remove the extra ")" in util.ScreenShake. [editline]26th August 2017[/editline] util.ScreenShake( Vector(self.Owner:EyePos()) [B][U])[/U][/B], 1, 1, 3, 400 )
I am incorrect. @txike is correct.
[QUOTE=txike;52616588]You need to remove the extra ")" in util.ScreenShake. [editline]26th August 2017[/editline] util.ScreenShake( Vector(self.Owner:EyePos()) [B][U])[/U][/B], 1, 1, 3, 400 )[/QUOTE] Thank you all so much!
Hey. I'm kind of a newbie to porting models to this game, but I'm somewhat knowledgable of it thanks to my experience working with SFM for the exact same purpose. I've just set up all the joint collisions I want for my model in HLMV, and in the guide(s) I'm reading, it says to recompile after you've pasted the code from HLMV in your QC. To avoid messing everything up, though, I just want to quickly ask whether you need to recompile just the model(s) again, and/or the "Define Bones" box in Crowbar. I don't wanna accidentally mess up everything, is all. Thanks in advance.
[QUOTE=G4MB!T;52616579]@Gmod4Phun thats not a requirement nor the problem. The problem is that the bullet table is missing commas.[/QUOTE] I am surprised to hear this. Whenever I tried to use decimal values starting with a period, they always errored for me. I guess I learned a thing or two today
[QUOTE=Gmod4phun;52617993]I am surprised to hear this. Whenever I tried to use decimal values starting with a period, they always errored for me. I guess I learned a thing or two today[/QUOTE] ".X" works exactly the same as "0.X". [IMG]http://i.imgur.com/qAGqToL.png[/IMG]
Seems to be the case for a lot of programming languages. I write it like that all the time now
[QUOTE=txike;52618582]".X" works exactly the same as "0.X". [IMG]http://i.imgur.com/qAGqToL.png[/IMG][/QUOTE] I can see now. Tried myself, works like a charm. It was that one time I tried it and it failed horribly, probably I made some other mistake back then. Thanks for correcting me
I'd like to know how to draw over the skybox, I mean, there are 2 rendering hooks, but how in the world I draw a model/something on it? Hooks I talked about: [url]http://wiki.garrysmod.com/page/GM/PostDraw2DSkyBox[/url] [url]http://wiki.garrysmod.com/page/GM/PostDrawSkyBox[/url] My problem: (to avoid XY problem) I want to draw a model of a helicopter/airplane flying very high on the skybox, the model obviously wouldn't have any kind of collision, then upon meeting a coordinate on its path, it'd drop an airdrop which slowly transitions from skybox to world space real entity. Does skybox pos of the model will be correct just like offseting the model off the centre of the world?
Can not "hook" ulib hooks hello, im trying to sync my banlist, but i can't get the ulib hooks its on /addons/mysql/lua/autorun/server/test.lua [CODE] local function test( steamid, data ) print("now") PrintTable(data) end hook.Add("ULibPlayerBanned", "test", test) [/CODE] so if i ban someone, he is banned but the function above is not being called [B][U]solved: used outdated ulib[/U][/B]
[url]https://github.com/TeamUlysses/ulib/blob/e003c7bf9ffb8a4a7ef057a35f04c6ae8d942061/lua/ulib/server/player.lua#L288[/url] Looks like it's called to me -- make sure another ULibPlayerBanned hook isn't returning a value. [editline]28th August 2017[/editline] Just saw you solved, my bad.
a
Sorry, you need to Log In to post a reply to this thread.