Hello, I've dug back this old script made by Me_Ks for a previous and apparently I've messed something with it as it's not syncing when in game. I always end up seeing something that's not true compared to the host's version. When either of client or host presses the switch, the SV_Say displays properly.
For host, the script continues as it should while for client the scripts loops back to beginning after the explosion effects are spawned and will go on forever. A check of the sync room and a unit_get_health to the concerned bipeds shows that host and client have different outcomes. Moreover, the variable "Bombing" never gets set to true for the client (Notice this is supposed to happen right after the explosion effect).
Host detection seems to work (Variable is "Server" and when inspected by client and server, does exactly what it's meant to do.
Anyway here's the script:
Quote:
(script continuous server_side_bombing
(if
(= server 1)
(begin
(if
(> (device_get_position bombing_control) 0)
(begin
(device_set_position_immediate bombing_control 0)
(device_set_power bombing_control 0)
(object_destroy crush_bomb_2)
(sleep delay)
(object_create_anew check_bomb_2)
(unit_suspended check_bomb_2 1)
(object_create_anew crush_bomb_0)
(object_create_anew crush_bomb_1)
(sleep_until (and
(<= (unit_get_health check_bomb_0) 0)
(<= (unit_get_health check_bomb_1) 0)
) 1)
(object_destroy crush_bomb_0)
(device_set_position_immediate bombing_run 0)
(sv_say "SCRIPT ACTIVATED")
(device_set_position bombing_run .4)
(sleep_until
(= (device_get_position bombing_run) .4)
)
(device_set_position bombing_run 1)
(effect_new bomb_effect bomb)
(effect_new bomb_effect bomba)
(effect_new bomb_effect bombb)
(effect_new bomb_effect bombc)
(set bombing 1)
(sleep delay) ; so hog doesn't crush(5 ticks)
(object_create_anew check_bomb_0)
(unit_suspended check_bomb_0 1)
(sleep bomb_timer) ;;50 seconds
(object_destroy crush_bomb_1)
(sleep delay)
(object_create_anew check_bomb_1)
(unit_suspended check_bomb_1 1)
(object_create_anew crush_bomb_2)
(sleep_until (<= (unit_get_health check_bomb_2) 0) 1)
(device_set_power bombing_control 1)
(set bombing 0)
)
)
)
(sleep_until (= 0 1))
)
)
(script continuous client_side_bombing
(if
(= server 0)
(begin
(cond
(
(and
(<= (unit_get_health check_bomb_0) 0)
(= bombing 0)
)
(begin
(object_create_anew check_bomb_2)
(unit_suspended check_bomb_2 1)
(device_set_position bombing_control 1)
(device_set_power bombing_control 0)
(device_set_position_immediate bombing_run 0)
(device_set_position bombing_run .4)
(sleep_until
(= (device_get_position bombing_run) .4)
)
(device_set_position bombing_run 1)
(effect_new bomb_effect bomb)
(effect_new bomb_effect bomba)
(effect_new bomb_effect bombb)
(effect_new bomb_effect bombc)
(set nuked 1)
(sleep delay)
(object_create_anew check_boom_0)
(unit_suspended check_bomb_0 1)
(device_set_position_immediate bombing_control 0)
)
)
(
(and
(<= (unit_get_health check_bomb_1) 0)
(= bombing 0)
)
(begin
(object_create_anew check_bomb_2)
(unit_suspended check_bomb_2 1)
(device_set_position_immediate bombing_control 0)
(device_set_power bombing_control 0)
(set bombing 1)
)
)
(
(and
(<= (unit_get_health check_bomb_2) 0)
(= bombing 1)
)
(begin
(object_create_anew check_bomb_1)
(unit_suspended check_bomb_1 1)
(device_set_power bombing_control 1)
(set bombing 0)
)
)
)
)
(sleep_until (= 0 1))
)
)