Okay, that'll be harder. But, I'll make a script, 'cause I'm nice like that. And I like scripting.
Alright, so, setup:
-Have four hogs in some place that the player cannot reach. Make sure the ground is mostly flat and that the hogs are near each other, but not too close to each other. Set them not to spawn by default under any circumstances, and name them "up_hog", "moving_up_hog","moving_down_hog", and "down_hog", without quotes. Use the default "mp_warthog".
-Place one biped under each of these hogs. Make sure you name them according to their hog. Also, make sure that the hog is position right over the biped so it'll kill it when it spawns. Under "up_hog", name the biped "up_sync". Under "moving_up_hog", name the biped "moving_up_sync". For "moving_down_hog", name the biped "moving_down_sync", and under "down_hog", name the biped "down_sync". Make sure these bipeds all spawn by default. Also, just use default "cyborg_unarmed" bipeds. This way, they don't spill weapons uselessly every time they're killed.
-Name your two switches "up_switch" and "down_switch".
-Name the elevator ... "elevator".
-Place yet another hog, and name it "host_check". However, make sure this hog spawns in ALL game types BY DEFAULT. Preferably put this one in the same area as the other hogs, just not too close to any of them.
-These next items are very important, as I made my script assuming these conditions: Make sure that when the game starts, the elevator is on the BOTTOM floor, and that the elevator is at the "0" position when it's on the bottom floor. Make sure the elevator has its power set to "1" at game start. Also make sure that both Controls (the switches) are set to a position of "0" at the start of the game, and that their power is also set to "1" at start. You can check these both by typing these into Sapien's console: "device_get_position object_name" and "device_get_power object_name" without quotes. The checkboxes in the properties of each control and device are used for setting its start power and position. It should be fine as it is, but if not, look for the right checkboxes.
-That's about it for the setup.
-When I find myself in times of trouble, Mother Mary comes to me.
-So, once all that's done, compile this gigantic script:
(global boolean server 0)
(global boolean up 0)
(global boolean down 1)
(script startup i_like_apples
(unit_suspended up_sync 1)
(unit_suspended moving_up_sync 1)
(unit_suspended moving_down_sync 1)
(unit_suspended down_sync 1)
(if
(>= (unit_get_health host_check) 0)
(set server 1)
)
)
(script continuous server_side
(if
(= server 1)
(begin
(if
(and
(or
(> (device_get_position up_switch) 0)
(> (device_get_position down_switch) 0)
)
(= down 1)
)
(begin
(set down 0)
(device_set_position_immediate up_switch 0)
(device_set_position_immediate down_switch 0)
(device_set_power up_switch 0)
(device_set_power down_switch 0)
(object_destroy down_hog)
(object_create_anew down_sync)
(unit_suspended down_sync 1)
(object_create_anew moving_up_hog)
(sleep_until (?= (unit_get_health moving_up_sync) 0) 1)
(device_set_position elevator 1)
(sleep_until (>= (device_get_position elevator) 1) 1)
(object_destroy moving_up_hog)
(object_create_anew moving_up_sync)
(unit_suspended moving_up_sync 1)
(device_set_power up_switch 1)
(device_set_power down_switch 1)
(set up 1)
(object_create_anew up_hog)
)
)
(if
(and
(or
(> (device_get_position up_switch) 0)
(> (device_get_position down_switch) 0)
)
(= up 1)
)
(begin
(set up 0)
(device_set_position_immediate up_switch 0)
(device_set_position_immediate down_switch 0)
(device_set_power up_switch 0)
(device_set_power down_switch 0)
(object_destroy up_hog)
(object_create_anew up_sync)
(unit_suspended up_sync 1)
(object_create_anew moving_down_hog)
(sleep_until (?= (unit_get_health moving_down_sync) 0) 1)
(device_set_position elevator 0)
(sleep_until (?= (device_get_position elevator) 0) 1)
(object_destroy moving_down_hog)
(object_create_anew moving_down_sync)
(unit_suspended moving_down_sync 1)
(device_set_power up_switch 1)
(device_set_power down_switch 1)
(set down 1)
(object_create_anew down_hog)
)
)
)
(sleep_until (= 0 1))
)
)
(script continuous client_side_position
(if
(= server 0)
(begin
(if
(?= (unit_get_health up_sync) 0)
(device_set_position_immediate elevator 1)
)
(if
(?= (unit_get_health down_sync) 0)
(device_set_position_immediate elevator 0)
)
)
(sleep_until (= 0 1))
)
)
(script continuous client_side_movement
(if
(= server 0)
(begin
(if
(?= (unit_get_health moving_up_sync) 0)
(begin
(device_set_position up_switch 1)
(device_set_position down_switch 1)
(device_set_power up_switch 0)
(device_set_power down_switch 0)
(object_create_anew down_sync)
(unit_suspended down_sync 1)
(device_set_position elevator 1)
(sleep_until (>= (device_get_position elevator) 1) 1)
(object_create_anew moving_up_sync)
(unit_suspended moving_up_sync 1)
(device_set_power up_switch 1)
(device_set_power down_switch 1)
(device_set_position_immediate up_switch 0)
(device_set_position_immediate down_switch 0)
)
)
(if
(?= (unit_get_health moving_down_sync) 0)
(begin
(device_set_position up_switch 1)
(device_set_position down_switch 1)
(device_set_power up_switch 0)
(device_set_power down_switch 0)
(object_create_anew up_sync)
(unit_suspended up_sync 1)
(device_set_position elevator 0)
(sleep_until (?= (device_get_position elevator) 0) 1)
(object_create_anew moving_down_sync)
(unit_suspended moving_down_sync 1)
(device_set_power up_switch 1)
(device_set_power down_switch 1)
(device_set_position_immediate up_switch 0)
(device_set_position_immediate down_switch 0)
)
)
)
(sleep_until (= 0 1))
)
)
It's not tested, but I've done syncing before and I thought this script through pretty damn well, so it should work.
EDIT: The forums delete everything between "<>", so I replaced all of the "<" symbols with question marks "?". Remember to change those back to "<" before compiling.
Edited by Me KS on Mar 25, 2009 at 04:15 PM