I had this idea for something like a short-term RP interactive simulation, where life starts out normal at the start and 4 hours later everything is absolutely fucked. I whipped up a quick "pathogen" script for this, which I'm demonstrating in the video. I show how it can spread through contact, how it grows based on the surface it's on (warm body vs cold body, surface area, etc...), and how a player is affected by symptoms of the disease they've become sick by (in this case, total loss of motor control).
[video]https://youtu.be/m6Iemzl08uo[/video]
Infected individuals slowly lose themselves over time as the disease takes over. They may beg for help but others would fear contracting their disease as well.
I made a concommand that writes you a haiku.
That's basically it.
No screenies, but there's 3 ways to get a haiku written by my Lua slave bot concommand.
You can get a mess of words (and a mess of code), which is just random words placed until it reaches 575
You can do haiku_opfor, which is basically going into HL: Opposing Force and writing haiku in the console, except it prints into chat and uses lua
And then you can do haiku_milo which is haiku_opfor but with my own strings
i want to die
EDIT:
yes i'm using internet explorer to post this
[QUOTE=Miloteza;52401317]I made a concommand that writes you a haiku[/QUOTE]
Speaking of generators, the lord and saviour of the universe [url]http://www.longessays.com/[/url] has recently shut down. [URL="https://github.com/MysteryPancake/Fun/blob/master/gmod/essay.lua"]Luckily, I made a Lua duplicate of it for Garry's Mod a while ago, so the god will live on.[/URL]
I never posted about this yet, but the repository that file is on is what I'm using for fun little things:
[url]https://github.com/MysteryPancake/Fun[/url]
It has quite a lot of cool fun bits on it if you want to try something stupid.
I made an entity where you can assign networked strings to, and basically turn it into anything.
You can change the weapon it gives when pressing E on it, the name and description when mousing over, and of course, the model
[IMG]https://cdn.discordapp.com/attachments/323588874905452554/327558204429172737/image.png[/IMG]
[IMG]https://cdn.discordapp.com/attachments/324935597355433994/327539940680400897/image.png[/IMG]
[IMG]https://cdn.discordapp.com/attachments/232192194025488385/328846123890507776/image.png[/IMG]
[IMG]https://cdn.discordapp.com/attachments/232173967723593729/327492242489081856/image.png[/IMG]
This is probably going to be for a gamemode
minorities spotted
[code]local function UInt32ToDouble(num) // credits to cake
local negative = false
if num >= 0x80000000 then
negative = true
num = num - 0x80000000
end
local biasedExponent = bit.rshift(bit.band(num, 0x7FF00000), 20)
local mantissa = (bit.band(num, 0x000FFFFF) * 4294967296 + num) / 2 ^ 52
local f
if biasedExponent == 0x0000 then
f = mantissa == 0 and 0 or math.ldexp(mantissa, -1022)
elseif biasedExponent == 0x07FF then
f = mantissa == 0 and math.huge or (math.huge - math.huge)
else
f = math.ldexp(1 + mantissa, biasedExponent - 1023)
end
return negative and -f or f
end
local function __readMemory(address, len)
local blankName, upFunction = debug.getupvalue(ipairs, 1) // backup ipairsaux
debug.setupvalue(ipairs, 1, UInt32ToDouble(address - 8)) // set first upvalue to converted address
local addrFunction = ipairs({}) // lua_pushvalue(L,lua_upvalueindex(1));
debug.setupvalue(ipairs, 1, upFunction) // return upvalue to ipairsaux
local fenvAddrNameFN = debug.getfenv(addrFunction)
local memeAddress = tonumber(string.format("%p", fenvAddrNameFN), 16)
memeAddress = bit.tohex(memeAddress, 8)
local memeAddress2 = ""
for i in memeAddress:gmatch("..") do
memeAddress2 = string.char(tonumber(i, 16)) .. memeAddress2
end
return memeAddress2:sub(1, len or 4)
end
local function readMemory(address, len)
local returnStr = ""
for i = 1, len or 1, 4 do
returnStr = returnStr .. __readMemory(address - 1, math.min(len - (i - 1), 4))
end
return returnStr
end
kmem = {}
kmem.util = {}
kmem.read = {}
function kmem.util:address(obj)
return tonumber(string.format("%p", obj))
end
function kmem.util:hex(num)
return "0x" .. string.format("%x", tostring(num)):upper()
end
function kmem.read:uint8(addr)
return readMemory(addr, 1):byte()
end
function kmem.read:uint16(addr)
local returnStr = ""
returnStr = returnStr .. string.format("%02x", readMemory(addr + 1, 1):byte())
returnStr = returnStr .. string.format("%02x", readMemory(addr, 1):byte())
return tonumber(returnStr, 16)
end
function kmem.read:uint24(addr)
local returnStr = ""
returnStr = returnStr .. string.format("%02x", readMemory(addr + 2, 1):byte())
returnStr = returnStr .. string.format("%02x", readMemory(addr + 1, 1):byte())
returnStr = returnStr .. string.format("%02x", readMemory(addr, 1):byte())
return tonumber(returnStr, 16)
end
function kmem.read:uint32(addr)
local blankName, upFunction = debug.getupvalue(ipairs, 1)
debug.setupvalue(ipairs, 1, UInt32ToDouble(addr - 8))
local addrFunction = ipairs({})
debug.setupvalue(ipairs, 1, upFunction)
local fenvAddrNameFN = debug.getfenv(addrFunction)
local memeAddress = tonumber(string.format("%p", fenvAddrNameFN), 16)
return memeAddress
end[/code]
test it urself:
[code]if !kmem or !kmem.read then
error("kmem library required")
return
end
local test = "oof"
print(kmem.read:uint32(kmem.util:address(test) + 12))
/*
typedef struct GCheader{
GCObject*next; // 4
lu_byte tt; // 5
lu_byte marked; // 6
}GCheader; // 6 bytes
typedef struct GCstr {
GCHeader; // 6
uint8_t reserved; // 7
uint8_t unused; // 8
MSize hash; // 12
MSize len; // 16 -- reading this, ends at 16 starts at 12
} GCstr; // 16 bytes
*/[/code]
We're gonna loose the debug library at this rate.
[url]https://github.com/LuaJIT/LuaJIT/issues/338[/url]
I've reported about the few bugs I found with normal LuaJIT here that have or are going to be patched in gmod.
I also take the blame for this getting out to the public because I supplied someone with this code.
[reposted from his other thread, sorry]
experimenting with custom npcs.
[video=youtube;2AnbWtala7k]https://www.youtube.com/watch?v=2AnbWtala7k[/video]
Nothing special, just some permanent weapons stuff.
[video=youtube;VVZXWenhNX8]https://www.youtube.com/watch?v=VVZXWenhNX8[/video]
I started working on various symptoms for my pathogen gamemode thing. I decided I needed to somehow simulate the feeling of dizziness, so after a bit of spinning about IRL and experiencing it myself I figured out how I'd best be able to replicate the feeling ingame. The effect is show in the video below:
[B]THIS CAN GIVE PEOPLE MOTION SICKNESS![/B]
[video]https://youtu.be/tUiAx-c9CPc[/video]
[QUOTE=raubana;52407954]I started working on various symptoms for my pathogen gamemode thing. I decided I needed to somehow simulate the feeling of dizziness, so after a bit of spinning about IRL and experiencing it myself I figured out how I'd best be able to replicate the feeling ingame. The effect is show in the video below:
[B]THIS CAN GIVE PEOPLE MOTION SICKNESS![/B][/QUOTE]
At first glance, I didn't think it was supposed to be dizziness since it only happened as you walked around and not when you stay still.
Do you it would look more like dizziness if you keep the view-effect constantly going and town down the severity so it doesn't get too crazy?
[QUOTE=raubana;52407954]I started working on various symptoms for my pathogen gamemode thing. I decided I needed to somehow simulate the feeling of dizziness, so after a bit of spinning about IRL and experiencing it myself I figured out how I'd best be able to replicate the feeling ingame.[/QUOTE]
My 2 cents: If you really wanna make the user feel dizzy change the angles in a somewhat circular motion. Also the screen tilt is a bit too extreme at the max values, feels unnatural.
[QUOTE=Katazuro;52408069]At first glance, I didn't think it was supposed to be dizziness since it only happened as you walked around and not when you stay still.
Do you it would look more like dizziness if you keep the view-effect constantly going and town down the severity so it doesn't get too crazy?[/QUOTE]
[QUOTE=JasonMan34;52408105]My 2 cents: If you really wanna make the user feel dizzy change the angles in a somewhat circular motion. Also the screen tilt is a bit too extreme at the max values, feels unnatural.[/QUOTE]
Ok I hear what you're both saying, but I've already taken these ideas into account.
Starting with Katazuro's comment about keeping the movement constant, the trouble is that the effect is meant to be subtle as it transitions from 0 to 100 (as the player becomes "sick"). If their view were constantly moving, a player might notice the flickering artifacts on the edges of geometries when they're motionless, which would make the symptom too obvious too soon. This compromise - where it only changes when you move - makes the gradual transition much less obvious.
The other thing is that this effect makes much more sense when you're playing the game yourself. The feeling is a bit bizarre, as you tend to move in directions that contradict your expectations. Watching someone experience the effect usually isn't enough to convey the feeling, as it's more about that difference between the input, the expected output, and the actual output. Our bodies attempting to adapt to this ever-changing difference is what I believe creates this feeling of being dizzy.
EDIT: Dizziness might be the wrong word, maybe vertigo is better?
[video=youtube;AvcDb7p5K_k]https://www.youtube.com/watch?v=AvcDb7p5K_k[/video]
Don't mind me. Just making more gamemodes that nobody will ever play. This is gm_flatgrass, by the way.
As a forewarning, the video is pretty loud.
Got bored and decided to play around with an Entity.
[QUOTE][vid]https://s1.webmshare.com/GG191.webm[/vid][/QUOTE]
[QUOTE=Wepl123;52406844]leaning[/QUOTE]
What does it look like when other players look at you leaning?
[QUOTE=XxLMM13xXx;52410893]What does it look like when other players look at you leaning?[/QUOTE]
And if it does have a thirdperson animation, do the hitboxes match the animation?
[QUOTE=XxLMM13xXx;52410893]What does it look like when other players look at you leaning?[/QUOTE]
[video=youtube;wQYbO_D_FRU]https://www.youtube.com/watch?v=wQYbO_D_FRU&feature=youtu.be[/video]
[QUOTE=bobbleheadbob;52410920]And if it does have a thirdperson animation, do the hitboxes match the animation?[/QUOTE]
As far as I could tell, there is no way to edit the player's hitbox bones through pure lua. The best workaround I could find was to change the player's hull size (only when nessecary) to more accurately match the player when they were leaning, and use that for hit detection only for when they are leaning. I thought it would cause a lot of issues, but the detection isn't that bad and the only way you're able to get stuck is if you're deliberately trying to, and I implemented a few more quick checks to further reduce the chances of getting stuck and I haven't been able to get stuck again even against more complex geometry (arches, stuff at odd heights, etc).
Also, the reason I 'lost' the magazine from the weapon is because I created some optional behavior where if you interrupt the reload animation before a certain point, you 'drop' your magazine and have to get a new one to reload.
[QUOTE=Wepl123;52411035]facepunchers doubt lua coding prodigy wepl123 in his own realm, garrysmod, a source based sandb[/QUOTE]
No one was doubting you i was just curious. However looks pretty sweet!
[QUOTE=XxLMM13xXx;52411388]No one was doubting you i was just curious. However looks pretty sweet![/QUOTE]
No worries, your kind and generous lua god forgives you (this time).
Heres the finished reload behavior I was talking about:
[video=youtube;7oBp98OATFA]https://www.youtube.com/watch?v=7oBp98OATFA&feature=youtu.be[/video]
Going to make it optional (and defaulted to off) because I'm assuming it will either confuse people or they just wont like it. Thought it'd be fun to make anyways, don't think I've seen any other SWEPs do this kind of thing before, or atleast to this extent.
(also, it only drops the mag when past a certain point, you can interrupt the animations and as long as you do it early on you wont lose your magazine)
Are you integrating those animations directly or doing it through lua? If it's the former I really want to add those suckers as an extension. That, proning, and rolling would be sick
[QUOTE=solid_jake;52412728]Are you integrating those animations directly or doing it through lua? If it's the former I really want to add those suckers as an extension. That, proning, and rolling would be sick[/QUOTE]
Lua at the moment, but I was going to experiment with getting actual leaning animations tomorrow (so I dont have to do any hull changes, and can always rely on the more accurate bone hitboxes) and if I get something good I'll message you
[QUOTE=Wepl123;52411035]
As far as I could tell, there is no way to edit the player's hitbox bones through pure lua. [/QUOTE]
You can actually do something similar like that with EntityFireBullet
[editline]29th June 2017[/editline]
[media]https://www.youtube.com/watch?v=2Zc52-dFcaA&feature=youtu.be[/media]
[QUOTE=rebel1324;52413080]You can actually do something similar like that with EntityFireBullet
[editline]29th June 2017[/editline]
[media]https://www.youtube.com/watch?v=2Zc52-dFcaA&feature=youtu.be[/media][/QUOTE]
Hmm, I'm assuming before you pass the bullet through you trace to see if it hits the bounding box and if you do, then suppress it?
I COULD apply something like that, maybe an invisible entity that blocks bullets at the original position, and detects bullets at the actual position. Unless you had a better solution?
[QUOTE=Wepl123;52413377]Hmm, I'm assuming before you pass the bullet through you trace to see if it hits the bounding box and if you do, then suppress it?
I COULD apply something like that, maybe an invisible entity that blocks bullets at the original position, and detects bullets at the actual position. Unless you had a better solution?[/QUOTE]
I was just thinking you could use a Lua FireBullets port and use some complex cliptrace math to orient the trace based on the bones, instead, but that would be a lot of extra overhead.
Working on a little SQLite tool for GCompute to make it easier to run some quick queries ingame:
[img]http://i.imgur.com/Xdsikyq.png[/img]
[QUOTE=Kamshak;52415244]Working on a little SQLite tool for GCompute to make it easier to run some quick queries ingame:
[/QUOTE]
Speaking of which, why is MySQL not supported by default? I think it's a little ridiculous to require people to install third-party DLL files for what is such a necessary feature.
Why do you think it's necessary? If I were to run a server, the gamemodes I would run would require no databases. And admin tools don't need MySQL to work.
[QUOTE=wauterboi;52415931]Why do you think it's necessary? If I were to run a server, the gamemodes I would run would require no databases. And admin tools don't need MySQL to work.[/QUOTE]
You can make this argument about anything included with the game. It'd be very useful to have it included with the mod, it's a widely used database across gamemodes and addons.
Just because you don't use it doesn't mean no one else will - lots of my scripts share data with other scripts and support multiple servers + syncing with web content. Heck, the most popular gamemode in this game ships with MySQL support.
I could see you arguing that Postgres or MongoDB shouldn't be included, but MySQL?
Sorry, you need to Log In to post a reply to this thread.