• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=Revenge282;49036615]When is a good time to create particles for a player who is newly joining? Right now I have a fire particle attached to an entity, but creating the particle on the entity on ENT:Initialize won't create the particles for the connecting player. The only thing I have found is to create a timer for 15 seconds and create the particles then. (Obv a bad idea because timers, and 15 is arbitrary)[/QUOTE] Sending a net message to the server in the clientside InitPostEntity hook always worked well for me for those types of things. [url]https://github.com/Jeezymang/gMatch/blob/master/gamemode/client/game/gmatch_basehooks.lua#L13[/url] [url]https://github.com/Jeezymang/gMatch/blob/master/gamemode/server/game/gmatch_net.lua#L69[/url]
Just wondering, [B]how am I supposed to set a ragdoll's bone positions?[/B] I'm really confused, since [url=http://wiki.garrysmod.com/page/Entity/ManipulateBonePosition]Entity:ManipulateBonePosition[/url] sets an 'offset' and [url=http://wiki.garrysmod.com/page/Entity/SetBonePosition]Entity:SetBonePosition[/url] only works clientside, which makes no sense at all. Also, [url=http://wiki.garrysmod.com/page/Entity/SetBoneMatrix]Entity:SetBoneMatrix[/url] (according to the wiki) 'does nothing on server'. Surely positioning stuff (such as ragdoll bones/ragdoll physics objects/whatever I'm meant to change) would be mainly serverside, since all players on the server would need to see the changes/movements? Or, am I just meant to do [url=http://wiki.garrysmod.com/page/Entity/SetPos]Entity:SetPos[/url] to one of a ragdoll's physics objects?
How can I get the exact force necessary to suspend a prop in mid air? Ideally I'd like to use ApplyForceCenter, and I don't know how many source engine units make a newton...
[QUOTE=MPan1;49038392]Just wondering, [B]how am I supposed to set a ragdoll's bone positions?[/B] I'm really confused, since [url=http://wiki.garrysmod.com/page/Entity/ManipulateBonePosition]Entity:ManipulateBonePosition[/url] sets an 'offset' and [url=http://wiki.garrysmod.com/page/Entity/SetBonePosition]Entity:SetBonePosition[/url] only works clientside, which makes no sense at all. Also, [url=http://wiki.garrysmod.com/page/Entity/SetBoneMatrix]Entity:SetBoneMatrix[/url] (according to the wiki) 'does nothing on server'. Surely positioning stuff (such as ragdoll bones/ragdoll physics objects/whatever I'm meant to change) would be mainly serverside, since all players on the server would need to see the changes/movements? Or, am I just meant to do [url=http://wiki.garrysmod.com/page/Entity/SetPos]Entity:SetPos[/url] to one of a ragdoll's physics objects?[/QUOTE] Here's a snippet of code from my displacer cannon. This is used to create a new ragdoll in the old ones place. It might be some use to you [lua] local bone, bones, weld rag = ents.Create( "prop_ragdoll" ) rag:SetModel( ent:GetModel( ) ) rag:SetPos( ent:GetPos( ) ) rag:SetAngles( ent:GetAngles( ) ) rag:SetMaterial("models/alyx/emptool_glow") rag:Spawn( ) rag:SetCollisionGroup( COLLISION_GROUP_WORLD ) rag.dummeh = true bones = rag:GetPhysicsObjectCount( ) rag:SetSequence( ent:GetSequence( ) ) rag:SetCycle( ent:GetCycle( ) ) for bone = 1, bones-1 do local Ragdoll = ent:GetPhysicsObjectNum( bone ) local NewRagdoll = rag:GetPhysicsObjectNum( bone ) local Oldpos,OldAng = ent:GetBonePosition(ent:TranslatePhysBoneToBone( bone )) NewRagdoll:SetPos(Oldpos) NewRagdoll:SetAngles(OldAng) NewRagdoll:EnableMotion(false) --NewRagdoll:EnableCollisions(false) local constraint = constraint.Weld( rag, rag, 0, bone, 100000 ) end rag:SetColor( Color(0,255,255,200) ) rag:SetRenderMode( RENDERMODE_TRANSALPHA ) [/lua] [editline]3rd November 2015[/editline] [QUOTE=Z0mb1n3;49038616]How can I get the exact force necessary to suspend a prop in mid air? Ideally I'd like to use ApplyForceCenter, and I don't know how many source engine units make a newton...[/QUOTE] What are you trying to do? Can't you freeze the prop or disable gravity?
[CODE]Warning: Table downloadables is full, can't add sound/vehicles/tdmcars/m1/third.wav[/CODE] What does this mean? Is there a limit for files, that can be added with resource.AddFile()?
[QUOTE=P4sca1;49039709][CODE]Warning: Table downloadables is full, can't add sound/vehicles/tdmcars/m1/third.wav[/CODE] What does this mean? Is there a limit for files, that can be added with resource.AddFile()?[/QUOTE] Yes
[QUOTE=Willox;49039741]Yes[/QUOTE] Any way to higher it?
[QUOTE=P4sca1;49039760]Any way to higher it?[/QUOTE] It'd need to be 'higher-ed' on every client too, so only an update to gmod would be able to do so. If you really need more downloads, use workshop collections.
[QUOTE=P4sca1;49039709][CODE]Warning: Table downloadables is full, can't add sound/vehicles/tdmcars/m1/third.wav[/CODE] What does this mean? Is there a limit for files, that can be added with resource.AddFile()?[/QUOTE] Im just gonna say what wiki says. It might help you and also make you think. [QUOTE]NOTE: There's a 8192 downloadable file limit. If you need more, consider using Workshop addons - resource.AddWorkshop. You should also consider the fact that you have way too many downloads.[/QUOTE]
[QUOTE=LegoGuy;49039566]What are you trying to do? Can't you freeze the prop or disable gravity?[/QUOTE] Trying to simulate water. The deeper in the water, the more upward force is applied, up to a cap of course, and as it gets closer to the top, the force goes back to holding the prop at the top of the water.
[QUOTE=Z0mb1n3;49041435]Trying to simulate water. The deeper in the water, the more upward force is applied, up to a cap of course, and as it gets closer to the top, the force goes back to holding the prop at the top of the water.[/QUOTE] Source water..?
[QUOTE=Z0mb1n3;49041435]Trying to simulate water. The deeper in the water, the more upward force is applied, up to a cap of course, and as it gets closer to the top, the force goes back to holding the prop at the top of the water.[/QUOTE] Get the downward force/velocity of an object, then apply opposite force (multiply by a factor ~.8 to make the reaction force slower? [density and shit]). Buoyant force is always straight upward too. Lerp the force based on the distance from the starting point under the water to the surface to make it "exert" more force at greater depths. [editline]3rd November 2015[/editline] Kinda a bootleg implementation, but it would work visually.
[QUOTE=Revenge282;49041648]Get the downward force/velocity of an object, then apply opposite force (multiply by a factor ~.8 to make the reaction force slower? [density and shit]). Buoyant force is always straight upward too. Lerp the force based on the distance from the starting point under the water to the surface to make it "exert" more force at greater depths. [editline]3rd November 2015[/editline] Kinda a bootleg implementation, but it would work visually.[/QUOTE] And my problem is that I can't find the downward pull of each object. Applying the object's mass isn't enough. It seems like any object's mass multiplied by 9 is the magic number to suspend it.
[QUOTE=geferon;49039857]Im just gonna say what wiki says. It might help you and also make you think.[/QUOTE] I accidently put a file on my server, which resource.AddFile'd every M9K pack (about 3000 things). Fixed now :) Btw, what's the lua limit?
[QUOTE=Z0mb1n3;49041721]And my problem is that I can't find the downward pull of each object. Applying the object's mass isn't enough. It seems like any object's mass multiplied by 9 is the magic number to suspend it.[/QUOTE] sv_gravity is the world's gravity, so if you do your math with that and the mass of the object, you can find out how much force is being exerted on the object. sv_gravity is units/sec^2
[QUOTE=Revenge282;49041946]sv_gravity is the world's gravity, so if you do your math with that and the mass of the object, you can find out how much force is being exerted on the object. sv_gravity is units/sec^2[/QUOTE] However, sv_gravity does not affect props, physenv.(Set/Get)Gravity does. I'm unsure if it is the same units for that. [del]Side problem, is there a way to render a sprite that doesn't clip through the world? I wanted to avoid using HUDPaint, so that the sprite doesn't draw over weapons and such, but having sprites that clip through stuff is ugly.[/del]
[QUOTE=TFA;49029968]I'm having a lot of trouble with this. How can I get an entity to render multiple times at different positions and alphas? Basically, render a model once with an alpha of 64, offset the render origin by a vector relative to the object, and then render it with an alpha of 255?[/QUOTE] The way I go about something like that is using Matrix(). Here is an example Draw function for a random entity, it's draw the model at 1/4 the transparency, then translates it and redraws it at fully opaque. [CODE] function ENT:Draw() render.SetBlend(0.25) self:DrawModel() local renderMatrix = Matrix() render.SetBlend(1) Matrix():Translate(Vector(20,20,20)) self:EnableMatrix("RenderMultiply",renderMatrix) self:DrawModel() self:DisableMatrix("RenderMultiply") end [/CODE]
Is it possible to set a material on only one face of a prop? I tried setsubmaterial but the prop doesn't have any submaterials for me to set.
How do I make multiple variables on the fly? i.e. [CODE] num = 0 while num != 5 do myVar..num = 0 num = num + 1 end [/CODE] I would like that code to create 5 variables, myVar1, myVar2, myVar3, myVar4, & myVar5, all being "0". I know there's a long and hard way to do this, but I'm wondering if there's a short & easy way instead. Thanks in advance.
Does anyone know what can cause physics to break and props to fall through the map? I've tried removing my ShouldCollide hooks with no luck. Some other people running completely different gamemodes have had the same issue and none of us can figure out what it is.
[QUOTE=Silhouhat;49043240]How do I make multiple variables on the fly? i.e. [CODE] num = 0 while num != 5 do myVar..num = 0 num = num + 1 end [/CODE] I would like that code to create 5 variables, myVar1, myVar2, myVar3, myVar4, & myVar5, all being "0". I know there's a long and hard way to do this, but I'm wondering if there's a short & easy way instead. Thanks in advance.[/QUOTE] you can create variables on the global table: [lua]_G[string.format('myVar%d', num)] = 0[/lua] but it's way better to make a table just for the variables you're trying to make: [lua] local myVars = {} ... myVars[num] = 0 [/lua]
[QUOTE=StonedPenguin;49043258]Does anyone know what can cause physics to break and props to fall through the map? I've tried removing my ShouldCollide hooks with no luck. Some other people running completely different gamemodes have had the same issue and none of us can figure out what it is.[/QUOTE] Sometimes it can crash due to changing collision groups of objects, or accidentally changing the collision group of the world. It just seems to happen eventually for me, too, and I have no shouldcollide hooks. Shame there's no way to like, restart the physics engine without restarting the server.
If I had a list of entity names in a table, how would I call a function in my server-side code when an entity in the table is used? Then check if the person who used the entity is in a job defined in a table with many other jobs? e.g. [CODE] Config.IllegalEntities = { "drugs_meth", "drugs_weed", "drugs_cocaine" } Config.CopJobs = { "Civil Protection", "Police Chief", "SWAT", "SWAT Leader", "FBI Agent" } [/CODE]
I don't suppose there is a way to SetModelScale without it transmitting the new scale to players?
[QUOTE=Threebow;49043743]If I had a list of entity names in a table, how would I call a function in my server-side code when an entity in the table is used? Then check if the person who used the entity is in a job defined in a table with many other jobs? e.g. [CODE] Config.IllegalEntities = { "drugs_meth", "drugs_weed", "drugs_cocaine" } Config.CopJobs = { "Civil Protection", "Police Chief", "SWAT", "SWAT Leader", "FBI Agent" } [/CODE][/QUOTE] EDIT: OH FUCK, WRONG LINK :S I meant to put this [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PlayerUse]GM/PlayerUse[/url] wich is not a very good way though
[QUOTE=Jeezy;49037953]Sending a net message to the server in the clientside InitPostEntity hook always worked well for me for those types of things. [url]https://github.com/Jeezymang/gMatch/blob/master/gamemode/client/game/gmatch_basehooks.lua#L13[/url] [url]https://github.com/Jeezymang/gMatch/blob/master/gamemode/server/game/gmatch_net.lua#L69[/url][/QUOTE] This is still too early, I need it to be after that "splash" noise that happens when you first spawn in. I was doing similar to what you are doing in your example originally, but it still occurs too early.
[QUOTE=Revenge282;49057785]This is still too early, I need it to be after that "splash" noise that happens when you first spawn in. I was doing similar to what you are doing in your example originally, but it still occurs too early.[/QUOTE] I've been doing it [URL="https://github.com/SuperiorServers/plib_v2/blob/master/lua/plib/libraries/nw.lua#L253"]that way[/URL] forever and never have had an issue. Any reason as to why you say that?
[QUOTE=StonedPenguin;49058509]I've been doing it [URL="https://github.com/SuperiorServers/plib_v2/blob/master/lua/plib/libraries/nw.lua#L253"]that way[/URL] forever and never have had an issue. Any reason as to why you say that?[/QUOTE] Well generally that way works for anything else as far as running Lua is concerned. But in this particular instance, I am using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ParticleEffect]Global.ParticleEffect[/url] to create a flame for my fire entities. (If a player connects, existing entities won't have the effect) But using that hook apparently occurs too soon for the effect to be created.
Anyone know how I could find the contents of a function? Like, if I had a function testfunc(), [code]function testfunc() MsgN("Herro Der!") end[/code] how would I somehow get a string that tells me what is in the function? i.e How would I create a function that would return "MsgN("Herro Der!")" if I ran it on testfunc?
[QUOTE=Revenge282;49058613]Well generally that way works for anything else as far as running Lua is concerned. But in this particular instance, I am using [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/ParticleEffect]Global.ParticleEffect[/url] to create a flame for my fire entities. (If a player connects, existing entities won't have the effect) But using that hook apparently occurs too soon for the effect to be created.[/QUOTE] Adding on to this, I attempted to call the function using the [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ShouldDrawLocalPlayer]GM/ShouldDrawLocalPlayer[/url] and it still is being called too soon for particles. [lua]hook.Add("ShouldDrawLocalPlayer","Test2",function(p) if !p.TestVar then p.TestVar=true print("test") for _,v in ipairs(ents.FindByClass("fire")) do print("Drawing "..tostring(v)) ParticleEffect("fire_large_01",v:GetPos(),Angle(0,0,0),v) end end end)[/lua] [code]OPL Fire (this is using the method that you provided) Signon traffic "CLIENT": incoming 89.351 KB, outgoing 1.990 KB Queued Material System: ENABLED! Compact freed 1372160 bytes CL INIT FIRE (this is the ENT:Initialize) Attempting to create unknown particle system 'WATERFALL' Redownloading all lightmaps R_RedownloadAllLightmaps took 282.849 msec! test (this is the ShouldDrawLocalPlayer hook) Drawing Entity [382][fire][/code]
Sorry, you need to Log In to post a reply to this thread.