Just added a video tutorial for this! [ame="http://www.youtube.com/watch?v=nl0vntURFFc"]YouTube - Enginn's tutorial #1 - Basic landmine (Gates and E2)[/ame]
Pictures of finished products on bottom!
Part 1 - Building the contraption (Regular gate style)
1. First spawn a PHX 1x1 plate, freeze it.
2. Place a "Speedometer" onto it, it is under Wire - Detection.
3. Place an "Not equal" chip onto the plate, it is under Gate - Comparison.
4. Place a "Constant value" on to the plate with 1 value and that value should be 0, it is under Wire - I/O.
5. Place a wired "Button" onto the plate toggled with Value on: 1 and Value off: 0, it is under Wire - I/O.
6. Place an "And (all)" chip onto the plate, it is under Gate - Logic.
7. Place an "Explosive" and make sure the trigger value is at 1 other options are up to you, it is under Wire - Physics.
8. If you got the weight tool then make the plate weigh 1000 that way it won't move when the Explosing goes off.
Part 2 - Wiring it all up (Regular gate style)
1. Wire the A input of the "Not equal" chip to the "Speedometer" Out ouput.
2. Wire the B input of the "Not equal" chip to the "Constant value" of 0.
3. Wire the A input of the "And (all)" chip to the "Not Equal" chip.
4. Wire the B input of the "And (all)" chip to the "Button".
5. Wire the Detonate input of the "Explosive" to the "And (all)" chip.
Part 3 - Explaining how this works (Regular gate style)
If the "Speedometer" is "Not equal" to 0, in other words if it is moving it will output 1. The "And (all)" chip then checks if both the "Not equal" chip and the Button are at 1, if both are the "And (all)" chip will output 1 and thus the "Explosive" detonates. The thing about the "And (all)" chip is if any of the inputs is not 1 it will output 0.
------------------------------------------------------------------------------
Part 1 - Building the contraption (Expression style)
1. First spawn a PHX 1x1 plate, freeze it.
2. Place a "Speedometer" onto it, it is under Wire - Detection.
3. Place a wired "Button" onto the plate toggled with Value on: 1 and Value off: 0, it is under Wire - I/O.
4. Place an "Explosive" and make sure the trigger value is at 1 other options are up to you, it is under Wire - Physics.
Part 2 - The expression 2
e2 Code:
@name Simple Landmine
@inputs Button Speedometer
@outputs Detonate
@trigger all
#If the speedometer does not equal 0 and the button is 1 then Detonate is 1
if (Speedometer!=0 & Button) {Detonate=1}
#else if one or both of the above are not equal to 1 Detonate is 0
else {Detonate=0}
Copy and paste the code and place the expression
Part 3 - Wiring it all up (Expression style)
1. Wire the "Speedometer" input of the expression to the "Speedometer".
2. Wire the "Button" input of the expression to the "Button".
3. Wire the Explosives "Detonate" to the "Detonate" output of the expression.
Part 4 - Fundamentals of the expression 2
@inputs Are variables that you feed to the expression, they are seperated with spaces and must always start with a capital letter.
@outputs Is info the expression can feed to other chips and components, they are also seperated with spaces and must always start with a captial letter.
@trigger all Makes everything trigger the expression to run it's code again, for example the button or the speedometer.
# These are just comments to help you remember what certain parts do or help people in an easy way.
if You might notice this, it makes the expression ask if what is inside the brackts () is true, if so run the code in the curly brackets {}. This is how you use if statements.
else this makes it run if the above is not true, run the code in the curly brackets after the else.
Part 5 - Better understanding of the expression used
Line 1: e2 Code:
if (Speedometer!=0 & Button) {Detonate=1}
!= means not equal like the chip we used, and the 0 is the same as our constant value.
A neet thing about the expression 2 is you don't have to type out the full code you can use short versions like to check if a variable is equal to 1 you just type in the name like I did with Button. If you would like to check if the Button is equal to 0 we simply type in !Button.
And then in the curly brackets it sets Detonate to 1 thus the explosive explodes if both of those variables are true, that's why I used the & to check if both are equal to 1.
Line 2: This is pretty much straightforward, if the code in the line above is not true then execute the code in the curly brackets or in other words. If the Button is not at 1 or the Speedometer is not moving don't explode.
------------------------------------------------------------------------------
This will not work if you freeze the prop, than it can't move and won't explode. Have fun, but remember don't spam this on servers or you might get banned. Playing in the corner is okay but don't be a minge and place this on the spawn of a map.
-Thanks for reading!

Bookmarks