Garry's Mod

Garry's Mod

Not enough ratings
Pandemonium: Effect Creation Guide
By lambups
This guide will teach you how to make your own effects for Pandemonium
   
Award
Favorite
Favorited
Unfavorite
Introduction
You might or might not like the default effects included, so here's how to make your own.
Start by making a folder in your addons folder, name it whatever you want, I will name mine "boogeraids"

Now make 2 folders named "lua" and one named "cooprandom" inside the "lua" folder you just created.
Your file path should now be like so:

Now that your file structure is done, let's get on with the actual effect.
The actual effect
You now create a file in the folders you just created, name it however you want:

The skeleton code of an effect looks like this:
AddCSLuaFile() local effect = { name = "Nothing", time = 0, ServerInit = function() end, ServerPerPlayer = function(ply) end, ServerEffectOver = function() end, ClientInit = function() end, ClientEffectOver = function() end, ServerHooks = {}, ClientHooks = {}, SharedHooks = {}, Condition = function() return true end } return effect
Let's go over all the properties:
  • name - Name of the effect, displayed in HUD
  • time - Time duration of the effect in seconds, 0 means it's a one time effect
  • ServerInit - Function that runs on the server once when the effect is obtained
  • ServerPerPlayer - Function that runs on the server once for every player that is connected, has the player it's being ran on as an argument
  • ServerEffectOver - Function that runs on the server once when the effect is over, never runs if the time is set to 0
  • ClientInit - Function that runs on every client once when the effect is obtained
  • ClientEffectOver - Function that runs on every client once when the effect is over, never runs if the time is set to 0
  • ServerHooks, ClientHooks, SharedHooks - These tables contain hooks that get created and removed automatically in each realm.
  • Condition - Function that runs before all other functions, return true or false to allow or prevent this effect from being obtained
Shared/Client/Server Hooks
You might be wondering, how do the hooks work in the tables?
Simple! Add the name of the hook as an element of the table and give it a function value.
SharedHooks = { Think = function() RunConsoleCommand("help") end, StartCommand = function(ply, ucmd) ucmd:ClearMovement() end }
This is an example that runs the command "help" on every tick and makes the player unable to move.
These also apply to ClientHooks and ServerHooks, only those will run in their respective realms.
Outroduction
Why did I name this section "Outroduction"?
That is all you need to know, the rest is up to you.
3 Comments
Gort 26 Jun, 2023 @ 8:39pm 
youtube link
lambups  [author] 26 Jun, 2023 @ 5:08pm 
finally a comment that is not a youtube link
no1nct 26 Jun, 2023 @ 5:06pm 
i love you