Page 1 of 1

Elavator help... Please!

Posted: Sat Jun 17, 2006 8:12 pm
by Caboom
I need help with spawning a second elevator in my map. I can spawn the first one and it works fine, but when I add a second elevator it does not show up. Can someone help me with the correct way to continue scripting multiple elevators. Thank you!

Here is what I put:

lift:

//=============================ELEVATOR 1===============================

local.lift1 = spawn script_model
local.lift1 model "static/indycrate.tik"
local.lift1 targetname elevator
local.lift1.origin = ( -3610.50 4850 -447.88 )
local.lift1.angle = 0
local.lift1 time 3
local.lift1 light 0 0 0 30
while (1)
{

wait 5
local.lift1 speed 150
local.lift1 moveUp 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound
wait 5
local.lift1 moveDown 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound

}

Posted: Sat Jun 17, 2006 10:12 pm
by neillomax
Never did one, but wouldn't it be local.lift2.......new coords... etc. ?

or make each one a script origin something or other ?

maybe

http://www.modtheater.com/forum/showthread.php?t=28556

http://www.modtheater.com/forum/showthr ... t=elevator

Click on this link........

http://www.modtheater.com/forum/search. ... hid=389395

Posted: Sun Jun 18, 2006 12:51 am
by Green Beret
This should work :wink:
lift:

//=============================ELEVATOR 1===============================

local.lift1 = spawn script_model
local.lift1 model "static/indycrate.tik"
local.lift1 targetname elevator
local.lift1.origin = ( -3610.50 4850 -447.88 )
local.lift1.angle = 0
local.lift1 time 3
local.lift1 light 0 0 0 30
while (1)
{

wait 5
local.lift1 speed 150
local.lift1 moveUp 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound
wait 5
local.lift1 moveDown 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound

}
end

lift2:

//=============================ELEVATOR 2===============================

local.lift2 = spawn script_model
local.lift2 model "static/indycrate.tik"
local.lift2 targetname elevator2
local.lift2.origin = ( xxx xxx xxx )//add new coords
local.lift2.angle = 0
local.lift2 time 3
local.lift2 light 0 0 0 30
while (1)
{

wait 5
local.lift2 speed 150
local.lift2 moveUp 250
local.lift2 loopsound elevator_run
local.lift2 waitmove
local.lift2 stoploopsound
wait 5
local.lift2 moveDown 250
local.lift2 loopsound elevator_run
local.lift2 waitmove
local.lift2 stoploopsound

}
end

Posted: Sun Jun 18, 2006 1:19 am
by neillomax
I did that same exact thing an hour ago. Didn't work for some reason. Got tired of working on it, so hopefully someone will see the fault and let us know. Both with and without one or both of those "end"'s in there.

Posted: Sun Jun 18, 2006 6:21 am
by bdbodger
You can do it like Green Beret said in two threads . If you use two while loops you have to use two threads

main:

thread lift

thread lift2

end

In the threads that Green Beret posted though he put local.lift1 time 3 and also local.lift1 speed 150 you should use one or the other really not both . Time 3 means when you move something no matter how far it will take 3 seconds so depending on the distance the speed will not be the same if the distances are different . The farther you have to move it the faster it will go so that it can do it in 3 seconds . local.lift1 speed 150 on the other hand means 150 units per second so a far distance takes longer because the speed is set at 150 so the time it takes maybe more or less than 3 seconds depending on distance . There is a way to combine the two threads into one but there is no real advantage to it . One other thing local.lift1 light 0 0 0 30 there is no black light in mohaa Green Beret so that won't work .

Posted: Sun Jun 18, 2006 2:58 pm
by neillomax
Can you say ORGASM ? AHHHhhh - ( insert lyrics to a famous Pink Floyd song here ), ........ This one works. Thanks bdbodger

COPY AND PASTE for test...............................



// STALINGRAD
// ARCHITECTURE: ZIED, POWZER
// SCRIPTING: POWZER

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Stalingrad"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" "MONGO'S"
setcvar "g_obj_axistext3" "LIFT TEST"

setcvar "g_scoreboardpic" "mohdm6"

// call additional stuff for playing this map round based is needed
if(level.roundbased)
thread roundbasedthread

level waittill prespawn

//-496 111 -147//-409 104 -148

thread lift

thread lift2

end






//*** Precache Dm Stuff
exec global/DMprecache.scr

exec global/door_locked.scr::lock
level.script = maps/dm/mohdm6.scr
exec global/ambient.scr mohdm6

level waittill spawn


lift:

//=============================ELEVATOR 1===============================

local.lift1 = spawn script_model
local.lift1 model "static/indycrate.tik"
local.lift1 targetname elevator
local.lift1.origin = ( -409 104 -148 )
local.lift1.angle = 0
//local.lift1 time 3
local.lift1 light 0 10 0 300
while (1)
{

wait 5
local.lift1 speed 150
local.lift1 moveUp 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound
wait 5
local.lift1 moveDown 250
local.lift1 loopsound elevator_run
local.lift1 waitmove
local.lift1 stoploopsound

}
end

lift2:

//=============================ELEVATOR 2===============================

local.lift2 = spawn script_model
local.lift2 model "static/indycrate.tik"
local.lift2 targetname elevator2
local.lift2.origin = ( -138 145 -144 )//add new coords
local.lift2.angle = 0
//local.lift2 time 3
local.lift2 light 10 0 0 300
while (1)
{

wait 5
local.lift2 speed 150
local.lift2 moveUp 250
local.lift2 loopsound elevator_run
local.lift2 waitmove
local.lift2 stoploopsound
wait 5
local.lift2 moveDown 250
local.lift2 loopsound elevator_run
local.lift2 waitmove
local.lift2 stoploopsound

}
end




//-----------------------------------------------------------------------------

roundbasedthread:

// Can specify different scoreboard messages for round based games here.

level waitTill prespawn

level waittill spawn

// set the parameters for this round based match
level.dmrespawning = 0 // 1 or 0
level.dmroundlimit = 5 // round time limit in minutes
level.clockside = kills // set to axis, allies, kills, or draw

level waittill roundstart

end

Posted: Mon Jun 19, 2006 2:51 am
by Green Beret
bdbodger wrote: One other thing local.lift1 light 0 0 0 30 there is no black light in mohaa Green Beret so that won't work .
LOL Sorry, I didnt even look at the color, It was what he posted :oops:

Posted: Mon Jun 19, 2006 3:13 am
by neillomax
I have a question about this script. The sound doesn't work . Why not ?

lighthouse

Posted: Mon Jun 19, 2006 6:52 am
by tltrude
"elevator_run" only works in singleplayer maps. Try using this one ---> lighthouse_run

Posted: Mon Jun 19, 2006 2:10 pm
by neillomax
That works Thank you. Made this into pk3 for futrure reference

http://www.modtheater.com/forum/showthr ... 30&t=29260