• Problems That Don't Need Their Own Thread v2.0
    5,020 replies, posted
[QUOTE=_Entity;46842403]-stuff-[/QUOTE] You're redefining the Upgrade table, wiping it/overwriting it.
[QUOTE=Atebite;46843261]You're redefining the Upgrade table, wiping it/overwriting it.[/QUOTE] That's what I was thinking but I'm not sure how to fix this?
On my serverside script I do ply.Bleeding = true, but on my clientside script when i'm doing LocalPlayer().Bleeding it returns null. How can I fix such thing?
[QUOTE=RedNinja;46844368]On my serverside script I do ply.Bleeding = true, but on my clientside script when i'm doing LocalPlayer().Bleeding it returns null. How can I fix such thing?[/QUOTE] [url]http://wiki.garrysmod.com/page/Entity/SetNWBool[/url] would be the easiest, but you could also use net [url]http://wiki.garrysmod.com/page/Category:net[/url]
[QUOTE=_Entity;46843860]That's what I was thinking but I'm not sure how to fix this?[/QUOTE] Make a table to hold all your upgrade tables, then iterate through that instead. Personally, I think making metatables for the upgrades would be a good idea, but that's entirely up to you.
[QUOTE=Pandaman09;46844423][url]http://wiki.garrysmod.com/page/Entity/SetNWBool[/url] would be the easiest, but you could also use net [url]http://wiki.garrysmod.com/page/Category:net[/url][/QUOTE] [QUOTE=RedNinja;46844368]On my serverside script I do ply.Bleeding = true, but on my clientside script when i'm doing LocalPlayer().Bleeding it returns null. How can I fix such thing?[/QUOTE] With the current state of GMod I'd recommend using net; or NWVar with caching as GetNW* always refreshes. Examples: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/gm_functions_and_hooks/gm_preplayerdraw_making_players_invisible.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/tracking_players/entity_setowner_and_getowner_rewrite.lua.html[/url] [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/tracking_players/player_cached_group.lua.html[/url] Basically, when you update it you update the NW Var, no worries. The only thing that changes is when you Get the NW Var you assign it to a variable and assign a time to another var. If the var doesn't exist OR CurTime( ) - timevar > cache_time THEN you can set the var and the time var... Next, outside of that if you return the var instead of the GetNW.. What this does is ensure that GetNW* doesn't ask the server for an update on the variable except every few seconds or so. I used to use NWVars in my vehicle lighting system, getting rid of them and replacing them with my flag system ( networking system which doesn't update the client unless the variable has changed ) decreased cost of execution by around 50%... By caching you can expect the same performance gain except every now and again it'll update even if the variable hasn't changed.
Any idea how to draw a bleeding animation on a player's screen? like a red overlay and then make it fade. For example when you are hit. And how could I make the screens blurier?
Depends on the exact effect but if you want something to fade in an out, use math.sin and math.abs to prevent the - values... so: local _fade = math.abs( math.sin( CurTime( ) * _speed ) ) * _height; -- where _speed is how fast you want it to fade in and out ( multiplier, 1 or greater, or less ), and _height being 255 if you want it to go fully invisible, or a lesser number with the remainder as the default so: Color( 255, 255, 255, x + _fade ); where x is the remainder ( minimum value to prevent completely fading out )...
[QUOTE=Acecool;46847099]Depends on the exact effect but if you want something to fade in an out, use math.sin and math.abs to prevent the - values... so: local _fade = math.abs( math.sin( CurTime( ) * _speed ) ) * _height; -- where _speed is how fast you want it to fade in and out ( multiplier, 1 or greater, or less ), and _height being 255 if you want it to go fully invisible, or a lesser number with the remainder as the default so: Color( 255, 255, 255, x + _fade ); where x is the remainder ( minimum value to prevent completely fading out )...[/QUOTE] Hm, I actually meant the default source engine effect, like when you get shot, or when entering poisonous water just in red.
Ah, the hitmarkers? If you apply _p:TakeDamageInfo( _dmginfo ) to the player then those will show up ( along with a screen effect depending on the damage-type ). If none of the defaults work you'd need to make the effect yourself ( you could draw Textured Rect over the entire screen with low alpha and fade it in / out ). There is a blur screen function but I've never gotten it to work in an efficient way so it'd be easier to make a custom glass texture for the blur instead of using loops to do the blur-screen ( Unless I'm blurring incorrectly ).
[QUOTE=Acecool;46847139]Ah, the hitmarkers? If you apply _p:TakeDamageInfo( _dmginfo ) to the player then those will show up ( along with a screen effect depending on the damage-type ). If none of the defaults work you'd need to make the effect yourself ( you could draw Textured Rect over the entire screen with low alpha and fade it in / out ). There is a blur screen function but I've never gotten it to work in an efficient way so it'd be easier to make a custom glass texture for the blur instead of using loops to do the blur-screen ( Unless I'm blurring incorrectly ).[/QUOTE] How do I create my own damage info and make it like show a red screen? I'm using the PlayerHurt hook, I dont get any info but the damage (integer)
Don't do it in PlayerHurt ( applying the damage ); for a bleeding mod, you could set it up when the player is hurt but then apply the damage a different way and don't allow double-bleeds. Here's an example of a take-damage-info system / bleeding system... [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/takedamageinfo_example.lua.html[/url] There, on Entity Take Damage there is a 40% chance to start bleeding. The Bleed function creates a timer named <uniqueid>_bleeding to make it easier to find ( should've used EntIndex or whatever... ). For the timer to be destroyed the accumulative blood loss must be the amount the player was supposed to lose when it was created ( there should be protection before the timer.Create to prevent the bleeding from happening if already bleeding ), then every delay seconds it creates a DamageInfo and applies the attributes and tallies up the blood loss. Hopefully it helps.
[QUOTE=Acecool;46847181]Don't do it in PlayerHurt ( applying the damage ); for a bleeding mod, you could set it up when the player is hurt but then apply the damage a different way and don't allow double-bleeds. Here's an example of a take-damage-info system / bleeding system... [URL]https://dl.dropboxusercontent.com/u/26074909/tutoring/takedamageinfo_example.lua.html[/URL] There, on Entity Take Damage there is a 40% chance to start bleeding. The Bleed function creates a timer named <uniqueid>_bleeding to make it easier to find ( should've used EntIndex or whatever... ). For the timer to be destroyed the accumulative blood loss must be the amount the player was supposed to lose when it was created ( there should be protection before the timer.Create to prevent the bleeding from happening if already bleeding ), then every delay seconds it creates a DamageInfo and applies the attributes and tallies up the blood loss. Hopefully it helps.[/QUOTE] No worries. I have used an NWBool to protect from double bleeding. Thanks buddy!
is there a smarter way to make something run after 5mins than using [code]Timer.Simple(300, function() blabla end)[/code] this timer is sepeate from player to player.
Ahhmmm... halp? [code] [M9K Heavy Weapons] lua/weapons/bobs_gun_base/shared.lua:920: attempt to index field 'Owner' (a nil value) 1. unknown - lua/weapons/bobs_gun_base/shared.lua:920 [ERROR] gamemodes/base/entities/weapons/weapon_base/sh_anim.lua:74: attempt to index field 'Owner' (a nil value) 1. unknown - gamemodes/base/entities/weapons/weapon_base/sh_anim.lua:74 2. TranslateWeaponActivity - [C]:-1 3. unknown - gamemodes/base/gamemode/animations.lua:325 [/code] Gamemode is derived from base.
[QUOTE=Lizart;46847615]is there a smarter way to make something run after 5mins than using [code]Timer.Simple(300, function() blabla end)[/code] this timer is sepeate from player to player.[/QUOTE] Timers are pretty straight-forward and they run when you want them to. You could do the same thing in a Think hook by waiting until it is time to execute, then execute and remove the hook. Timers are good ( aside from the current failing issue every now and again ). [editline]3rd January 2015[/editline] [QUOTE=riekelt;46847639]Ahhmmm... halp? [code] [M9K Heavy Weapons] lua/weapons/bobs_gun_base/shared.lua:920: attempt to index field 'Owner' (a nil value) 1. unknown - lua/weapons/bobs_gun_base/shared.lua:920 [ERROR] gamemodes/base/entities/weapons/weapon_base/sh_anim.lua:74: attempt to index field 'Owner' (a nil value) 1. unknown - gamemodes/base/entities/weapons/weapon_base/sh_anim.lua:74 2. TranslateWeaponActivity - [C]:-1 3. unknown - gamemodes/base/gamemode/animations.lua:325 [/code] Gamemode is derived from base.[/QUOTE] self.Owner may not be initialized yet... I'd say add an if ( !IsValid( self.Owner ) ) then return; end in the animation, etc functions..
[QUOTE=Acecool;46847725]Timers are pretty straight-forward and they run when you want them to. You could do the same thing in a Think hook by waiting until it is time to execute, then execute and remove the hook. Timers are good ( aside from the current failing issue every now and again ). [editline]3rd January 2015[/editline] self.Owner may not be initialized yet... I'd say add an if ( !IsValid( self.Owner ) ) then return; end in the animation, etc functions..[/QUOTE] The thing is it happens with any weapon except from the Physgun and Physcannon.
So the error happens on SWEPs? HL2 weapons are normal without errors ( which is to be expected except some functions don't exist in their space )? Show us this sh_anim.lua file and shared if you can, or at least a few lines before, the line causing the issue and a few lines after. self.Owner may be getting overwritten, or something else may be happening.
I can't seem to get TexturedRectRotated to rotate how I wish... I made this guy in Paint.net and I have his arms as a second image so they can be rotated but Gmod's rotated texture function accepts X and Y as the center of the image which doesn't work for what I want. Is it possible to make a 2d moving arm in Gmod or should I just try a top down approach instead? Cause I am terrible at graphic design and pretty proud of this [t]http://i.gyazo.com/28a87d311a1fa79975ae8410432b5e7b.png[/t][t]http://i.gyazo.com/04208f32d489766916d51a59e7cd30eb.png[/t] [t]http://i.gyazo.com/e9d36746fe3542df5385dfef14d95703.png[/t] [code] objects.PlayerArm = vgui.Create("DPanel", screen) objects.PlayerArm:SetSize( 32, 32 ) objects.PlayerArm.Paint = function( self, w, h ) --draw.RoundedBox(0, 0, 0, w, h, color_white ) surface.SetDrawColor( color_white ) surface.SetMaterial( img_player_arm ) --surface.DrawTexturedRect( 0, 0, w, h ) surface.DrawTexturedRectRotated( w/2, h/2, w, w/2, 45 ) end objects.PlayerArm.Think = function( self ) local x, y = objects.Player:GetPos() self:SetPos( x + 5, y + 20 ) end [/code]
Make the image twice as wide :v:
I can't seem to move or remove point_ entities. Particularly point_spotlight: [LUA] if self.headlight and self.headlight:IsValid() then print("removing") -- runs self.headlight:Input("LightOff", self.headlight, self.headlight, 1) -- turns off the light self.headlight:Input("Kill", self.headlight, self.headlight, 1) -- does nothing self.headlight:Remove() -- does nothing print(tostring(self.headlight)) -- prints Entity [148][point_spotlight] end [/LUA] Parenting the entity to another has a weird effect. The initial light animation does not move at all (just remains in midair where it spawned), but the actual dynamic light does move. If I point the parent at a wall, it lights up as if the light is also pointing at it. Neither is removed by :Remove() or :Input("Kill").
I'm not too sure on how to properly rotate this in order to make the barrel face my true eye angles. I've tried a few different methods like rotating eye angles in CalcViewModelView hook and returning my new values but I don't notice any changes. [media]http://www.youtube.com/watch?v=8pXFNx0ln-k&feature=youtu.be[/media]
[QUOTE=Goz3rr;46849107]Make the image twice as wide :v:[/QUOTE] I know someone rated you dumb, but it worked! Thanks a lot
[QUOTE=Commander11;46849451]I'm not too sure on how to properly rotate this in order to make the barrel face my true eye angles. I've tried a few different methods like rotating eye angles in CalcViewModelView hook and returning my new values but I don't notice any changes. [media]http://www.youtube.com/watch?v=8pXFNx0ln-k&feature=youtu.be[/media][/QUOTE] I don't wanna sound like a dick but, if you can't even manage to properly do barrel esp, you shouldn't attempt cheating, and rather attempt to create other stuff instead.
[QUOTE=Leystryku;46849960]I don't wanna sound like a dick but, if you can't even manage to properly do barrel esp, you shouldn't attempt cheating, and rather attempt to create other stuff instead.[/QUOTE] [code]viewmodel:GetAttachment(1).Pos[/code] What makes you feel that I'm cheating, I'm asking for help. Beside, Blacktea had recommended I look at how they manipulate the viewmodel for holstering and I did. I know now what to do in order to rotate my model however I'm not sure how I should use my variables, I'm terrible with math so I was hoping I could get some help with some angles.
Don't draw towards where your eye angles are pointing. Just draw from the attachment's position to the center of the screen.
[QUOTE=sasherz;46850362]Don't draw towards where your eye angles are pointing. Just draw from the attachment's position to the center of the screen.[/QUOTE] I appreciate your input and as valuable as it is, this does nothing to solve my issue.
Do files in lua/effects need to be AddCSLuaFile()'d or are they automatically sent (and loaded)?
[QUOTE=wh1t3rabbit;46850913]Do files in lua/effects need to be AddCSLuaFile()'d or are they automatically sent (and loaded)?[/QUOTE] Pretty much ANYTHING you want the client to run, needs to be AddCSLuaFile'ed. On another note, Is there a way to make an addon only work on set gamemodes? eg I've a TTT addon with weapons etc, and i need it when testing ttt related stuff, but I'm often testing for other gamemodes too, is there a way i can make this addon just not run if i'm in a non ttt gamemode? Just hoping theres something that means i don't need to move the folder in or out each time i want to test something different.
engine.ActiveGamemode(). Or you could check if a gamemode specific global variable exists
Sorry, you need to Log In to post a reply to this thread.