I'm wondering if there's a way to get the details of a given render context while inside of a hook other than CalcView, such as [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostDrawTranslucentRenderables]GM:PostDrawTranslucentRenderables[/url]. Like, is there a native way to find out the camera's render origin, fov, etc... ?
So I'm trying to temporarily set the texture of a func_water_analog to something different. I tried Entity:SetMaterial() and Entity:SetSubMaterial() but they had no effect.
Is this possible to do?
[QUOTE=raubana;52604141]I'm wondering if there's a way to get the details of a given render context while inside of a hook other than CalcView, such as [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PostDrawTranslucentRenderables]GM:PostDrawTranslucentRenderables[/url]. Like, is there a native way to find out the camera's render origin, fov, etc... ?[/QUOTE]
Like calling:
[lua]
local camData = hook.Run("CalcView")
[/lua]
[QUOTE=gonzalolog;52605537]Like calling:
[lua]
local camData = hook.Run("CalcView")
[/lua][/QUOTE]
Would that work?! :shock:
How would I kill a player in a PlayerDeath hook (not the person who is dead)?
As in person A has died, so now person B has to die as well.
[QUOTE=Bings;52606282]How would I kill a player in a PlayerDeath hook (not the person who is dead)?
As in person A has died, so now person B has to die as well.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/Kill]Player:Kill[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/KillSilent]Player:KillSilent[/url]
[QUOTE=bigdogmat;52606305][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/Kill]Player:Kill[/url] or [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Player/KillSilent]Player:KillSilent[/url][/QUOTE]
Running player:Kill() in a PlayerDeath hook crashes the server (forgot to mention that!)
[QUOTE=Bings;52606524]Running player:Kill() in a PlayerDeath hook crashes the server (forgot to mention that!)[/QUOTE]
If you run it on the victim then yes because it'll cause an infinite loop, are you not wanting to kill the inflictor instead?
[editline]23rd August 2017[/editline]
Unless you are doing it to the inflictor, in which case you'll have to check for suicide.
I've been looking around the Internet for a long time now to see if anyone has made a Lopunny playermodel for Gmod, but the closest I've come to finding one is a model for Left 4 Dead 2. In the past I've tried to make one myself, but I came across way too many issues, probably due to the fact that I'm just too new to things like Blender to have even considered doing it myself in the first place.
I tried using the Model Manipulator to set a Lopunny ragdoll as my model, but it stayed in the normal "t-pose" position, and it honestly looked too ridiculous to even tolerate. I then tried to use PAC 3 to attach the Lopunny model to my character, but it ended up looking stretched and grotesque...
So basically, I would like to know if someone could possibly make a Lopunny playermodel for Gmod, then post it to the Workshop and send me the link? If so, I would really, really appreciate it...
[QUOTE=Barthallis;52606730]I've been looking around the Internet for a long time now to see if anyone has made a Lopunny playermodel for Gmod, but the closest I've come to finding one is a model for Left 4 Dead 2. In the past I've tried to make one myself, but I came across way too many issues, probably due to the fact that I'm just too new to things like Blender to have even considered doing it myself in the first place.
I tried using the Model Manipulator to set a Lopunny ragdoll as my model, but it stayed in the normal "t-pose" position, and it honestly looked too ridiculous to even tolerate. I then tried to use PAC 3 to attach the Lopunny model to my character, but it ended up looking stretched and grotesque...
So basically, I would like to know if someone could possibly make a Lopunny playermodel for Gmod, then post it to the Workshop and send me the link? If so, I would really, really appreciate it...[/QUOTE]
Ask in the modelling section.
[QUOTE=code_gs;52606797]Ask in the modelling section.[/QUOTE]
Which is where?
[QUOTE=Barthallis;52606809]Which is where?[/QUOTE]
[url]https://facepunch.com/forumdisplay.php?f=40[/url]
Front page..
[QUOTE=code_gs;52606817][url]https://facepunch.com/forumdisplay.php?f=40[/url]
Front page..[/QUOTE]
Sorry, I just made my Facepunch account today so I could request this. I have no idea where anything is.
[QUOTE=bigdogmat;52606611]If you run it on the victim then yes because it'll cause an infinite loop, are you not wanting to kill the inflictor instead?
[editline]23rd August 2017[/editline]
Unless you are doing it to the inflictor, in which case you'll have to check for suicide.[/QUOTE]
I'm defiantly running it on the right person (not the person who just died) but it's still crashing :(
[CODE]local hookIdentifier= "PlayerDeath"
hook.Add(hookIdentifier,"plzWorkNoaw",function(ply) -- mock up code
for _, v in pairs(player.GetAll()) do
if v != ply then -- so its not the player
if v:Alive() then -- so we know they are alive
v:Kill()
end
end
end
end)[/CODE]
Literally just whipped this code up and slapped it in a PlayerDeath hook but this will cause the server to crash. Its defintly not killing the dead player and its checking that they are alive
But that hook will be run every time you call Kill on a player, thus relooping, and Alive still returns true immediately after death.
I'm having trouble getting my SWEP to not fire when the ammo left in the magazine is between certain values in the CW 2.0 Base. In its secondary fire mode, it consumes 5 ammo per shot, and unless the mag has 5 shots in it on the last shot, it'll keep firing without the need for reloading and the magazine will continue into the negatives, then the primary mode can fire infinitely (with ammo in reserve) as well.
[QUOTE=raubana;52605691]Would that work?! :shock:[/QUOTE]
Eew, no!!
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyePos]EyePos[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyeAngles]EyeAngles[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyeVector]EyeVector[/url] (essentially EyeAngles in normal vector form)
As for FOV, I don't think there's an easy way (probably a 2-minute addition for the devs if you request it on Github), but you can hack it together with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/ScreenToVector]gui.ScreenToVector[/url].
7
[QUOTE=Fartnewgettz;52608422]I'm having trouble getting my SWEP to not fire when the ammo left in the magazine is between certain values in the CW 2.0 Base. In its secondary fire mode, it consumes 5 ammo per shot, and unless the mag has 5 shots in it on the last shot, it'll keep firing without the need for reloading and the magazine will continue into the negatives, then the primary mode can fire infinitely (with ammo in reserve) as well.[/QUOTE]
At a total guess, you need to check for ammo<=0, not just ammo==0.
Before secondary fire you should make sure you have at least 5 ammo left to shoot.
[QUOTE=NeatNit;52609025]Eew, no!!
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyePos]EyePos[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyeAngles]EyeAngles[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/EyeVector]EyeVector[/url] (essentially EyeAngles in normal vector form)
As for FOV, I don't think there's an easy way (probably a 2-minute addition for the devs if you request it on Github), but you can hack it together with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/ScreenToVector]gui.ScreenToVector[/url].
7[/QUOTE]
Eyepos and eyeangles returns the real value whenever calcview is modified?
[QUOTE=gonzalolog;52609052]Eyepos and eyeangles returns the real value whenever calcview is modified?[/QUOTE]
Yup. I just confirmed it in-game. This is literally their original purpose, and they are not supposed to be used anywhere else - see [url]https://github.com/Facepunch/garrysmod-issues/issues/2516#issuecomment-213853034[/url]
I added this to the wiki.
6
[QUOTE=Bings;52608006]I'm defiantly running it on the right person (not the person who just died) but it's still crashing :(
[CODE]local hookIdentifier= "PlayerDeath"
hook.Add(hookIdentifier,"plzWorkNoaw",function(ply) -- mock up code
for _, v in pairs(player.GetAll()) do
if v != ply then -- so its not the player
if v:Alive() then -- so we know they are alive
v:Kill()
end
end
end
end)[/CODE]
Literally just whipped this code up and slapped it in a PlayerDeath hook but this will cause the server to crash. Its defintly not killing the dead player and its checking that they are alive[/QUOTE]
this is causing a recursive loop
situation: 2 players on server
player 1 dies, triggers hook
hook kills player 2
player 2 is now dead, triggering hook
hook kills player 1
player 1 is now dead, triggering hook
hook kills player 2
player 2 is now dead, etc.
456
[QUOTE=MeepDarknessM;52609207]this is causing a recursive loop
situation: 2 players on server
player 1 dies, triggers hook
hook kills player 2
player 2 is now dead, triggering hook
hook kills player 1
player 1 is now dead, triggering hook
hook kills player 2
player 2 is now dead, etc.
456[/QUOTE]
I think the main problem is it isn't documented that Alive returns false in that hook: there's just a small note about PostPlayerDeath about being "100% dead".
43
[QUOTE=NeatNit;52609117]Yup. I just confirmed it in-game. This is literally their original purpose, and they are not supposed to be used anywhere else - see [url]https://github.com/Facepunch/garrysmod-issues/issues/2516#issuecomment-213853034[/url]
I added this to the wiki.
6[/QUOTE]
Holy shit, that's really useful! Thank you. Now to just figure out how to get the FOV.
[editline]24th August 2017[/editline]
[QUOTE=NeatNit;52609025]
As for FOV, I don't think there's an easy way (probably a 2-minute addition for the devs if you request it on Github), but you can hack it together with [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/ScreenToVector]gui.ScreenToVector[/url].
7[/QUOTE]
Oh.
Ok, [URL="https://github.com/Facepunch/garrysmod-requests/issues/1014"]request sent[/URL].
[editline]24th August 2017[/editline]
Also, just realized you're counting down to the point you finally get facepunch gold.
what's with the numbers?
78
[QUOTE=raubana;52609535]
Also, just realized you're counting down to the point you finally get facepunch gold.
[/QUOTE]
[QUOTE=>>oubliette<<;52609680]what's with the numbers?
78[/QUOTE]
Ignore that, it's nothing... :wink:
5
[QUOTE=Apickx;52609028]At a total guess, you need to check for ammo<=0, not just ammo==0.
Before secondary fire you should make sure you have at least 5 ammo left to shoot.[/QUOTE]
That's what I'm trying to do. Since both firemodes use the same magazine, not a secondary fire like a grenade launcher or anything, I'd think that it'd be as simple as this:
[CODE]
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
if clip <= 5 then
self:canFireWeapon(0)
end[/CODE]
But I don't know how to make it not fire the weapon, and I don't think it even recognizes when the mag has fewer than 5 bullets in it, as I can't make it do anything when it's <= 5.
[QUOTE=Fartnewgettz;52610277]That's what I'm trying to do. Since both firemodes use the same magazine, not a secondary fire like a grenade launcher or anything, I'd think that it'd be as simple as this:
[CODE]
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
if clip <= 5 then
self:canFireWeapon(0)
end[/CODE]
But I don't know how to make it not fire the weapon, and I don't think it even recognizes when the mag has fewer than 5 bullets in it, as I can't make it do anything when it's <= 5.[/QUOTE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/CanSecondaryAttack]SWEP:CanSecondaryAttack[/url]?
[b][i]1[/i][/b]
Is it possible to use render.DrawQuad as an "overlay? Much like the "overlay"/"soft light" blend modes in photoshop.
[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]
No, you'll probably have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/DrawSprite]render.DrawSprite[/url] to draw a VMT with [URL="https://developer.valvesoftware.com/w/index.php?title=$additive&redirect=no"]$additive[/URL] enabled, or maybe a [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/Material]Material[/url] if that has an additive parameter
Sorry, you need to Log In to post a reply to this thread.