• Problems That Don't Need Their Own Thread v3.0
    5,003 replies, posted
[QUOTE=BFG9000;47694201]MASK_WATER 2 traces: One that starts out with the player and one with MASK_WATER. The player trace should project up from the player's shoot pos to the ceiling or top of the map, then have the hitpos of this trace become the basis for the water trace, which aims down at the player. Take the difference of the lengths and there's your depth.[/QUOTE] Sounds like I can work with that, and that it will work. Thanks, but that sounds to me like it might be a little too costly to run 2 traces a tick for each player swimming on the server. [editline]10th May 2015[/editline] I have to elaborate to explain why it would run every tick, and I could make it think a lot less often. I'm trying to accommodate for any mapper's work with water. It is possible that a player would swim under something to an area with a lower shore line. [editline]10th May 2015[/editline] I don't think I could calculate well if a mapper decided to put two bodies of water, one hovering in mid-air above the other, with space between them. If you understand what I just said. I don't think that's really ever gonna be an issue, though.
Anyway to open the Garry's Mod options/new game menus from in-game? I wouldn't mind doing a custom escape menu but only if I could include the default buttons on there in some format
[lua]RunConsoleCommand ( "gamemenucommand", "openoptionsdialog" )[/lua] Just look at what arguments gamemenucommand has for other stuff.
Is it possible to blur a stencil? I'm basicly trying to create a 2D shadow, and my first thought was stencil and blur it? If it's not possible, no biggy, I can probably just use textures and work with that (sort of like rounded box does), but it would be awesome for non-rectangular shapes.
[QUOTE=WalkingZombie;47694663]Sounds like I can work with that, and that it will work. Thanks, but that sounds to me like it might be a little too costly to run 2 traces a tick for each player swimming on the server. [editline]10th May 2015[/editline] I have to elaborate to explain why it would run every tick, and I could make it think a lot less often. I'm trying to accommodate for any mapper's work with water. It is possible that a player would swim under something to an area with a lower shore line. [editline]10th May 2015[/editline] I don't think I could calculate well if a mapper decided to put two bodies of water, one hovering in mid-air above the other, with space between them. If you understand what I just said. I don't think that's really ever gonna be an issue, though.[/QUOTE] Traces aren't expensive, two should be fine. And even so running every tick doesn't sound necessary, I do ~60 traces per 10 ticks in one of my entities and no-one notices lag.
[QUOTE=Author.;47695351][lua]RunConsoleCommand ( "gamemenucommand", "openoptionsdialog" )[/lua] Just look at what arguments gamemenucommand has for other stuff.[/QUOTE] [code] disconnect openbenchmarkdialog openchangegamedialog opencreatemultiplayergamedialog opencustommapsdialog openfriendsdialog opengamemenu openloadcommentarydialog openloaddemodialog openloadgamedialog opennewgamedialog openoptionsdialog openplayerlistdialog opensavegamedialog openserverbrowser quit quitnoconfirm resumegame[/code] I made [url=http://facepunch.com/showthread.php?t=1152853]something[/url] to do custom escape menus a while ago, but it's pretty bad and it's outdated
Is there a way to write the RGB channel of one texture to the Alpha of another?
If you convert it to grayscale, you might be able to get away with setting $translucent_material to the ITexture that is desired and set $translucent to 1. Not sure if that'd work. If you are working with a rendertarget, [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/render/OverrideAlphaWriteEnable]render.OverrideAlphaWriteEnable[/url] might be of use.
This may sound stupid, how can i write a file at "myGamemode/content/data/vehicles"?
[QUOTE=HunterFP;47698150]This may sound stupid, how can i write a file at "myGamemode/content/data/vehicles"?[/QUOTE] You don't unless using a binary module.
[QUOTE=Willox;47698201]You don't unless using a binary module.[/QUOTE] Do you suggest one?
<snip> figured it out
Is there a way to see what scripts are taking up the most memory/ generating the most lag?
[QUOTE=DevShinx;47699248]Is there a way to see what scripts are taking up the most memory/ generating the most lag?[/QUOTE] [url]https://github.com/oubliette32/DBugR[/url] this is very useful
I know there was a thread lying around with useful code sniplets but I can't find it so, how can I make strobing colors with sine and stuff?
[QUOTE=LUModder;47699433]I know there was a thread lying around with useful code sniplets but I can't find it so, how can I make strobing colors with sine and stuff?[/QUOTE] [code]math.abs( math.sin( CurTime() * X ) ) * Y[/code] CurTime() should be multiplied by a large number to get a strobe. X is that CurTime() Multiplier. Y is the highest value for your color, so... 255 for full bright... Basically CurTime() keeps the sin / cosine changing. You take the absolute value of it because sin and cosine will return negative and positive values, not just positive. For ridiculously fast strobing, try CurTime() * 62.8
Not sure if I'm being very very stupid here, but. [LUA] -- sample table set. pie = {} pie["test"] = 1 pie["tree"] = 23 -- This line should copy pie into Entity(1).PieTable right? Entity(1).PieTable = pie Entity(1).PieTable["test"] = 2 PrintTable(pie) [/LUA] Ok, so an obviously quick typed example of what I mean. Hope I typed it right as I'm not on a PC, anyway. PrintTable(pie) is outputting pie["test"] = 2 pie["tree"] = 23 Why is the value of pie["test"] changing? I thought doing Entity(1).PieTable would copy the pie table into the entity var PieTable, not link it in some way.
[QUOTE=Pantho;47701739]Not sure if I'm being very very stupid here, but. [LUA] -- sample table set. pie = {} pie["test"] = 1 pie["tree"] = 23 -- This line should copy pie into Entity(1).PieTable right? Entity(1).PieTable = pie Entity(1).PieTable["test"] = 2 PrintTable(pie) [/LUA] Ok, so an obviously quick typed example of what I mean. Hope I typed it right as I'm not on a PC, anyway. PrintTable(pie) is outputting pie["test"] = 2 pie["tree"] = 23 Why is the value of pie["test"] changing? I thought doing Entity(1).PieTable would copy the pie table into the entity var PieTable, not link it in some way.[/QUOTE] Because it's passed by reference, rather than by value. both pie["test"] and Entity(1).PieTable["test"] are pointing to the same place in memory. (they are referencing the same thing) you might have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/table/Copy]table.Copy[/url]
[QUOTE=Blasteh;47701760]Because it's passed by reference, rather than by value. both pie["test"] and Entity(1).PieTable["test"] are pointing to the same place in memory. (they are referencing the same thing) you might have to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/table/Copy]table.Copy[/url][/QUOTE] Is this just because it's a table and is this normal LUA practice or gmod buggery?
[QUOTE=Pantho;47701791]Is this just because it's a table and is this normal LUA practice or gmod buggery?[/QUOTE] It'll be a Lua thing; different languages might do things differently, but it's usually something to check for if you need/don't need the functionality. edit: this might explain it better: [url]http://www.lua.org/pil/2.5.html[/url] edit2: functions, tables, and userdata are passed by reference, everything else is passed by value
Technically speaking, no variable is passed by reference in Lua. That would imply the following: [code] function Test( a, b ) a, b = 2, { 2 } end a, b = 1, { 1 } Test( a, b ) -- If b were passed by reference, it would now contain the number 2. But it doesn't. [/code] Instead, the value of the variable 'b' is a reference to a table. The same rules apply for functions, userdata, strings and coroutine-threads. Hell, you can argue every data-type works this way seeing as the rest are immutable. tl;dr: The only reason tables feel different is because their contents can change. Every value works this way and no variable is passed by reference.
Another one that's confusing me... [IMG]http://share.bybservers.co.uk/2015-05-11_18-41-42.png[/IMG] Line 24 declares, line 25 what?
[QUOTE=Pantho;47703284]Another one that's confusing me... [IMG]http://share.bybservers.co.uk/2015-05-11_18-41-42.png[/IMG] Line 24 declares, line 25 what?[/QUOTE] You are calling vgui.Create too early so nil is returned as it fails to create the panel. Do it from the Initialize hook or later.
Quick question, does http.Fetch block HTTPS urls?
[QUOTE=Willox;47703304]You are calling vgui.Create too early so nil is returned as it fails to create the panel. Do it from the Initialize hook or later.[/QUOTE] How annoying, but fair enough.
[QUOTE=James xX;47703413]Quick question, does http.Fetch block HTTPS urls?[/QUOTE] No it doesn't. It works like any other http:// url when I tested it.
For some reason on my server, you cant place a law board. There are no errors in console or for clients. Anyone have any ideas? Edit: Great, thanks for the help.
Does anyone know how to correct the player aim-vector/model-aim-vector discrepancy? You know, how when looking straight forward, parallel to the ground, your playermodel is aiming a good 30 degrees downward... quite idiotic Thought there might be some way to override the playermodel's aim direction in some hook, but the wiki yields no clues
[QUOTE=ThrowAwayAcct;47705839]Does anyone know how to correct the player aim-vector/model-aim-vector discrepancy? You know, how when looking straight forward, parallel to the ground, your playermodel is aiming a good 30 degrees downward... quite idiotic Thought there might be some way to override the playermodel's aim direction in some hook, but the wiki yields no clues[/QUOTE] Not sure, but this might help: [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/AddCallback]Entity:AddCallback[/url] [url]http://wiki.garrysmod.com/page/Entity_Callbacks[/url] See BuildBonePositions. [editline]e[/editline] Awh man, I was saving my 3k post for something special :rolleyes:
It was special to me. EDIT: I don't think that'll help. The player's aim direction consists of movements and angles of a whole crapload of bones. I wouldn't know how to custom re-build all the player's bones to do this. Thanks though.
Sorry, you need to Log In to post a reply to this thread.