• What do you need help with V4
    639 replies, posted
[QUOTE=Drakehawke;35122494]What's a better MySQL module to use? tmysql or mysqloo?[/QUOTE] From my experience, I feel that mysqloo is much more thought through with the functions and such, but yeah, personal preference.
[QUOTE=JustSoFaded;35128952]If it were %25 visibility then he would want SetColor(255, 255, 255, 65). Since ~63 is a 4rth of 255 (255 being maximum alpha)[/QUOTE] Or you could do SetColor(255, 255, 255, 255*0.25)
I'm trying to create a mouse-aimed turret entity, that has a 'base' that the 'turret' is permanently attached to regardless of orientation or position. How can I do this? I have the turret part tracking mouse, I just don't know how to bolt it onto the base. In the images, red is base, green is turret. Hope they illustrate my dumb problem reasonably well. [url]http://i55.tinypic.com/34zk3v6.png[/url] [url]http://i54.tinypic.com/16iwcv7.png[/url] [url]http://i53.tinypic.com/2u540g8.png[/url]
Just set the angles of the turret and not of the base?
I mean, how do I get the turret to stick with the base when I move it about.
turret:SetPos(base:GetPos() + base:GetUp() * 200) and that in a think I suppose.
Stuck again. I've made the base as a separate entity, but I can't figure how to make it spawn when I spawn the turret. Also, how do I make the turret know what I'm talking about when I say base:DoStuff()? Or is there a different way I should be doing the base all together?
You could spawn the other entity in the ENT.Initialize() function of either the turret or the base. That would also allow you to communicate between the two. So if this is my base code: [lua]ENT.Turret = nil function ENT:Initialize() self.Turret = ents.Create( "turret_entity_name" ) end function ENT:DoStuff() self.Turret:DoStuff() end[/lua] That would create the turret entity and have it call the function "DoStuff" whenever it is called on the base. If you want them to interact both ways, you can also set a variable on the turret back to the base in the initialize function, like this: [lua]function ENT:Initialize() self.Turret = ents.Create( "turret_entity_name" ) self.Turret.Base = self end[/lua] [b]Edit:[/b] Fixed being terrible.
[s]It just keeps telling me "attempt to index global 'ENT' (a nil value)" on the line ENT.Turret = ents.create.... no matter how much I tinker with it, what am I doing wrong?[/s] I am a potato.
You're not doing it wrong. People are giving you incorrect code. [QUOTE=Nerdeboy;35138627] [lua] function ENT:Initialize() self.Turret = ents.Create( "turret_entity_name" ) end function ENT:DoStuff() self.Turret:DoStuff() end[/lua] That would create the turret entity and have it call the function "DoStuff" whenever it is called on the base. If you want them to interact both ways, you can also set a variable on the turret back to the base in the initialize function, like this: [lua]function ENT:Initialize() self.Turret = ents.Create( "turret_entity_name" ) self.Turret.Base = self end[/lua][/QUOTE] Fixed.
Bleh, paying too much attention to anime and not enough to lua.
Has anyone ever made a Steam derma skin?
Old version: [url]http://www.garrysmod.org/downloads/?a=view&id=44225[/url]
Oh man, I haven't seen Steam looking like that in [b]forever[/b].
Mhm I have this piece of code here: [CODE] function ENT:Think() local entityfound = ents.FindInSphere(Vector(0,0,0),10) for k,v in pairs(entityfound) do if v != then ent:EmitSound("/doors/checkpointbarremove.wav", 500, 200) end end end[/CODE] And was wondering how I can make the bolded section detect a certain entity WITHIN that range. I cant seem to work it out but hey, I'm no genius :V if v !=[B] NEEDS CODE IN HERE [/B]then
v will always be within range, what are you talking about?
v:GetClass() == "certain_entity_class" He means a certain entity.
hi, i have a system that generates random SWEPs it mixes stats from a set of different tables as u see below [lua] function SWEP:Initialize( ) local body= table.Random(RK.Weapons.Stored) local barrel = table.Random(RK.Weapons.Stored) local mag = table.Random(RK.Weapons.Stored) local stock = table.Random(RK.Weapons.Stored) local sight = table.Random(RK.Weapons.Stored) local Default = table.Random(RK.Weapons.Stored) self.Gradecolours = { Vector(180,255,180,255), Vector(180,180,255,255), Vector(255,255,180,255), Vector(255,180,255,255), Vector(255,180,140,255) } self.Title = body.Title self.RRecoil = barrel.Recoil self.RDamage = barrel.Damage self.prefix2 = barrel.Prefix2 self.RNumShots = body.NumShots self.RCone = sight.Cone self.RClipSize = mag.ClipSize self.RDelay = stock.Delay self.prefix1 = stock.Prefix1 self.RDefaultClip = mag.DefaultClip self.RAutomatic = stock.Automatic self.RAmmo = body.Ammo self.RPrintName = self.prefix1 .. " " .. self.prefix2 .. " " .. self.Title self.Grade = self:GenerateGrade( self ) self.NameColor = self.Gradecolours[self.Grade] self.Bullet = barrel.Bullet self.Special = barrel.Special self.SpecialNum = barrel.SpecialNum self:SetNetworkedString("PrintName", self.RPrintName) self:SetNetworkedFloat("Recoil", self.RRecoil) self:SetNetworkedInt("Damage", self.RDamage) self:SetNetworkedInt("NumShots", self.RNumShots) self:SetNetworkedFloat("Cone", self.RCone) self:SetNetworkedInt("ClipSize",self.RClipSize) self:SetNetworkedFloat("Delay", self.RDelay) self:SetNetworkedInt("DefaultClip", self.RDefaultClip) self:SetNetworkedBool("Automatic", self.RAutomatic) self:SetNetworkedString("Ammo", self.RAmmo) self:SetNetworkedInt("Grade", self.Grade) self:SetNetworkedVector("NameColor",self.NameColor) self.PrintName = self.GetNetworkedString("PrintName") end [/lua] now, for players it all works fine as id like for its stage in development but, i've added the weapon to the NPC list and had a rebel use it, I spawn a zombie he/she appears to fire it but does no damage or misses indefinitely after getting devoured by the zombie the weapon drops on the floor for player to collect and again works perfectly. I cant figure out what's happening here
Could someone fix this? [CODE][sui_scoreboard\player_row.lua:63] attempt to index global 'tcolor' (a nil value)[/CODE] [CODE] function PANEL:Paint() local color = Color( 100, 100, 100, 255 ) if ( self.Armed ) then color = Color( 125, 125, 125, 255 ) end if ( self.Selected ) then color = Color( 125, 125, 125, 255 ) end if ( self.Player:Team() == TEAM_CONNECTING ) then color = Color( 100, 100, 100, 155 ) elseif ( self.Player:IsValid() ) then //if ( team.GetName(self.Player:Team() ) == Unassigned) then if ( tostring(self.Player:Team()) == tostring("1001") ) then color = Color( 100, 100, 100, 255 ) else tcolor = evolve.ranks[self.Player:EV_GetRank( )].Color color = Color(tcolor.r,tcolor.g,tcolor.b,255) //color = Color(tcolor.r,tcolor.g,tcolor.b,225) end elseif ( self.Player:IsAdmin() ) then color = Color( 255, 155, 0, 255 ) end if ( self.Player == LocalPlayer() ) then tcolor = evolve.ranks[self.Player:EV_GetRank( )].Color //tcolor = team.GetColor(self.Player:Team()) color = Color(tcolor.r,tcolor.g,tcolor.b,255) end [/CODE]
Which line is line 100? I can tell that it isn't in what you posted.
i tryd to fix it, and updated my post
evolve.ranks[self.Player:EV_GetRank( )].Color is nil [editline]16th March 2012[/editline] You could do [lua] tcolor = evolve.ranks[self.Player:EV_GetRank( )].Color or color [/lua] To fix it.
Thanks
Need some help with derma. Say I have two elements that I want to dock to each side of a frame, but I want the frame to scale depeneding on the size that I set the elements to. I tried SizeToContents.
[QUOTE=vexx21322;35168195]Need some help with derma. Say I have two elements that I want to dock to each side of a frame, but I want the frame to scale depeneding on the size that I set the elements to. I tried SizeToContents.[/QUOTE] You could modify the position of one of the elements in [b][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexa044.html?title=DPanel.PerformLayout]Panel.PerformLayout [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b], such as changing its position as the panel is resized.
need a bit of help here basicly im triying to do an sort of buffs & debuffs system since they can stock up on top of each oter im stuck in the visual part at the start i tough i could get the location or well dunno place or zone of the last buff and then add a new one a bit above from it but im completly stuck on this!
You could make a table of buffs/debuffs and use table.insert to add new buffs. Then, when drawing, you just have to loop through the components and increment the position of them each time. For example, [lua]function GM:HUDPaint() xpos = 0 xoffset = 32 for k,v in pairs( BuffTable ) do draw.SimpleText( "X", "ScoreboardText", 20+xpos, ScrH()-50, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP ) xpos = xpos + xoffset end end[/lua] This will draw an X for every buff a player has.
I thought this would work for the entity but it doesn't seem to do anything at all except 'Couldn't dispatch user message (19)' in console. [LUA]function ENT:Think() local entityfound = ents.FindInSphere(Vector(0,0,0),10) for k,v in pairs(entityfound) do if v:GetModel() == "models/labware/beaker1.mdl" then self:SetModel("models/props_c17/oildrum001.mdl") end end end[/LUA] Ideas? EDIT: Also. On another topic, how could I use self:SetAngles() to continuously stay at that angle even after getting gravgunned.
[vid]http://puu.sh/l8ko[/vid] trying to get a base_anim entity's eyes to follow me. I tried SetEyeTarget( LocalPlayer():GetPos() ) and then I tried SetFlexWeight for the flexes "eyes_rightleft" and "eyes_updown" neither worked.
[QUOTE=Hentie;35173300] -stuff-.[/QUOTE] Even though it doesn't work that was quite a laugh!
Sorry, you need to Log In to post a reply to this thread.