• What do you need help with? V3
    6,419 replies, posted
  • [QUOTE=|Royal|;34682828]Hey, How i get the sound duration of an "mp3" file, because [lua] SoundDuration() [/lua] works only for "wav" files ? best regards, |Royal|[/QUOTE] Well, you will have to check it manually. No existing functions will get it for you.
  • Avatar of GameDev
  • [QUOTE=Fantym420;34675161]They way I achieved this with my Marble Gravity Racer was to stick the player somewhere on the edge of the map bounds, and then create an entity that acts as the player. I originally started my game mode for the last GCC, which was to make a game mode based on the melon racer code, it's almost completely different now, but the core elements are there, like using a player entity, you should check it out, [url=http://www.facepunch.com/threads/1150064] here -> http://www.facepunch.com/threads/1150064[/url]. any way, hope that helps. [b]Edited[/b] also use [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index4e84.html?title=Entity.PhysicsInitSphere] Entity.PhysicsInitSphere [/url] insted of the model's collision mesh, much smoother.[/QUOTE] It works in game, though the physics appear to be a little broken: [video=youtube;6c076OEWFE8]http://www.youtube.com/watch?v=6c076OEWFE8[/video] It's almost like it's snagging on the ground. [code]function ENT:Initialize() local d=20 //Diameter local r=d/1.8 //Radius self:SetModel( "models/XQM/Rails/gumball_1.mdl" ) self:PhysicsInitSphere(r) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetNWBool( "is_melon", false ) local phys = self:GetPhysicsObject() if( phys:IsValid() ) then phys:Wake() end end[/code]
  • Avatar of GameDev
  • [QUOTE=ralle105;34685443]You might have to set the collision bounds as well.[/QUOTE] Didn't have any effects.
  • Avatar of lorde banana
  • I know this has been asked a thousand times, but [img]http://www.bananatree.im/i/ZMWTSEePFwL.png[/img] How do I stop the damn model from clipping
  • Avatar of raBBish
  • [QUOTE=Banana Lord.;34687607]How do I stop the damn model from clipping[/QUOTE] [url=http://www.facepunch.com/threads/986675-Niggles?p=29586993&viewfull=1#post29586993]This might help.[/url]
  • Avatar of lorde banana
  • [QUOTE=raBBish;34687739][url=http://www.facepunch.com/threads/986675-Niggles?p=29586993&viewfull=1#post29586993]This might help.[/url][/QUOTE] Thank you <3!
  • Avatar of chonks
  • How do I require a file like a model or material be downloaded before joining?
  • Avatar of raBBish
  • [QUOTE=chonks;34687888]How do I require a file like a model or material be downloaded before joining?[/QUOTE] [url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5809.html?title=Resource.AddFile]resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] That new favicon for Wiki looks fancy. Animated, too! :v:
  • Avatar of chonks
  • [QUOTE=raBBish;34687921][url=http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index5809.html?title=Resource.AddFile]resource.AddFile [img]http://wiki.garrysmod.com/favicon.ico[/img][/url] That new favicon for Wiki looks fancy. Animated, too! :v:[/QUOTE] Thank you good sir.
  • Avatar of PencilOnDesk
  • [QUOTE=PencilOnDesk;34626053][lua]function bloodtest() for k,v in pairs(player.GetAll()) do if v:Health() >= 25 then if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end if v:Health() <= 24 then if timer.IsTimer("NextBleedOut") then return end timer.Create("NextBleedOut",1,0,function() local Pos = v:GetPos() + Vector(0,0,30) local effectdata = EffectData() effectdata:SetStart( Pos ) effectdata:SetOrigin( Pos ) effectdata:SetScale( 1 ) util.Effect( "BloodImpact", effectdata ) local trace = {}; trace.start = v:GetPos() + Vector(0, 0, 256); trace.endpos = trace.start + Vector(0, 0, -1024); trace.filter = v; trace2 = util.TraceLine(trace); util.Decal("Blood", trace2.HitPos + trace2.HitNormal, trace2.HitPos - trace2.HitNormal) end) end end end hook.Add("Think","Bloodoasdf",bloodtest) hook.Add("PlayerDeath","ClearTimers", function() if timer.IsTimer("NextBleedOut") then timer.Destroy("NextBleedOut") end end)[/lua] Trying to work on some sort of bleeding system where the decal is drawn under the player; However at the moment the Decal only gets drawn when the player dies. Why is this?[/QUOTE] Triple bump, oh my.
  • Avatar of Gmod4ever
  • Well, it's a minor issue, so if it's not really resolvable, it's no big deal. Does anyone know of a way to make the particles draw behind the box, though? The particles are being drawn in the ENT:Draw() code, and is right above the code for the box itself. This is how it looks now: [img]http://dl.dropbox.com/u/8416055/gm_construct0037.jpg[/img] As you can see, the particles are being drawn in front of the box.
  • Avatar of chonks
  • [QUOTE=PencilOnDesk;34688875]Triple bump, oh my.[/QUOTE] I tested your code and it works fine, my player model was bleeding all over. Perhaps you forgot to bring yourself below 25 health? Try hurtme 76 in console and see what happens. Edit: I see now that you mean the ground below the player. I've noticed that it also appears when the player is jumping or swimming or generally hovering above the ground, but not touching it. Hopefully that helps you somehow. Edit2: I've determined that the decal wont appear explicitly when the player is standing directly on top of it. All of the traces are fine and if I delay the placement for a moment to get out of the way then it appears. Somehow the player is blocking it from appearing.
  • Avatar of ralle105
  • [QUOTE=Nexus435;34688629]Is there a function to get the screen as a texture?[/QUOTE] render.GetScreenEffectTexture() You'll also want to call render.UpdateScreenEffectTexture() before using it.
  • Avatar of kragmars102
  • I'm having troubles changing the skin of a tdmcar, I'm using skin 12. I've got both skin12.vmt and skin12.vmt in models/materials/bmwm5e60/ - it simply doens't work, it just shows up as white. One that work temporarily was when I was using skin 3, yet it applied skin1.vmt & vtf.
  • Avatar of PencilOnDesk
  • [QUOTE=chonks;34689239]I tested your code and it works fine, my player model was bleeding all over. Perhaps you forgot to bring yourself below 25 health? Try hurtme 76 in console and see what happens. Edit: I see now that you mean the ground below the player. I've noticed that it also appears when the player is jumping or swimming or generally hovering above the ground, but not touching it. Hopefully that helps you somehow. Edit2: I've determined that the decal wont appear explicitly when the player is standing directly on top of it. All of the traces are fine and if I delay the placement for a moment to get out of the way then it appears. Somehow the player is blocking it from appearing.[/QUOTE] That's the exact problem I ran into; finally someone understands. I guess the only way to get around it would be to add a vector and have it placed around the player instead of directly under them.
  • Avatar of ralle105
  • Maybe you could temporarily move the player away, paint the decal, and then move them back again?
  • Is it possible to print text with custom color(s) into console? I looked around the temporary wiki but found nothing.
  • Avatar of Drakehawke
  • [QUOTE=Panto;34693874]Is it possible to print text with custom color(s) into console? I looked around the temporary wiki but found nothing.[/QUOTE] Not at the moment, in GMod 13 MsgC will let you do just that, however. [editline]14th February 2012[/editline] [QUOTE=ralle105;34693464]Maybe you could temporarily move the player away, paint the decal, and then move them back again?[/QUOTE] Would that not be noticeable by the player?
  • [QUOTE=PencilOnDesk;34693326]That's the exact problem I ran into; finally someone understands. I guess the only way to get around it would be to add a vector and have it placed around the player instead of directly under them.[/QUOTE] Alternatively you could always use particles. Like, spawn one that drops down and then spawn a static one on impact. Of course this is not a good method if you want to keep the blood there for a fairly long time, but better than nothing.
  • Avatar of ralle105
  • [QUOTE=Drakehawke;34693889] Would that not be noticeable by the player?[/QUOTE] I don't think so.
  • [QUOTE=ralle105;34694756]I don't think so.[/QUOTE] It's latency dependant. I doubt it would be noticable in singleplayer though.
  • Okay, so I'm trying to manually spawn a prop but I'm getting an error regarding the physics object. Any ideas or tips on how to fix this? I assume I have to manually create the physics object... Here's the code & output. [lua] local ent = ents.Create( "prop_physics" ) ent:SetModel( "models/props_trainstation/bench_indoor001a.mdl" ) ent:SetPos( pos ) ent:SetAngles( ang ) ent:Spawn() [/lua] [code] ERROR!: Can't create physics object for models/props_trainstation/bench_indoor001a.mdl [/code] [B]Edit:[/B] answering this one myself. It seems it was caused because that snippet of code was ran in the Initialize function (server-side). A simple timer was sufficient enough to fix this. :rolleyes:
  • Avatar of ralle105
  • [QUOTE=SFArial;34694815]It's latency dependant. I doubt it would be noticable in singleplayer though.[/QUOTE] I don't know how source does it but I would only send a position update to the clients every tick and not every time :SetPos() is called.
  • [QUOTE=ralle105;34695215]I don't know how source does it but I would only send a position update to the clients every tick and not every time :SetPos() is called.[/QUOTE] Yeah I guess it really isn't that noticable, ignore my previous statement.
  • Avatar of _nonSENSE
  • [QUOTE=Panto;34695051] [code] ERROR!: Can't create physics object for models/props_trainstation/bench_indoor001a.mdl [/code] [B]Edit:[/B] answering this one myself. It seems it was caused because that snippet of code was ran in the Initialize function (server-side). A simple timer was sufficient enough to fix this. :rolleyes:[/QUOTE] InitPostEntity works too.
  • Avatar of Gmod4ever
  • [QUOTE=_nonSENSE;34696487]InitPostEntity works too.[/QUOTE] Generally, if you're doing entity spawning on map load, you use the InitPostEntity hook for it. Initialize is generally reserved for variable declaration only. Anything involving entities that needs to be done on start-up should be done on InitPostEntity.