• Problems That Don't Need Their Own Thread v5
    4,111 replies, posted
[QUOTE=Benn20002;52396395]Do you mean I should use both hooks or just PostDrawOpaqueRenderables? I am currently only using PostDrawOpaqueRenderables.[/QUOTE] Try using both. Or try switching it to the translucent. Doing both will be the same effect as setting the rendergroup of an entity to RENDERGROUP_BOTH (i think)
Okay. For my door display its working fine with PostDrawTranslucentRenderables. But I just noticed I am using PostPlayerDraw for the TargetID (Didn't had that in mind as I just looked up which hook I am using in the door thing as I thought it was the same). I also tried using PrePlayerDraw but that doesnt work aswell (I think its a little bit better for performance if I use a PlayerDraw hook than looping through all players in PostDrawTranslucentRenderables.
[QUOTE=Benn20002;52396418]Okay. For my door display its working fine with PostDrawTranslucentRenderables. But I just noticed I am using PostPlayerDraw for the TargetID (Didn't had that in mind as I just looked up which hook I am using in the door thing as I thought it was the same). I also tried using PrePlayerDraw but that doesnt work aswell (I think its a little bit better for performance if I use a PlayerDraw hook than [B]looping through all players in PostDrawTranslucentRenderables.[/B][/QUOTE] Then in this case, just as you said you should try doing that
Am I crazy or is TTTEndRound not called if the time limit is reached?
I am trying to make code that checks if players steamid and if its that and that persons text color chances can someone point out right direction?
[QUOTE=RasmusG5;52396538]I am trying to make code that checks if players steamid and if its that and that persons text color chances can someone point out right direction?[/QUOTE] I think you'd have to make a custom chatbox. [editline]24th June 2017[/editline] [QUOTE=JasonMan34;52396499]Am I crazy or is TTTEndRound not called if the time limit is reached?[/QUOTE] It has to be for proper round end procedures to occur. Make sure you don't have an addon returning in the hook.
NPC's will notice a player's attack even if there's no sound. How can I suppress this? How can I make, for instance, a silenced pistol that doesn't alert NPC's? Maybe I suck at research but I can't find a solution anywhere I look!
[QUOTE=DarkDragonLov;52396898]NPC's will notice a player's attack even if there's no sound. How can I suppress this? How can I make, for instance, a silenced pistol that doesn't alert NPC's? Maybe I suck at research but I can't find a solution anywhere I look![/QUOTE] You'll have to create your own custom FireBullets function. Add me on Steam if you need specific help on this.
Long story short, I'm trying to make a scripted entity that spawns several props and moves them from point A to point B when a function is called. I've achieved this using Ent:SetPos() in a think hook but it's very laggy. How can I smooth the movement in a multiplayer game? Here's some simplified example code of what I did: [lua] function ENT:Initialize() self.base = ents.Create("prop_physics") self.base:SetModel("models/hunter/blocks/cube4x4x025.mdl") self.base:SetPos(self:GetPos() + Vector(0,0,20)) self.base:Spawn() timer.Simple(0.1, function() self.base:DropToFloor() self.tier2 = ents.Create("prop_physics") self.tier2:SetModel("models/hunter/blocks/cube3x3x025.mdl") self.tier2:SetPos(self.base:GetPos() + Vector(x, y, 12.299916887283)) self.tier2:Spawn end) end function testslide() tier2:SetPos( base:GetPos() + Vector(x,y, 12.299916887283) ) -- 11.899916887283 originally tier2:SetAngles(base:GetAngles()) end hook.Add("Think", "testslide", testslide) [/lua]
1. Check the validity of self.base before using it in a timer. 2. That code shouldn't work because base, x, y, and tier are all undefined variables. Also, why not use the entity's think method instead of a hook? 3. You can use [url]https://wiki.garrysmod.com/page/PhysObj/UpdateShadow[/url] for smooth movement.
Is there any way to redirect all my old links: [url]www.github.com/Mysterypancake1[/url] To this: [url]www.github.com/MysteryPancake[/url] I know GitHub should set up redirects but I don't trust it, and whenever I try to search for posts containing that string, it won't let me.
[QUOTE=MPan1;52398006]Is there any way to redirect all my old links: [url]www.github.com/Mysterypancake1[/url] To this: [url]www.github.com/MysteryPancake[/url] I know GitHub should set up redirects but I don't trust it, and whenever I try to search for posts containing that string, it won't let me.[/QUOTE] No, the most you could do is make another MysteryPancakes1 account if it'd let you and post links to your new profile.
I'm not sure if I'm missing something but I'm trying to replace a 'fake' window on a map (part of the worldspawn) with a 'real' one. So far, my results have been...disappointing. [t]https://i.imgur.com/9LIfZiI.jpg[/t] I'm replacing the texture with that of an actual texture elsewhere on the map that is a 'real' window. I'm grabbing the material from GetEyeTrace().HitTexture and replacing it with my desired texture. Am I missing something or is this just a limitation of the source engine?
[QUOTE=code_gs;52398000]1. Check the validity of self.base before using it in a timer. 2. That code shouldn't work because base, x, y, and tier are all undefined variables. Also, why not use the entity's think method instead of a hook? 3. You can use [URL]https://wiki.garrysmod.com/page/PhysObj/UpdateShadow[/URL] for smooth movement.[/QUOTE] Good call on the validity but the x and y variables are just example code i ripped out. They're defined as floats in my actual code but I just need to know what other hook I should put this in or some alternative to increase framerate. I'll try the updateshadow method but should I be doing something in ENT:Draw() or something? I feel like I'm doing this wrong. A bit of background is in order I think. I tried the ENT:Think() hook beforehand but the fps was even lower than the server hook so I used the latter again. I tested my code originally in singleplayer and it was full fps until I tried it in multiplayer. EDIT: Tried updateshadow, didn't work.
[CODE]hook.Add("OnKillStreakChange", "player_KillstreakChange", function(pl, newNum) print("Player: "..pl:Nick()); print("Killstreak: "..newNum); end) local _R = debug.getregistry(); local PLAYER = _R.Player; function PLAYER:GetKillStreak() // Use this function to see how many kills a user currently killstreak is. return (CLIENT && self:GetNWInt("kill_streak", 0)) || self.kill_streak; end if(SERVER)then function PLAYER:SetKillStreak(num) self.kill_streak = num; self:SetNWInt("kill_streak", num); // This is for clientside stuff. hook.Call("OnKillStreakChange", nil, self, num); end end hook.Add("PlayerDeath", "kill_streak_counter", function(victim, _, attacker) victim:SetKillStreak(0); // Reset the person who died kill streak to 0. if(victim != attacker && attacker:IsValid() && attacker:IsPlayer())then // Wasn't suicide attacker.SetKillStreak(attacker:GetKillStreak() + 1); end end) [/CODE] This code is giving me this error. [CODE][ERROR] addons/manlykillstreaks/lua/autorun/server/sv_manlykillstreaks.lua:27: attempt to perform arithmetic on a nil value 1. v - addons/manlykillstreaks/lua/autorun/server/sv_manlykillstreaks.lua:27 2. unknown - lua/includes/modules/hook.lua:84 3. FireBullets - [C]:-1 4. ShootBullet - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:316 5. PrimaryAttack - gamemodes/terrortown/entities/weapons/weapon_tttbase.lua:240 6. unknown - gamemodes/terrortown/entities/weapons/weapon_zm_rifle.lua:60 [/CODE]
Player.kill_streak is nil before you call SetKillStreak. Add "|| 0" at the end of your GetKillStreak func.
[QUOTE=code_gs;52399109]Player.kill_streak is nil before you call SetKillStreak. Add "|| 0" at the end of your GetKillStreak func.[/QUOTE] Okay, after doing that I now have this issue. [CODE][ERROR] addons/manlykillstreaks/lua/autorun/server/sv_manlykillstreaks.lua:16: attempt to index local 'self' (a number value) 1. SetKillStreak - addons/manlykillstreaks/lua/autorun/server/sv_manlykillstreaks.lua:16 2. v - addons/manlykillstreaks/lua/autorun/server/sv_manlykillstreaks.lua:26 [/CODE] EDIT: I figured it out :) Needed to change attacker.SetKillStreak to attacker:SetKillStreak
[QUOTE=Banana Lord.;52398128]I'm not sure if I'm missing something but I'm trying to replace a 'fake' window on a map (part of the worldspawn) with a 'real' one. So far, my results have been...disappointing. [t]https://i.imgur.com/9LIfZiI.jpg[/t] I'm replacing the texture with that of an actual texture elsewhere on the map that is a 'real' window. I'm grabbing the material from GetEyeTrace().HitTexture and replacing it with my desired texture. Am I missing something or is this just a limitation of the source engine?[/QUOTE] Got any code? Windows should be fairly simple - just a translucent texture/material. I think the biggest problem is changing part of the map from Lua, and I can't think of an easy way to do that. Stencils would work, but surely there's an easier way...
[QUOTE=NeatNit;52399308]Got any code? Windows should be fairly simple - just a translucent texture/material. I think the biggest problem is changing part of the map from Lua, and I can't think of an easy way to do that. Stencils would work, but surely there's an easier way...[/QUOTE] [lua]hook.Add("InitPostEntity", "map.updateTextures", function() local objOldMaterial = Material("maps/gm_floatingworlds_3/metal/metalwall070h_591_-3549_131") local objNewMaterial = Material("WINDOWS_LIT/FACTORYWINDOW_LIT") objOldMaterial:SetTexture("$basetexture", objNewMaterial:GetTexture("$basetexture")) end)[/lua] That code gives me this: [t]https://i.imgur.com/KIiChuY.jpg[/t] And if I pull all of the key-value pairs off of the actual glass and apply it to the old texture, I get the screenshot I originally posted. It's almost like because the map wasn't compiled with that window as see-through, it won't render correctly by just swapping the texture.
You are trying to do something you can't do without recompiling the map or MAYBE using stencils. What you are seeing on the original screenshot is the optimizations made by the compiler when the map is compiled. You can't just simply change the texture to be transparent and expect a window to magically appear and render properly.
[QUOTE=Robotboy655;52400015]You are trying to do something you can't do without recompiling the map or MAYBE using stencils. What you are seeing on the original screenshot is the optimizations made by the compiler when the map is compiled. You can't just simply change the texture to be transparent and expect a window to magically appear and render properly.[/QUOTE] So yes, it is a Source engine limitation. Thanks.
[QUOTE=Robotboy655;52400015]You are trying to do something you can't do without recompiling the map or MAYBE using stencils. What you are seeing on the original screenshot is the optimizations made by the compiler when the map is compiled. You can't just simply change the texture to be transparent and expect a window to magically appear and render properly.[/QUOTE] Could you not add a PVS point outside of the window if the player is looking at it? That would surely cause the visleafs to draw.
[QUOTE=code_gs;52400274]Could you not add a PVS point outside of the window if the player is looking at it? That would surely cause the visleafs to draw.[/QUOTE] Even if that would work, there is still no window frame and that will allow you to see through walls/look into the void.
[QUOTE=Robotboy655;52400690]Even if that would work, there is still no window frame and that will allow you to see through walls/look into the void.[/QUOTE] Just fake it by putting a render target or some stencils over it. [editline]25th June 2017[/editline] Or even clip planes
[QUOTE=code_gs;52400699]Just fake it by putting a render target or some stencils over it. [editline]25th June 2017[/editline] Or even clip planes[/QUOTE] No idea how render targets or clip planes are going to help, but yes, a stencil + some rendering may solve that specific issue.
[QUOTE=Robotboy655;52400890]No idea how render targets or clip planes are going to help, but yes, a stencil + some rendering may solve that specific issue.[/QUOTE] You could overlay the view behind the wall as the window's texture. Nevermind about clip planes
I found some cool text effects made by Moat, only problem is I'm having trouble using, would someone mind showing me an example? [CODE]local next_electric_effect = CurTime() + 0 local electric_effect_a = 0 function DrawElectricText(intensity, text, font, x, y, color, xalign, yalign) local xalign = xalign or TEXT_ALIGN_LEFT local yalign = yalign or TEXT_ALIGN_TOP local charw, charh = surface.GetTextSize(text) draw.SimpleText(text, font, x, y, color, xalign, yalign) if (electric_effect_a > 0) then electric_effect_a = electric_effect_a - (1000 * FrameTime()) end surface.SetDrawColor(102, 255, 255, electric_effect_a) for i = 1, math.random(5) do line_x = math.random(charw) line_y = math.random(charh) line_x2 = math.random(charw) line_y2 = math.random(charh) surface.DrawLine(x + line_x, y + line_y, x + line_x2, y + line_y2) end local effect_min = 0.5 + (1 - intensity) local effect_max = 1.5 + (1 - intensity) if (next_electric_effect <= CurTime()) then next_electric_effect = CurTime() + math.Rand(effect_min, effect_max) electric_effect_a = 255 end end [/CODE]
[QUOTE=Meninist;52401745]I found some cool text effects made by Moat, only problem is I'm having trouble using, would someone mind showing me an example?[/QUOTE] It looks like intensity is supposed to be a decimal from 0-1. The rest of the args are explained here: [url]https://wiki.garrysmod.com/page/draw/SimpleText[/url]
can someone point out right direction how i could make entities spawn on cordinates on server start
How do i make the player spawn with sandbox chosen model? (my gamemode base is sandbox) Where is that event hooked to cuz i may have overrided the PlayerIntinialSpawn and PlayerSpawn
Sorry, you need to Log In to post a reply to this thread.