Garry's Mod

Garry's Mod

151 ratings
[Wiremod] (Part 1) Intro to Wiremod : The Basics
By froggcore
If you have wondered how people make incredible devices, they probably used Wiremod. I am now going to show you how they do it, and today we'll be covering the fundamentals of Wiremod!
   
Award
Favorite
Favorited
Unfavorite
- PART 3 ARCHIVES RELEASED -
If you've wanted a more in-depth explanation of many of the different gates within Wiremod, I have released a nearly 8 year old write-up on just that! I currently do not plan on finishing Part 3, which ends with Vectors and beyond unfinished unless there is a heavy interest from all of you. Reach out to me if you have any questions. Please follow the link below to the final, Part 3, of the Intro to Wiremod guides:

https://steamproxy.net/sharedfiles/filedetails/?id=288806940

THE VIDEO
If you don't want to read all of this, watch this instead.

However if you want a more in-depth explanation for things, I suggest you read on!

Links, Honorable Mentions and Other Things!
Before you go on reading and doing these tutorials on your game, make sure to check out these links so that you have all of the content you need to do these tutorials:

Links

(Required) Wiremod

(Recommended) Advanced Duplicator

(Recommended) SmartSnap

(Recommended) Precision Tool

(Optional) Multi Parent/Unparent

(Optional) SProps

(Optional) GB-Radial menu V2.0

(Optional, but for other tutorials) Stacker STool

Honorable Mentions

I would like to point a quick shoutout to Dysnomia Gaming. Since late August I have owned the server, taking over from our former owner to keep the wonderful sandbox server operating as nicely if not nicer than before. If you ever need a server to build on with respectful admins on good maps such as the classic gm_flatgrass, gm_construct or the elaborate gm_excess_construct 13, then you should come check us out!

(To make sure the title is complete!) Other Things!

I will mention it below but be warned that this is a very lengthy dual-segment tutorial. It will cover:
  • What Wiremod is and what are the branches of it
  • What Inputs and Outputs are and how to use them
  • What a button is and how to use them
  • How to create a bare-bones toggleable turret
  • How to wire things together with Wire Advanced Tool
  • How to make a 2-way Elevator
  • How a Hydraulic works
  • How a Smoother Gate works

I did my best to provide illustrations, both in game and using some simple diagrams to help you visualize the connections. (since I do not use visible wires when I wire things together) I have already stated this at the end, but if you need ANY questions answered, or you need one-on-one help, don't hesitate to ask me. If you don't feel like asking me then you can come on our server at Dysnomia Gaming, just search it in the in-game browser for Sandbox and it should come up eventually. You can ask any of our admins that know how to do wiremod, or if I am on myself you can ask me too.

Now to the tutorials!
Introduction : What is Wiremod?

Hello there, and let me make it quick so you know what you are getting yourself into; read further if you wish to learn how to use Gates, know basic Algebra, and have the capacity to learn by yourself.

My name is Mike, or you can refer to me as Twig if you prefer that. Before we begin, as stated above, everyone reading this needs to pay attention to the following sections of the tutorial before I even begin explaining how you make these things. Wiremod is a mod for Garry's Mod that adds mathematical, LUA coding, and other mechanisms that let you create your own devices dependent on your taste.

Basically, you have two core paths you can follow when it comes to this mod: Gates, and Expression 2, or as people commonly refer to them as E2.
What are Gates?

Gates are a system of chips that allow you to connect devices and let numbers and other characters compare and number crunch values to do certain things you want them to. For example, you can create a set of gates that lets you open a sliding door on both sides. Another example is to create a turret that automatically shoots at enemies when they get too close to it.

This is also the laggier approach to Wiremod when you start creating large circuits that do more than just open and close a door, such as automatic targeting systems, fully-functioning vehicles with realistic controls or auto-tracking missiles.
What are Expression 2s?
Expression 2 (E2) is when your knowledge with programs such as C++, Python or LUA in general can come in handy in Garry's Mod. Generally, this is for people who prefer coding over number crunching. I personally am not someone that uses E2's, and in tutorials in the far future I will use E2's to save on gate space, or to use things called Console Screens. E2's have dozens of different commands and syntax you can use to create things very similarly to how you can with gates, all on one chip.

For example, if you wanted a door to go up 100 units when you pressed a regular button, you would have something tell the E2 "If the button is pressed in and is on, then tell the door to extend 100 units" and then when it is not pressed, "If the button is not pressed in and is off, then tell the door to retract back to 0 units". Like the core words in those two examples are, If and Then; they are some of the very basic and most common function lines you will see in an E2. Unfortunately for people that want to learn how to make things with E2, this is not the place you should be looking.

Like I said I am primarily a person that uses gates to create devices and circuits.
What are Inputs and Outputs?
To help visualize what is going on, I will illustrate this including much of the wiring from here-on.

Wiremod, whether it be E2 or Gates, all works around separate Inputs and Outputs. An Input is, you guessed it, something that goes into something: in this case a Value. An Output is, you better have guessed it by now too, something that goes out of something.


Here is a good example to wrap your head around; when you click a button that is toggle-able, when it is "ON" it is technically "1". It is outputting a value of 1. Now, when you click the button again, it will be "OFF", or in our case, "0". Much of Wiremod circulates around 1 and 0, and they are fundamental power toggles for dozens of devices and gates. All you need to remember is that 1 = ON and 0 = OFF; once you get a hang of that, you can really start to come up with some cool stuff.


Tutorial 1 : The Button
Like mentioned before, you can have toggle-able buttons that can either output a 1 or a 0. However, that is their default function. If you wanted to create specific things that needed a different output when it was turned on, you could change that in the settings for the Wire Button Tool. When you do this, instead of outputting a 1 when you click it, it will instead output it to whatever you changed. So if you changed it to 50, when you click the button and turn it on, it is now outputting a "50", and no longer a 1. This is useful for people who want just one button to toggle an elevator that goes up and down with one button.

Buttons come in all sorts of models, shapes and colors. It does not matter what the button looks like; all buttons will perform the same way no matter what you choose. To find the Wire Button, hold Q in a sandbox server and where there are tabs on the top-right of your screen such as "Tools", "Options" and "Utilities", you want to click on the one that says "Wire". Once there, you will be greeted with several tabs with "Wire - " in front of them. The one you want to look for is "Wire - I/O". This is the tab you will find many of your buttons, keypads, levers and other devices that let someone interact with Wiremod and change a value manually. Everything is listed alphabetically form A-Z so once you find "Button", click on it and look at it's controls. It has a list of models, small and large (on the tabs on the top), and 4 extra options on the bottom.


Toggle should be kept off if you just want it to do something if you are holding it, or just click it once. If you want it to do something forever until you click it again, then keep toggle on. Ignore Output Entity, since you don't need to use that for many things we will be making, if there ever is something we need to use it for anyways. Now here is the part I mentioned before, there are two sliders with numbers next to them that say "Value On" and "Value Off". These are the two numbers I referred to earlier. Value On, is for whenever the button, is ON. The number to the right of the slider is the number it will send if it is on. For Value Off, it will send the number on the right of THAT slider whenever the button is Not ON.

Tutorial 1 Continued : Using The Button
Now that I have explained how the button works, this is how I want to show you how it works. We are going to make a simple turret that fires bullets when we click the button, and stops when we click it again.

First, go to your Q menu and go to General Construction Props on the left menu under your spawn lists. Once you spawned it just use your PhysGun and position it somewhere that is comfortable for you to work on. (preferably at chest height so that the top of the plate is just above your head)


Next, go to the Wire Tab (if you aren't already) and equip the Button tool where I showed you it was. Make sure that Toggle is checked, and Output Entity is not. Make sure that Value On is 1 and Value Off is 0. If it is not, highlight the numbers that are not and type the number in manually.


Once you placed it on one side, we're going to want to spawn a Turret on this baby. The tab below Wire - I/O is "Wire - Physics". From here, scroll until you see Turret.


In here there will be more options than you saw for the Button. For efficiency, make sure that Damage and Bullet Force are pushed all the way to the right with the slider; Damage should be 100 and Bullet Force should be 500. Do not modify Delay or Bullet Spread, because if you increase the spread the turret will be inaccurate, and if you increase the delay your turret will shoot too slow. You can also change your tracer if you want a different looking bullet when it gets shot out, personally I like the default tracer since it looks more like a smaller bullet. (and lags less) Now above are some models that are available for you to use as the turret model. It doesn't matter which we use, but for now I will use the M16 model. Once you have a model chosen and your settings are like mine, now place the turret on the other flat side of the plate that the button is not on.

We have all the components we need to make the turret. Now here is where the fun part about Wiremod comes to life. It is time to wire this all together! There is no right-click option, or C-menu option to wire, it is simply done on a separate tool made for this mod called Wire Advanced. There is another tool called Wire Legacy, which was the original wiring tool made when this mod was first created years ago, but since we have Wire Advanced Tool, and it is easier to read all of our inputs and outputs, we will be using this tool for all of my tutorials. To find this tool, scroll down to the very last tab until you see a tab called "Wire - Tools". At the bottom you will find the tool we are looking for, Wire Advanced Tool.


Click on it so you are holding it, and before we wire anything let's look at the options the tool gives us. We can change the type of wire physically so it looks differently. I do not use physically showing wires, because I think it detracts from projects. Future tutorials will have each step listed step-by-step in a list instead of clustered inside of these paragraphs. I am doing more explaining than showing how to do things, and that is important for you to learn this way.

If you look at the turret you spawned in with the Wire Advanced Tool, you will see a blue box appear on the right of the middle of your screen that says "Fire". If you haven't guessed so already, this is what makes the turret fire. It is selected as an INPUT. This means that, something must give this turret a value, to FIRE. Exactly what I was mentioning earlier about devices using 0 and 1 to interact with the world. When Fire = 1, it will fire, but if Fire = 0, it will not fire. So with that in mind, and the fact that buttons will output a 1 when they are on, and a 0 when they are off, we want to harness the value the button sends and use it with the turret. The way we do this is by telling the Turret to fire whenever it gets a value from the button. With the Wire Advanced Tool out, hover over the Turret and left-click on the Fire value. Now you will hear a click and it should be selected and if you look around the Fire value is still there. Now, we want to connect it to the button. Hover over the button on the other side of your panel, and it will say "Out". This stands for Output, and now we just click on the button.


What we have done here, is we have connected a Turret to a Button. When the Button is pressed and is on, it will Output a 1 to the Turret. Since the Turret needs a 1 to fire, it will then fire continuously. If you click the button again, it will now be "Off" and output a 0. Since the Turret needs that 1 to fire, when it receives a 0, it can no longer fire and therefore stops firing. You have just created a bare-bones turret.
Tutorial 2 : Simple 2-Way Elevator
To continue with buttons, I will show you one last basic creation you can make with Wiremod. You have learned how buttons work, how turrets work, and how to connect them to work together. With buttons in mind, remember that they can be toggled and that you can change their ON value and their OFF value. This is what we want to do.


If you are on Construct this is exceptionally useful since it is full of different flat elevations for constructing something like an elevator, therefore this will go smoother for you since you can follow along exactly as I am doing. On Construct, go to the left of spawn when you spawn, near the slanted pathway that goes to the top of the building behind spawn. Next to the wall that is to the right of the last slit in the wall is where we want to make our elevator. To start, go to where you spawned that plate for the turret, but this time, spawn the 2 x 2 version that is twice the length and width. Spawn two of these so we have a base and a platform for which will act as the actual elevator. Straighten them as well as you can so they are flush against the wall, and on top of each other. If you have the precision tool from the workshop this makes your job much easier.


You can get any of the essential tools/mods I use at the top of this post.

Find a way that best suits you to get the top platform to have a decent sized space between itself and the bottom plate. It needs to be large enough for you to fit your head in so you can work with it in no-clip. Now you are wondering "Why is he having us place a plate above another plate?", well the answer is that we are going to use something called a Wire Hydraulic. If you have ever used the regular Hydraulic constraint in the default tools, you can expect what we are about to do. A Hydraulic is a constraint that extends and contracts according to whatever value you give it. In Wiremod, the way we tell it what length we want it to extend to is through a Wire Hydraulic Controller, and we need to create the hydraulic before we can spawn one of these.

Under the same tab you found the Turret, look for a tool that says Hydraulic.


You will be greeted with a few options, and the only one you want to change is the check box next to Fixed. Make sure that Fixed is checked, so that it will be a solid movement up and down. You can change the width and the look of the rope with the optional settings in there, but it will not effect the outcome of the elevator. Just do not touch any of the other settings because they will alter how this works. To use this Hydraulic now, with that gap of space you left between the two plates (assuming that you froze the two in mid air), aim as good as you can at the center of the bottom of the plate above you, and right-click with the Hydraulic tool out. This should automatically create the hydraulic starting from the point you right-clicked, to the opposite point behind you. Now you need to place the Hydraulic Controller.


Go back to the surface and get out of no-clip and left-click somewhere on top of the platform for the elevator. You should see a white looking thing with a black base: you have now successfully created the hydraulic.


Now that you have a working hydraulic, we need to use it with a button, but before we attach it to a button there is something that needs to be addressed. If you directly wire a button to the hydraulic controller, when you give it a custom height, it will automatically go to that length as fast as it can. If you were on the platform, it would shoot you into the sky, and drop down faster than gravity can keep you on the platform.
Tutorial 2 Continued : The Smoother Gate
To fix this, I am going to introduce you to your first gate: the Smoother gate. The smoother gate makes a certain value take longer to reach it's final destination. It's a little hard to explain, but once you see it working you will understand it more. To get this gate, scroll to the very top of all of the Wire tabs and look for the "Wire - Control" tab.


Once here, you will see many folders to the right. The one we are looking for is Time, so go on and open that and a small list of gates will be in this folder. We want Smoother, so go on and double click that to equip it. Place it on your top platform.

Next we need something to tell it how much it should be adding to the length at a time, so we need something called a Constant Value. This will be one of your most commonly used chips. What they do is exactly what they say, they are constant values that never change. We are going to find this under Wire - I/O like how we found our button. When you find it, there will be a couple options, including the ability to change the model. All we need is one value so don't change the slider number. Where it says 0, highlight it and type in 104. I have already done the math for this height, and it is half of the total height it is from the bottom of the plate to the top of the building. If you are doing this on another map, unfreeze the platform, and guide the platform slightly above the edge of whatever surface you're trying to reach and look at the hydraulic controller. There will be a popup box and there will be something that says "Hydraulic Length: ". The number after this is what you want to write down somewhere. If your destination with this elevator is taller than the one I am doing on Construct, you may need to find half of the halve you got from the maxiumum. What I mean is if your total height is 500, and from what I'm saying you'd need to put 250 in the constant value, instead of putting 250, put 125. The lower the number, the slower the elevator will go up: keep that in mind.


Now that you have entered 104, or whatever 1/2 of the total height is, into your constant value, now it is time to place it on the platform near your Smoother Gate. The last thing we need to add is a Button. In order for this to work, we need to change the On Value of the button. To do that, go to Wire - I/O where you found the Button before, and look at the options for it. Where it says "Value On", we need to change THAT value. Just highlight the 1 at the end, and manually type 208. This is the full height from the bottom of spawn to the top of the building. We need it to be the full one here because it needs to know what the final length for the hydralic must be. The hydralic extends and it has a length, so if we told it 104 it would only go half the way up. Make sure that Toggle is on, and that Value On is 208 and then spawn it somewhere on the center of the top of your platform.


Now that we have everything, it's time to wire it all together! Grab the Wire Advanced Tool, and look at the Smoother Gate. We will have two inputs on this, and the first one is A. A is just a letter, yes, and it's the input that tells it in this case what the final number will be. I we give 208 to the A input, it is the smoother's job to reach 208 from 0, depending on how long we take it to reach it. Like I said, the lower the number, the slower it will take to get there. So while hovering over the Smoother gate, wire A to the Button's "Out", like I mentioned earlier, this stands for the Button's output. Now that we have wired that, hover over the Smoother gate again, and either right-click or use your scroll wheel to look at the second input, "Rate". This input stands for the rate that the smoother operates. Just like I said, the smaller the number, the slower it will reach 208. For this, wire Rate of the Smoother and then go to the Constant value and click on 104. This will wire Rate to 104 and will wire A to the Button.

All we need to do now is tell the Hydraulic what length it should be. To do this, look at the Hydraulic Controller and look at it's inputs. We have Length, In, Out, Constant and Damping. We don't need any of these besides Length, since we're telling the Hydraulic what length we want it to be at. If you aren't scrolled to it already, scroll towards Length, and left-click on it, then look at the Smoother. You will no longer see inputs that you saw before, but now you will see "Outputs:" and the only input is "Out", like on the Button, this stands for Output. Left-click on Out on the Smoother, and you're done.


What you have just done, is you have told the smoother to increase to 208 104 units per second, and the length of the hydraulic is whatever the Smoother outputs. With that in mind, if we click the button ON, the Smoother will go 0......104......208, and finish. Whatever smaller numbers in between is why the name is given "Smoother". The more numbers the hydraulic is given in between lengths is going to make them work a lot nicer than without having them.
In conclusion...
I am sorry if this was a hell of a lot to read, because it sure was a hell of a lot to type. I promise you this will only get faster from here-on, and so will my tutorials. I will be writing less and less, assuming you understand the fundamentals that you should understand now. There is much more to learn, and you have only just begun learning with Wiremod. I hope that you take this information and experiment on your own. Ask people that know how to make things with wiremod for questions on how to do something. You will only learn by experimenting or watching other people make things. If you have people make things for you, you will more than likely not learn much by yourself other than how they made THAT device if you do it that way. What I want you to take away from here is that you know how to: use buttons to toggle certain things on and off, use inputs and outputs separately and understand how they work together, and learn most of this on your own.

There is no other nice way of saying it. People on YouTube and the Wiremod forums make it look easy for people, but they all learned the hard way. I learned the hard way, through experimentation and researching how to use certain wiremod components. The tutorials in the near future will be a fraction of the length of this one. I did not mean to scare anyone off, I only want people to understand this as precisely as possible. All you need to take away about how Wiremod works is that it uses numbers, and algebra-related mathematics. You can also learn how to use E2 as well, but like I mentioned I am not responsible for teaching you how to make them. I may use one or two throughout tutorials as optional methods for reducing gate space, but other than that all you are going to see here is gates. stay tuned for more tutorials, because I am sure to educate every one of you that is willing to learn how to really use Wiremod. If you have any comments, concerns or suggestions for devices to make post them below or give me a hit and send me a friend invite and message on Steam; I will be more than willing to answer your questions or give you one-on-one help.
Next Time...
Next time, we will be looking at how to make an Automatic Sliding Door and how to make a two-way button door!

Update: Part 2 is done! (Part 2) Intro to Wiremod : Extended Basics

Update: holy brap lois it's (Part 3!!!11) Intro to Wiremod : The Basics

Ask me to make something! I might make it in a future tutorial! Don't ask me to do E2 because I won't reply! Sorry! Exclamation Points!
34 Comments
Teeheehee14 23 Mar @ 12:20pm 
yoyoyo twig how u doing just wanna check in
froggcore  [author] 9 Apr, 2023 @ 2:16pm 
@liz

it's been a while since I've personally messed with wiremod this way myself, but the best chances for making this work without E2 is using a wiremod plugin that allows you to spawn in contraptions that are saved with the advanced duplicator (1 or 2, also don't remember). That would let you spawn fully made missiles/projectiles that can automatically be picked up by the "launcher" with a wireless signal that pairs it to the ammunition. I did this for a surface-to-surface missile launcher that launched javelin-style missiles into the air towards their target... Worth looking into!
SilverSystem 4 Dec, 2021 @ 8:49am 
Sorry to comment yet again with a benign query on the long-dead art of Wiremod, but is there any way to make anything even vaguely resembling a rocket launcher in function? So far the closest thing I've found is the Prop Spawner being able to spawn explosive barrels, but even then, how those barrels get from Point A to Point B is largely unknown without manually slapping on and wiring up thrusters, as well, how the barrels detonate is another story entirely.
Anybody have a clue as to how I could do this without having to
A, manually make the rockets
Or B, manually load the rockets
?
SilverSystem 20 Sep, 2021 @ 2:33am 
Thank you!
froggcore  [author] 20 Sep, 2021 @ 12:12am 
Liz, you'll want to connect a Pod Controller (Advanced) to the vehicle seat, then wire the appropriate keys to whatever you're using to propel your vehicle i.e. wheels, thrusters, propellers with the Fin Tool, let me know if that helps
SilverSystem 25 Jul, 2021 @ 8:40am 
I wanna know how to make a vehicle that uses WASD controls, but only when you're sitting in the seat. Anybody know how I might do this?
froggcore  [author] 18 Apr, 2020 @ 9:27pm 
And no once created can't change
froggcore  [author] 18 Apr, 2020 @ 9:27pm 
You just resize the wire size to 0 (or 0.1 I forget I haven't played since the dark ages) :)
Widukind 24 Feb, 2020 @ 9:43pm 
Is there anyway to hide my wires after being done? I prefer to use the arrows . but they look ugly can I switch them to width 0 afterwards?
BONANGER1 9 Dec, 2019 @ 7:34am 
i dont have an wire advanced tool