Ok, new question. When my map starts, the tank destroys itself and pops up ‘The tank has been destroyed!’. How can I have it so it actually starts destroyed, instead of it starting with full health and then destroying itself within the opening second.
Here’s the script:
//=============================================================================
//=== Tank Mapscript
//=============================================================================
// accum 0, script lock
// accum 1, current movement path position
// accum 2, track state
// accum 3, bit 0 death status (0=dead, 1=alive)
// bit 1 stuck status (0=not stuck, 1=stuck)
// bit 2 players nearby (0=no players, 1=players)
// bit 3 moving status (0=not moving, 1=moving)
// bit 4 temp register
// bit 5 message-flag (0=no message, 1=message)
// bit 6 visible state (0=alive, 1=dead)
// bit 7 barricade #1 (0=not built, 1=built)
// bit 8 barricade #2 (0=not built, 1=built)
// bit 9 barricade #3 (0=not built, 1=built)
// bit 10 barricade #4 (0=not built, 1=built)
// accum 4, stop counter
//
//info_notnull
tank_sound
{
trigger start
{
trigger tank sound_start
wait 3400
trigger tank sound_move
}
trigger stop
{
trigger tank sound_stop
wait 1400
trigger tank sound_idle
}
trigger death
{
trigger tank sound_death
wait 3400
trigger tank sound_idle
}
trigger rebirth
{
trigger tank sound_rebirth
wait 3400
trigger tank sound_idle
}
}
//script_mover
tank
{
// ===========================================================================================
spawn
{
wait 50
constructible_chargebarreq 1.0
constructible_constructxpbonus 10
constructible_destructxpbonus 10
followspline 0 path_00 10000 wait length -64
trigger self sound_idle
trigger self tracks_stop
}
// ===========================================================================================
// script lockouts
trigger script_lock
{
accum 0 inc 1
}
trigger script_unlock
{
accum 0 inc -1
}
// ===========================================================================================
// tracks
trigger tracks_forward
{
accum 2 abort_if_equal 1
accum 2 set 1
remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
remapshaderflush
}
trigger tracks_stop
{
accum 2 abort_if_equal 0
accum 2 set 0
remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_r
remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_r
remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_l
remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_l
remapshaderflush
}
trigger tracks_turn_left
{
accum 2 abort_if_equal 2
accum 2 set 2
remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_forward
remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_forward
remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_backward
remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_backward
remapshaderflush
}
trigger tracks_turn_right
{
accum 2 abort_if_equal 3
accum 2 set 3
remapshader models/mapobjects/tanks_sd/bits_r models/mapobjects/tanks_sd/bits_backward
remapshader models/mapobjects/tanks_sd/wheel_r models/mapobjects/tanks_sd/wheel_backward
remapshader models/mapobjects/tanks_sd/bits_l models/mapobjects/tanks_sd/bits_forward
remapshader models/mapobjects/tanks_sd/wheel_l models/mapobjects/tanks_sd/wheel_forward
remapshaderflush
}
// ========================================
// sound stuff
trigger sound_idle
{
stopsound
playsound sound/vehicles/tank/tank_idle.wav looping volume 512
}
trigger sound_start
{
stopsound
playsound sound/vehicles/tank/tank_revup.wav volume 196
}
trigger sound_move
{
stopsound
playsound sound/vehicles/tank/tank_move.wav looping volume 512
}
trigger sound_stop
{
stopsound
playsound sound/vehicles/tank/tank_revdown.wav volume 196
}
trigger sound_death
{
stopsound
playsound sound/vehicles/tank/tank_stop.wav volume 256
}
trigger sound_rebirth
{
stopsound
playsound sound/vehicles/tank/tank_start.wav volume 196
}
// ===========================================================================================
// enable/disable
trigger tank_enable
{
trigger self stuck_check
accum 3 abort_if_bitset 1 // stuck check
accum 4 set 0 // reset stop counter
accum 3 bitreset 2 // reset player check
accum 3 abort_if_bitset 3 // already following spline
accum 0 abort_if_not_equal 0 // are we not in a script lockout?
accum 3 abort_if_bitset 0 // death check
trigger self script_lock
trigger tank_sound start
startanimation 55 10 15 nolerp norandom
wait 666
startanimation 5 40 15 nolerp norandom
wait 500
trigger self tracks_forward
trigger self script_unlock
trigger self move
}
trigger tank_disable
{
accum 4 inc 1 // up the stop counter
accum 4 abort_if_less_than 2 // 2 second ride
accum 3 bitset 2 // set player check
trigger self deathcheck
}
// ===========================================================================================
// stuck checking
trigger stuck_check
{
accum 3 bitreset 1 // accum 3, bit 1 stuck status (0=not stuck, 1=stuck)
trigger self stuck_check_scriptlockout
trigger self stuck_check_finished
}
trigger stuck_check_finished
{
accum 1 abort_if_less_than 17
accum 3 bitset 1
}
trigger stuck_check_scriptlockout
{
accum 0 abort_if_equal 0
accum 3 bitset 1
}
// ===========================================================================================
// stop check
trigger stopcheck_setup
{
accum 3 bitset 4 // stop if we're stuck/no-one's pushing :)
accum 3 abort_if_bitset 2 // no one in the trigger, abort
trigger self stuck_check // call the stop check function
accum 3 abort_if_bitset 1 // we're stuck so break out
accum 3 bitreset 4 // we're free to move
}
trigger stopcheck
{
trigger self stopcheck_setup
accum 3 abort_if_not_bitset 4
trigger self script_lock
// Any just stopped moving stuff goes here
trigger tank_sound stop
trigger self tracks_stop
startanimation 45 10 15 nolerp norandom
wait 666
startanimation 0 1 15 nolerp norandom
wait 900
trigger self script_unlock
resetscript
}
// ===========================================================================================
// death / rebirth
trigger deathcheck
{
accum 3 abort_if_not_bitset 0 // are we dead?
accum 3 abort_if_bitset 6 // are we not already visibly dead?
accum 3 abort_if_bitset 3 // are we not following a spline?
accum 0 abort_if_not_equal 0 // are we not in a script lockout?
accum 3 bitset 6 // we're now visibly dead
accum 3 bitset 5
wm_announce "^5The tank has been damaged"
changemodel models/mapobjects/tanks_sd/churchhill_broken.md3
setstate tank_smoke default
kill tank_construct
trigger self sound_death
trigger self tracks_stop
trigger self script_lock
trigger self tracks_stop
startanimation 45 10 15 nolerp norandom
wait 666
startanimation 0 1 15 nolerp norandom
trigger self script_unlock
resetscript
}
rebirth
{
accum 3 bitreset 6 // we're visibly alive
accum 3 bitreset 0 // we're alive again
trigger self script_lock
changemodel models/mapobjects/tanks_sd/churchhill.md3
setstate tank_smoke invisible
trigger tank_sound rebirth
wait 500
trigger self script_unlock
}
death
{
accum 3 bitset 0
}
// ===========================================================================================
// movement
trigger run_continue
{
accum 1 inc 1
trigger self deathcheck
trigger self stopcheck
trigger self move
}
trigger move
{
trigger self move_check
wait 500
trigger self move
}
trigger move_check
{
trigger self stuck_check
accum 3 abort_if_bitset 1
accum 1 trigger_if_equal 0 tank move_to_0
accum 1 trigger_if_equal 1 tank move_to_1
accum 1 trigger_if_equal 2 tank move_to_2
accum 1 trigger_if_equal 3 tank move_to_3
accum 1 trigger_if_equal 4 tank move_to_4
accum 1 trigger_if_equal 5 tank move_to_5
accum 1 trigger_if_equal 6 tank move_to_6
accum 1 trigger_if_equal 7 tank move_to_7
accum 1 trigger_if_equal 8 tank move_to_8
accum 1 trigger_if_equal 9 tank move_to_9
accum 1 trigger_if_equal 10 tank move_to_10
accum 1 trigger_if_equal 11 tank move_to_11
accum 1 trigger_if_equal 12 tank move_to_12
accum 1 trigger_if_equal 13 tank move_to_13
accum 1 trigger_if_equal 14 tank move_to_14
accum 1 trigger_if_equal 15 tank move_to_15
accum 1 trigger_if_equal 16 tank move_to_16
accum 1 trigger_if_equal 17 tank move_to_17
}
trigger move_to_0
{
trigger self run_continue
}
trigger move_to_1
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_0 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_2
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_1 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_3
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_2 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_4
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_3 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_5
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_4 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_6
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_5 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_7
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_6 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_8
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_7 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_9
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_8 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_10
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_9 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_11
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_10 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_12
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_11 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_13
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_12 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_14
{
trigger gate flatten
setstate gatehint invisible
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_13 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_15
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_14 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_16
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_15 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
trigger move_to_17
{
trigger self tracks_forward
accum 3 bitset 3
followspline 0 path_16 75 wait length -64
accum 3 bitreset 3
trigger self run_continue
}
//-----------------------------------
// Turret
//-----------------------------------
trigger startfire
{
startanimation 67 8 10 nolerp norandom noloop
}
trigger stopfire
{
startanimation 0 1 15 nolerp norandom
}
}
//target_script_trigger
tank_disabler
{
trigger run
{
trigger tank tank_disable
}
}
//target_script_trigger
tank_enabler
{
trigger run
{
trigger tank tank_enable
}
}
//trigger_multiple
tank_trigger
{
spawn
{
wait 100
attachtotag tank tag_turret
}
}
//trigger_objective_info
tank_build
{
spawn
{
wait 100
attachtotag tank tag_turret
}
}
//func_constructible
tank_construct
{
spawn
{
wait 400
kill tank
constructible_class 2
constructible_health 1200
constructible_constructxpbonus 10
constructible_destructxpbonus 10
}
built final
{
alertentity tank
wm_announce "^5The tank has been repaired"
}
trigger final_pos
{
constructible_constructxpbonus 2
constructible_destructxpbonus 5
}
}
//misc_gamemodel
tank_turret
{
spawn
{
wait 500
attachtotag tank tag_turret
}
}
tank_smoke
{
spawn
{
wait 300
attachtotag tank tag_turret
setstate tank_smoke invisible
}
}
tank_flash
{
spawn
{
setstate tank_flash invisible
}
trigger run
{
setstate tank_flash default
attachtotag tank_turret tag_flash
faceangles 0 90 0 50
resetscript
}
}