![]() |
|
Release Descending Bridge E2 - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html) +--- Thread: Release Descending Bridge E2 (/thread-1964.html) |
Descending Bridge E2 - Sharp - 09-10-2016 This E2 uses setPos to descend your bridge into the hull. It works with 3 entities, but you can add more or even better, parent things to those entities to take it with them. Thanks to ATM who provided me with the original code on which I based this on. Code: @name DescendingBridge
@inputs [Door1 Door2 Door3]:entity Input
@outputs CD STATE
@persist MOVE SOUND:string CD STATE
@trigger
SOUND = "doors/doormove2.wav"
if(first()){
MOVE = 0
CD = 0
STATE = 0
}
if(Input & CD == 0){
CD = 1
if(STATE == 0)
{
STATE = 1
timer("moveout", 50)
entity():soundPlay(1, 0, SOUND)
}elseif(STATE == 1){
STATE = 0
timer("movein", 50)
entity():soundPlay(2, 0, SOUND)
}
}
if(clk("moveout")){
Door1:setPos(Door1:pos()+vec(0, 0, -2.5))
Door2:setPos(Door2:pos()+vec(0, 0, -2.5))
Door3:setPos(Door3:pos()+vec(0, 0, -2.5))
timer("moveout", 1)
MOVE++
if(MOVE == 60){
stoptimer("moveout")
MOVE = 0
soundStop(1)
CD = 0
}
}
if(clk("movein")){
Door1:setPos(Door1:pos()+vec(0, 0, 2.5))
Door2:setPos(Door2:pos()+vec(0, 0, 2.5))
Door3:setPos(Door3:pos()+vec(0, 0, 2.5))
timer("movein", 1)
MOVE++
if(MOVE == 60){
stoptimer("movein")
MOVE = 0
soundStop(2)
CD = 0
}
}Maybe you could increase the time it takes to descend or perhaps make it more stable? Maybe modify it for taller bridges? With the setPos command, 2.5 is the height of any modbridge thing that is one tall. RE: Descending Bridge E2 - Eustace Fargo - 11-10-2016 Great idea! RE: Descending Bridge E2 - I_nos0pedJFK - 18-01-2017 how do u wire it up?? |