The problem with my .scr is that the elevator doors wont open?
main:
level waittill prespawn
exec global/cardgame.scr
$world farplane 5000
$world farplane_color (.333 .333 .329)
$wrenchguy4 thread worker
$hungryguy thread global/eat.scr::eating
$wrenchguy5 thread worker
$welderguy1 thread welding
thread elevator_prep
thread upper_button_pushed
thread mid_button_pushed
thread lower_button_pushed
thread force_updoors
thread force_mddoors
thread force_dndoors
thread bombscript
level.elipos = 1
exec global/DMprecache.scr
level.script = maps/obj/objtest.scr
exec global/ambient.scr m4l1
exec global/door_locked.scr::lock
setcvar "g_obj_alliedtext1" "Go2Town"
setcvar "g_obj_alliedtext2" "KillSumAxis"
setcvar "g_obj_alliedtext3" "FindtheBomb"
setcvar "g_obj_axistext1" "- Prevent Allies from"
setcvar "g_obj_axistext2" "destroying the Flak88's"
setcvar "g_obj_axistext3" "MadeBy BiG_HeaD"
setcvar "g_scoreboardpic" "objdm1.tga"
level waittill spawn
$mybomb thread global/jv_obj_dm.scr::bomb_thinker
end
elevator_prep:
level.bomb_damage = 200
level.bomb_explosion_radius = 640
level.defusing_team = "axis"
level.planting_team = "allies"
level.targets_to_destroy = 1
level.dmrespawning = 1 // 1 or 0
level.dmroundlimit = 15 // round time limit in minutes
level.clockside = axis // set to axis, allies, kills, or draw
$elevator_button_up bind $elevator // Attaches the trigger to the elevator so it moves with it.
$elevator_button_dn bind $elevator // Attaches the trigger to the elevator so it moves with it.
$elevator_door_rt bind $elevator // makes door move with the elevator.
$elevator_door_lt bind $elevator
$elevator_hatch moveWest 384 // replaces hatch moved for lighting
$elevator_hatch waitmove
$elevator_hatch rotateXdown 75 //closes the hatch
$elevator_hatch move
$elevator_hatch_trigger bind $elevator
$elevator_hatch bind $elevator
$elevator speed 64 // sets the elevator move speed, 64 units per second in this case
$lowerdoor_rt speed 48 // sets the speed in units per second
$lowerdoor_lt speed 48
$mid_door_rt speed 48
$mid_door_lt speed 48
$upperdoor_rt speed 48
$upperdoor_lt speed 48
$elevator_door_lt speed 45
$elevator_door_rt speed 45
$elevator_hatch time 2.5 // speed does not work for rotating objects
$floor_id_1 time 4 // floor indicator
$floor_id_2 time 4
$floor_id_3 time 4
thread elevator_standby_up
thread elevator_standby_down
thread escape_hatch
end
lower_button_pushed:
$lower_button waittill trigger
thread triggers_off
if (level.elipos == 0) // If elevator at the top, use this thread.
{
thread indicator_move_down2
$elevator moveto $way_floor1
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread lower_doors_cycle
level.elipos = 1
wait 10
thread triggers_on
goto lower_button_pushed
}
else
if (level.elipos == 2) // If elevator is midway, use this thread.
{
thread indicator_move_down
$elevator moveto $way_floor1
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread lower_doors_cycle
level.elipos = 1
wait 10
thread triggers_on
goto lower_button_pushed
}
else
if (level.elipos == 1) // If elevator at the botom, use this thread.
{
thread lower_doors_cycle
wait 10
thread triggers_on
goto lower_button_pushed
}
end
mid_button_pushed:
$mid_button waittill trigger
thread triggers_off
if (level.elipos == 0) // If elevator at the top, use this thread.
{
thread indicator_move_down
$elevator moveto $way_floor2
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread mid_doors_cycle
level.elipos = 2
wait 10
thread triggers_on
goto mid_button_pushed
}
else
if (level.elipos == 2) // If elevator at the top, use this thread.
{
thread mid_doors_cycle
wait 10
thread triggers_on
goto mid_button_pushed
}
else
if (level.elipos == 1) // If elevator at the top, use this thread.
{
thread indicator_move_up
$elevator moveto $way_floor2
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread mid_doors_cycle
level.elipos = 2
wait 10
thread triggers_on
goto mid_button_pushed
}
end
upper_button_pushed:
$upper_button waittill trigger
thread triggers_off
if (level.elipos == 2) // If elevator is midway, use this thread.
{
thread indicator_move_up
$elevator moveto $way_floor0
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread upper_doors_cycle
level.elipos = 0
wait 10
thread triggers_on
goto upper_button_pushed
}
else
if (level.elipos == 1) // If elevator at the bottom, use this thread.
{
thread indicator_move_up2
$elevator moveto $way_floor0
$elevator loopsound lighthouse_run
$elevator waitmove // wait till the elevator has completed the move before doing anything else
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread upper_doors_cycle
level.elipos = 0
wait 10
thread triggers_on
goto upper_button_pushed
}
else
if (level.elipos == 0) // If elevator at the top, use this thread.
{
thread upper_doors_cycle
wait 10
thread triggers_on
goto upper_button_pushed
}
end
lower_doors_cycle:
thread triggers_off
$elevator_door_rt moveNorth 48 // open
$elevator_door_rt move
$elevator_door_lt moveSouth 48
$elevator_door_lt move
$elevator playsound lighthouse_lever
wait .1
$lowerdoor_rt moveNorth 48 // open
$lowerdoor_rt move
$lowerdoor_lt moveSouth 48
$lowerdoor_lt move
$elevator playsound lighthouse_lever
wait 10
$lowerdoor_rt moveSouth 48 // close
$lowerdoor_rt move
$lowerdoor_lt moveNorth 48
$lowerdoor_lt move
$elevator playsound lighthouse_lever
wait .1
$elevator_door_rt moveSouth 48 // close
$elevator_door_rt move
$elevator_door_lt moveNorth 48
$elevator playsound lighthouse_lever
$elevator_door_lt waitmove
thread triggers_on
goto lower_button_pushed
end
mid_doors_cycle:
thread triggers_off
$elevator_door_rt moveNorth 48 // open
$elevator_door_rt move
$elevator_door_lt moveSouth 48
$elevator_door_lt move
$elevator playsound lighthouse_lever
wait .1
$mid_door_rt moveNorth 48 // open
$mid_door_rt move
$mid_door_lt moveSouth 48
$mid_door_lt move
$elevator playsound lighthouse_lever
wait 10
$mid_door_rt moveSouth 48 // close
$mid_door_rt move
$mid_door_lt moveNorth 48
$mid_door_lt move
$elevator playsound lighthouse_lever
wait .1
$elevator_door_rt moveSouth 48 // close
$elevator_door_rt move
$elevator_door_lt moveNorth 48
$elevator playsound lighthouse_lever
$elevator_door_lt waitmove
thread triggers_on
goto mid_button_pushed
end
upper_doors_cycle:
thread triggers_off
$elevator_door_rt moveNorth 48 // open
$elevator_door_rt move
$elevator_door_lt moveSouth 48
$elevator_door_lt move
$elevator playsound lighthouse_lever
wait .1
$upperdoor_rt moveNorth 48 // open
$upperdoor_rt move
$upperdoor_lt moveSouth 48
$upperdoor_lt move
$elevator playsound lighthouse_lever
wait 10
$upperdoor_rt moveSouth 48 // close
$upperdoor_rt move
$upperdoor_lt moveNorth 48
$upperdoor_lt move
$elevator playsound lighthouse_lever
wait .1
$elevator_door_rt moveSouth 48 // close
$elevator_door_rt move
$elevator_door_lt moveNorth 48
$elevator playsound lighthouse_lever
$elevator_door_lt waitmove
thread triggers_on
goto upper_button_pushed
end
elevator_standby_up:
$elevator_button_up waittill trigger
thread triggers_off
if (level.elipos == 0) // If elevator at the top, use this thread.
{
wait 1
thread upper_doors_cycle
wait 10
thread triggers_on
goto elevator_standby_up
}
else
if (level.elipos == 2) // If elevator is mid way, use this thread.
{
$elevator moveto $way_floor0
$elevator loopsound lighthouse_run
thread indicator_move_up
$elevator waitmove // wait till the elevator has completed the move before doing anything else.
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread upper_doors_cycle
level.elipos = 0
wait 10
thread triggers_on
goto elevator_standby_up
}
else
if (level.elipos == 1) // if elevator state is at the bottom, use this thread.
{
$elevator moveto $way_floor2
$elevator loopsound lighthouse_run
thread indicator_move_up
$elevator waitmove // wait till the elevator has completed the move before doing anything else.
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread mid_doors_cycle
level.elipos = 2
wait 10
thread triggers_on
goto elevator_standby_up
}
end
elevator_standby_down:
$elevator_button_dn waittill trigger
thread triggers_off
if (level.elipos == 0) // If elevator at the top, use this thread.
{
$elevator moveto $way_floor2
$elevator loopsound lighthouse_run
thread indicator_move_down
$elevator waitmove // wait till the elevator has completed the move before doing anything else.
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread mid_doors_cycle
level.elipos = 2
wait 10
thread triggers_on
goto elevator_standby_down
}
else
if (level.elipos == 2) // If elevator is mid way, use this thread.
{
$elevator moveto $way_floor1
$elevator loopsound lighthouse_run
thread indicator_move_down
$elevator waitmove // wait till the elevator has completed the move before doing anything else.
$elevator loopsound lighthouse_run wait // stops the sound
$elevator playsound snd_ping
wait 1
thread lower_doors_cycle
level.elipos = 1
wait 10
thread triggers_on
goto elevator_standby_down
}
else
if (level.elipos == 1) // if elevator state is at the bottom, use this thread.
{
wait 1
thread lower_doors_cycle
wait 10
thread triggers_on
goto elevator_standby_down
}
end
escape_hatch:
$elevator_hatch_trigger waittill trigger
$elevator_hatch rotateXup 75
$elevator_hatch playsound lighthouse_lever
$elevator_hatch waitmove
wait 20
$elevator_hatch rotateXdown 75
$elevator_hatch playsound lighthouse_lever
$elevator_hatch waitmove
goto escape_hatch
end
indicator_move_up:
$floor_id_1 rotateZup -90
$floor_id_1 move
$floor_id_2 rotateZup -90
$floor_id_2 move
$floor_id_3 rotateZup -90
$floor_id_3 move
end
indicator_move_up2:
$floor_id_1 time 8
$floor_id_2 time 8
$floor_id_3 time 8
$floor_id_1 rotateZup -180
$floor_id_1 move
$floor_id_2 rotateZup -180
$floor_id_2 move
$floor_id_3 rotateZup -180
$floor_id_3 move
$floor_id_1 time 4
$floor_id_2 time 4
$floor_id_3 time 4
end
indicator_move_down:
$floor_id_1 rotateZup 90
$floor_id_1 move
$floor_id_2 rotateZup 90
$floor_id_2 move
$floor_id_3 rotateZup 90
$floor_id_3 move
end
indicator_move_down2:
$floor_id_1 time 8
$floor_id_2 time 8
$floor_id_3 time 8
$floor_id_1 rotateZup 180
$floor_id_1 move
$floor_id_2 rotateZup 180
$floor_id_2 move
$floor_id_3 rotateZup 180
$floor_id_3 move
$floor_id_1 time 4
$floor_id_2 time 4
$floor_id_3 time 4
end
triggers_off:
$elevator_button_up nottriggerable // No triggers work while elevator is moving or doors are open.
$elevator_button_dn nottriggerable
$upper_button nottriggerable
$mid_button nottriggerable
$lower_button nottriggerable
$force_upper nottriggerable
$force_mid nottriggerable
$force_lower nottriggerable
end
triggers_on:
$elevator_button_up triggerable // All triggers work when elevator is at rest and doors are closed.
$elevator_button_dn triggerable
$upper_button triggerable
$mid_button triggerable
$lower_button triggerable
$force_upper triggerable
$force_mid triggerable
$force_lower triggerable
end
force_updoors:
$force_upper waittill trigger
if (level.elipos == 0) // If elevator is at the top, use this thread.
{
thread upper_doors_cycle
wait 10
goto force_updoors
}
else
thread triggers_off
$upperdoor_rt moveNorth 48 // open
$upperdoor_rt move
$upperdoor_lt moveSouth 48
$upperdoor_lt move
$upperdoor_rt playsound lighthouse_lever
wait 10
$upperdoor_rt moveSouth 48 // close
$upperdoor_rt move
$upperdoor_lt moveNorth 48
$upperdoor_lt playsound lighthouse_lever
$upperdoor_lt waitmove
thread triggers_on
goto force_updoors
end
force_mddoors:
$force_mid waittill trigger
if (level.elipos == 2) // If elevator is mid way, use this thread.
{
thread mid_doors_cycle
wait 10
goto force_mddoors
}
else
thread triggers_off
$mid_door_rt moveNorth 48 // open
$mid_door_rt move
$mid_door_lt moveSouth 48
$mid_door_lt move
$mid_door_rt playsound lighthouse_lever
wait 10
$mid_door_rt moveSouth 48 // close
$mid_door_rt move
$mid_door_lt moveNorth 48
$mid_door_lt playsound lighthouse_lever
$mid_door_lt waitmove
thread triggers_on
goto force_mddoors
end
force_dndoors:
$force_lower waittill trigger
if (level.elipos == 1) // If elevator is mid way, use this thread.
{
thread lower_doors_cycle
wait 10
goto force_dndoors
}
else
thread triggers_off
$lowerdoor_rt moveNorth 48 // open
$lowerdoor_rt move
$lowerdoor_lt moveSouth 48
$lowerdoor_lt move
$lowerdoor_rt playsound lighthouse_lever
wait 10
$lowerdoor_rt moveSouth 48 // close
$lowerdoor_rt move
$lowerdoor_lt moveNorth 48
$lowerdoor_lt playsound lighthouse_lever
$lowerdoor_lt waitmove
thread triggers_on
goto force_dndoors
end
bombscript:
$flak88_explosive1 thread global/jv_obj_dm.scr::bomb_thinker
waitthread global/jv_bots/jv_mp_ai.scr::enable
$flak88_explosive1 thread axis_win_timer
thread allies_win_bomb
$bomb thread global/jv_obj_dm.scr::bomb_thinker
end
//*** --------------------------------------------
//*** "Axis Victory"
//*** --------------------------------------------
axis_win_timer:
level waittill axiswin
end
//*** --------------------------------------------
//*** "Allied Victory"
//*** --------------------------------------------
allies_win_bomb:
while(level.targets_destroyed < level.targets_to_destroy)
waitframe
teamwin allies
end
worker:
println "Starting work"
self holster
self anim working_wrench_pullout
self waittill animdone
while (self.thinkstate == "idle")
{
wait 0.1
println "GoBiGHeaD"
self anim working_wrenching
self waittill animdone
}
self.gun = "Walter p38"
println "homer angry! HOMER SMASH!"
self unholster
end
welding:
self forceactivate
//self thread welderdeath
self.enableEnemy = 0
//self exec global/setdeathanim.scr "welding_death"
self anim welding_init
wait 5
while (isAlive self)
{
self anim welding_start
self waittill animdone
self anim welding_action
wait (randomint(10) + 5)
self anim welding_end
self waittill animdone
self anim welding_idle
wait (randomint(5) + 5)
}
spawn script_model model "models/miscobj/welding_tank.tik" targetname ((self.targetname) + "big1")
$((self.targetname) + "big1") notsolid
$((self.targetname) + "big1").origin = self.origin
$((self.targetname) + "big1").angles = self.angles
$((self.targetname) + "big1") anim tank_death
end
let me know if you spot something i did wrong
Elevator Script
Moderator: Moderators
make sure your doors arn't binding in the shaft maybe you can make them notsolid and for elevators I assume you used some of the tuts that say use waypoints just a comment from me if you are going straight up no need for waypoint just do $elevator moveup 160 or what ever . I don't see the need for waypoints if you arn't moveing at an angle or something they are hard to position exactly and are a waste of time
( by the way I made a global script that used them but because it is a global script that can be used in many maps no way to tell how far up to move the elevator except by targetnames of waypoints or tell it every distance manually but in this script I'd use a simple moveup ).
$elevator_door_rt notsolid
$elevator_door_rt moveNorth 48 // open
$elevator_door_rt move
......
......
etc
( by the way I made a global script that used them but because it is a global script that can be used in many maps no way to tell how far up to move the elevator except by targetnames of waypoints or tell it every distance manually but in this script I'd use a simple moveup ).
$elevator_door_rt notsolid
$elevator_door_rt moveNorth 48 // open
$elevator_door_rt move
......
......
etc
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
wooo that's some elevator script, too late to debug now, but i'll ask 2 questions,
are you sure any of the script is working?
have you set setthreads and targetnames correctly?
i've just made a new elevator script that'll be triggerable at all times, and finds if the any floor has been selected that it should move to, i'll paste the script here, but u'll need to change the targetnames and the setthreads, they're all self explanitory
i did notice though if your going to keep your script, that you have seperate threads dependant on elevator position... this shouldn't be a problem when using waypoints
and bdbodger the joys of using waypoints is this
1. if using MOVEUP commands the trigger can only be used while it's not moving, if triggered while moving it'll move to odd positions,
2. you don't need 2 work out the number of units it's moving,
3. there are more, but they're the best 2
and as for the script...
//**************\\
// the elevator \\
//**************\\
main:
waitthread elevator_prep_binds
waitthread elevator_prep_speed
waitthread elevator_variables
end
/////////////////////////
//___the preperation___//
/////////////////////////
elevator_prep_binds:
$l_elevator_left bind $l_elevator
$l_elevator_right bind $l_elevator
$l_elevator_light bind $l_elevator
$l_elevator_buttons bind $l_elevator
$r_elevator_left bind $r_elevator
$r_elevator_right bind $r_elevator
$r_elevator_buttons bind $r_elevator
$warehouse_buttons bind $warehouse_elevator
end
elevator_prep_speed:
$l_elevator_left speed 24
$l_elevator_right speed 24
$r_elevator_left speed 24
$r_elevator_right speed 24
$l_external_left speed 22
$l_external_right speed 22
$r_external_left speed 22
$r_external_right speed 22
$l_elevator time 4
$r_elevator time 4
$l_pointer time 4
$r_pointer time 4
$warehouse_elevator speed 48
end
elevator_variables:
$l_elevator.doors_open = 0
$l_elevator.doors_open = 0
level.floor[1] = 0
level.floor[2] = 0
level.floor[3] = 0
level.floor[4] = 0
level.floor[5] = 0
level.floor[6] = 0
level.l_moving = 0
level.r_moving = 0
level.l_moving_down = 0
level.r_moving_down = 0
level.l_moving_up = 0
level.r_moving_up = 0
level.l_current_pos = 5
level.r_current_pos = 5
level.l_elevator_on = 0
level.l_go_up = 0
level.r_go_up = 0
level.l_go_down = 0
level.r_go_down = 0
$warehouse_elevator.moving = 0
end
/////////////////////
//___the calling___//
/////////////////////
elevator_call:
level.floor[self.number] = 1
$l_elevator_light[self.number] light 1 1 1 8
if (level.l_moving == 0)
{iprintlnbold_noloc "floor1 " level.floor[1] ", floor2 " level.floor[2] ", floor3 " level.floor[3] ", floor4 " level.floor[4] ", floor5 " level.floor[5] ", floor6 " level.floor[6]
iprintlnbold_noloc "called to " self.number
iprintlnbold_noloc "elevator on floor " level.l_current_pos
if (self.number == level.l_current_pos)
{thread send_left_here}
if (self.number < level.l_current_pos)
{thread send_left_up}
if (self.number > level.l_current_pos)
{thread send_left_down}}
end
send_left_here:
if ($l_elevator.doors_open == 0)
{level.l_moving = 1
$l_elevator_light[level.l_current_pos] light 0 0 0 0
level.floor[level.l_current_pos] = 0
waitthread l_doors_move
$l_elevator_light[level.l_current_pos] light 0 0 0 0
level.floor[level.l_current_pos] = 0
level.l_moving = 0
goto send_left_up}
end
send_left_up:
level.l_moving = 1
for (local.i = level.l_current_pos; local.i > 0; local.i--)
{if (level.floor[local.i] == 1)
{level.l_go_up = 1}}
if (level.l_go_up == 1)
{level.l_go_up = 0
level.l_moving_up = 1
level.l_current_pos--
$l_pointer rotateZup -60
$l_pointer move
$l_elevator moveto $wp_l_floor[level.l_current_pos]
$l_elevator waitmove
if (level.floor[level.l_current_pos] == 1)
{wait 0.75
$l_elevator_light[level.l_current_pos] light 0 0 0 0
waitthread l_doors_move
level.floor[level.l_current_pos] = 0}
goto send_left_up}
else
{level.l_moving_up = 0
level.l_moving = 0
for (local.i = level.l_current_pos; local.i < 7; local.i++)
{if (level.floor[local.i] == 1)
{goto send_left_down}}}
end
send_left_down:
level.l_moving = 1
for (local.i = level.l_current_pos; local.i < 7; local.i++)
{if (level.floor[local.i] == 1)
{level.l_go_down = 1}}
if (level.l_go_down == 1)
{level.l_go_down = 0
level.l_moving_down = 1
level.l_current_pos++
$l_pointer rotateZup 60
$l_pointer move
$l_elevator moveto $wp_l_floor[level.l_current_pos]
$l_elevator waitmove
if (level.floor[level.l_current_pos] == 1)
{wait 0.75
$l_elevator_light[level.l_current_pos] light 0 0 0 0
waitthread l_doors_move
level.floor[level.l_current_pos] = 0}
wait 0.75
level.l_go_down = 0
goto send_left_down}
else
{level.l_moving_down = 0
level.l_moving = 0
for (local.i = level.l_current_pos; local.i > 0; local.i--)
{if (level.floor[local.i] == 1)
{goto send_left_up}}}
end
l_doors_move:
thread doors_move $l_elevator_left $l_elevator_right 4
waitthread doors_move $l_external_left[level.l_current_pos] $l_external_right[level.l_current_pos] 4 $l_elevator
end
r_doors_move:
thread doors_move $r_elevator_left $r_elevator_right 4
waitthread doors_move $r_external_left[level.r_current_pos] $r_external_right[level.r_current_pos] 4 $r_elevator
end
doors_move local.nl_object local.nr_object local.nwait local.nelevator:
if !(local.nelevator == NIL)
{local.nelevator.doors_open = 1}
local.nl_object moveRight 30
local.nr_object moveLeft 30
local.nl_object move
local.nr_object waitmove
if !(local.nelevator == NIL)
{local.nelevator playsound snd_ping}
wait local.nwait
local.nl_object moveLeft 30
local.nr_object moveRight 30
local.nl_object move
local.nr_object waitmove
if !(local.nelevator == NIL)
{local.nelevator.doors_open = 0}
end
oh yeah and you'll need to add to the triggers,
key: #number
value: 1
dependant on the floor number (0 being ground)
and another thing i've just thought of
that's for 2 elevators, u'll only need l_ele... and none of the r_ele...
are you sure any of the script is working?
have you set setthreads and targetnames correctly?
i've just made a new elevator script that'll be triggerable at all times, and finds if the any floor has been selected that it should move to, i'll paste the script here, but u'll need to change the targetnames and the setthreads, they're all self explanitory
i did notice though if your going to keep your script, that you have seperate threads dependant on elevator position... this shouldn't be a problem when using waypoints
and bdbodger the joys of using waypoints is this
1. if using MOVEUP commands the trigger can only be used while it's not moving, if triggered while moving it'll move to odd positions,
2. you don't need 2 work out the number of units it's moving,
3. there are more, but they're the best 2
and as for the script...
//**************\\
// the elevator \\
//**************\\
main:
waitthread elevator_prep_binds
waitthread elevator_prep_speed
waitthread elevator_variables
end
/////////////////////////
//___the preperation___//
/////////////////////////
elevator_prep_binds:
$l_elevator_left bind $l_elevator
$l_elevator_right bind $l_elevator
$l_elevator_light bind $l_elevator
$l_elevator_buttons bind $l_elevator
$r_elevator_left bind $r_elevator
$r_elevator_right bind $r_elevator
$r_elevator_buttons bind $r_elevator
$warehouse_buttons bind $warehouse_elevator
end
elevator_prep_speed:
$l_elevator_left speed 24
$l_elevator_right speed 24
$r_elevator_left speed 24
$r_elevator_right speed 24
$l_external_left speed 22
$l_external_right speed 22
$r_external_left speed 22
$r_external_right speed 22
$l_elevator time 4
$r_elevator time 4
$l_pointer time 4
$r_pointer time 4
$warehouse_elevator speed 48
end
elevator_variables:
$l_elevator.doors_open = 0
$l_elevator.doors_open = 0
level.floor[1] = 0
level.floor[2] = 0
level.floor[3] = 0
level.floor[4] = 0
level.floor[5] = 0
level.floor[6] = 0
level.l_moving = 0
level.r_moving = 0
level.l_moving_down = 0
level.r_moving_down = 0
level.l_moving_up = 0
level.r_moving_up = 0
level.l_current_pos = 5
level.r_current_pos = 5
level.l_elevator_on = 0
level.l_go_up = 0
level.r_go_up = 0
level.l_go_down = 0
level.r_go_down = 0
$warehouse_elevator.moving = 0
end
/////////////////////
//___the calling___//
/////////////////////
elevator_call:
level.floor[self.number] = 1
$l_elevator_light[self.number] light 1 1 1 8
if (level.l_moving == 0)
{iprintlnbold_noloc "floor1 " level.floor[1] ", floor2 " level.floor[2] ", floor3 " level.floor[3] ", floor4 " level.floor[4] ", floor5 " level.floor[5] ", floor6 " level.floor[6]
iprintlnbold_noloc "called to " self.number
iprintlnbold_noloc "elevator on floor " level.l_current_pos
if (self.number == level.l_current_pos)
{thread send_left_here}
if (self.number < level.l_current_pos)
{thread send_left_up}
if (self.number > level.l_current_pos)
{thread send_left_down}}
end
send_left_here:
if ($l_elevator.doors_open == 0)
{level.l_moving = 1
$l_elevator_light[level.l_current_pos] light 0 0 0 0
level.floor[level.l_current_pos] = 0
waitthread l_doors_move
$l_elevator_light[level.l_current_pos] light 0 0 0 0
level.floor[level.l_current_pos] = 0
level.l_moving = 0
goto send_left_up}
end
send_left_up:
level.l_moving = 1
for (local.i = level.l_current_pos; local.i > 0; local.i--)
{if (level.floor[local.i] == 1)
{level.l_go_up = 1}}
if (level.l_go_up == 1)
{level.l_go_up = 0
level.l_moving_up = 1
level.l_current_pos--
$l_pointer rotateZup -60
$l_pointer move
$l_elevator moveto $wp_l_floor[level.l_current_pos]
$l_elevator waitmove
if (level.floor[level.l_current_pos] == 1)
{wait 0.75
$l_elevator_light[level.l_current_pos] light 0 0 0 0
waitthread l_doors_move
level.floor[level.l_current_pos] = 0}
goto send_left_up}
else
{level.l_moving_up = 0
level.l_moving = 0
for (local.i = level.l_current_pos; local.i < 7; local.i++)
{if (level.floor[local.i] == 1)
{goto send_left_down}}}
end
send_left_down:
level.l_moving = 1
for (local.i = level.l_current_pos; local.i < 7; local.i++)
{if (level.floor[local.i] == 1)
{level.l_go_down = 1}}
if (level.l_go_down == 1)
{level.l_go_down = 0
level.l_moving_down = 1
level.l_current_pos++
$l_pointer rotateZup 60
$l_pointer move
$l_elevator moveto $wp_l_floor[level.l_current_pos]
$l_elevator waitmove
if (level.floor[level.l_current_pos] == 1)
{wait 0.75
$l_elevator_light[level.l_current_pos] light 0 0 0 0
waitthread l_doors_move
level.floor[level.l_current_pos] = 0}
wait 0.75
level.l_go_down = 0
goto send_left_down}
else
{level.l_moving_down = 0
level.l_moving = 0
for (local.i = level.l_current_pos; local.i > 0; local.i--)
{if (level.floor[local.i] == 1)
{goto send_left_up}}}
end
l_doors_move:
thread doors_move $l_elevator_left $l_elevator_right 4
waitthread doors_move $l_external_left[level.l_current_pos] $l_external_right[level.l_current_pos] 4 $l_elevator
end
r_doors_move:
thread doors_move $r_elevator_left $r_elevator_right 4
waitthread doors_move $r_external_left[level.r_current_pos] $r_external_right[level.r_current_pos] 4 $r_elevator
end
doors_move local.nl_object local.nr_object local.nwait local.nelevator:
if !(local.nelevator == NIL)
{local.nelevator.doors_open = 1}
local.nl_object moveRight 30
local.nr_object moveLeft 30
local.nl_object move
local.nr_object waitmove
if !(local.nelevator == NIL)
{local.nelevator playsound snd_ping}
wait local.nwait
local.nl_object moveLeft 30
local.nr_object moveRight 30
local.nl_object move
local.nr_object waitmove
if !(local.nelevator == NIL)
{local.nelevator.doors_open = 0}
end
oh yeah and you'll need to add to the triggers,
key: #number
value: 1
dependant on the floor number (0 being ground)
and another thing i've just thought of
hope this helps, prob not cos it's all foreign 2 me :-/
Minor points nuggets if you have a wall that is 160 units high and a 8 unit floor/ceiling move up 168 whats hard about that and triggers can be make nottriggerable when moveing . If you use waypoints they need to be in the center on the x y z axis to work properly and if you are out or have an odd shaped elevator the elevator can bind in the shaft unless you have it right . and if not right on the z axis it may stop short of the floor on the next level then you have to move it up compile again trial and error . Not that hard but a bother .
-
nuggets
- General
- Posts: 1006
- Joined: Fri Feb 28, 2003 2:57 am
- Location: U-england-K (england in the UK) :P
- Contact:
true, not arguing but a little tip for all mappers out there
when creating a way point for an elevator, if you create the 1st way point in the centre, copy the exterior of the elevator and waypoint, and then move it to it's new position,
de-select the waypoint and then delete the rest,
waypoint in place voila :Dand elevators should always be triggerable, it's just the way elevators are made
when creating a way point for an elevator, if you create the 1st way point in the centre, copy the exterior of the elevator and waypoint, and then move it to it's new position,
de-select the waypoint and then delete the rest,
waypoint in place voila :Dand elevators should always be triggerable, it's just the way elevators are made
hope this helps, prob not cos it's all foreign 2 me :-/