Making tank blow door help


(vince829) #1

I added a working moving tank to my map. I need to know how to make the tank blow a door when it reaches the last spline, called spln12. So far this is my script: only the tank part is included:

barrier1
{
spawn
{
wait 400
trigger barrier1 setup

	wm_addteamvoiceannounce 1 "goldrush_allies_tankbar_destroy"

	constructible_class 3
}

trigger setup
{
	setstate barrier1_materials default
	setstate barrier1_materials_clip default
	setstate barrier1_flag default

	globalaccum 0 bitreset 0

	wm_addteamvoiceannounce 0 "goldrush_axis_tankbar_construct"
}

built final
{
	setstate barrier1_materials invisible
	setstate barrier1_materials_clip invisible
	setstate barrier1_flag invisible

	wm_announce "The Tank Barrier has been constructed."

	globalaccum 0 bitset 0

	wm_teamvoiceannounce 0 "goldrush_axis_tankbar_constructed"
	wm_removeteamvoiceannounce 0 "goldrush_axis_tankbar_construct"
}

decayed final
{
	setstate barrier1_materials default
	setstate barrier1_materials_clip default
	setstate barrier1_flag default
}

death
{
	trigger self setup

	wm_announce "The Tank Barrier has been destroyed."

	wm_teamvoiceannounce 0 "goldrush_axis_tankbar_destroyed"
	wm_teamvoiceannounce 1 "goldrush_allies_tankbar_destroyed"
}

trigger remove
{
	setstate barrier1_toi invisible
	setstate barrier1_materials invisible
	setstate barrier1_materials_clip invisible
	setstate barrier1_flag invisible

	wm_removeteamvoiceannounce 0 "goldrush_axis_tankbar_construct"
	wm_removeteamvoiceannounce 1 "goldrush_allies_tankbar_destroy"

	remove
}

}

tank
{
// accum 0, track state
// accum 1
// - bit 0: barrier1 state ( 0 = not built, 1 = built )
// - bit 1: barrier2 state ( 0 = not built, 1 = built )
// - bit 2: spline status ( 0 = not moving, 1 = moving )
// - bit 3: stuck check flag ( 0 = not stuck, 1 = stuck )
// - bit 4: flag for message ( 0 = dont display, 1= display )
// - bit 5: blank
// - bit 6: temp register (XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)
// - bit 7: death status ( 0 = alive, 1 = dead )
// - bit 8: player check ( 0 = players, 1 = no players )
// - bit 9: visible state ( 0 = alive, 1 = dead )
// accum 2, blank
// accum 3, current movement loop position
// accum 4, stop counter
// accum 5, lockout ref counter
// accum 6, blank
// accum 7, blank
spawn
{
wait 400
followspline 0 spln0 50000 length 32 wait
followspline 1 spln0 50000 length 32 wait

	trigger tank sound_idle
	trigger tank tracks_stop
}

death
{
	accum 1 bitset 7
}

rebirth
{
	accum 1 bitreset 9 // we're visibly alive
	accum 1 bitreset 7 // we're alive again

	trigger self script_lockout

	changemodel models/mapobjects/tanks_sd/jagdpanther_africa_tracks.md3

	setstate tank_smoke invisible

	wm_teamvoiceannounce 0 "axis_hq_tank_repaired_allies"
	wm_teamvoiceannounce 1 "allies_hq_tank_repaired"

	trigger tank_sound rebirth
	wait 500

	trigger self script_lockout_stop
}

trigger barrier_built
{
	accum 1 bitset 1
}

trigger barrier_destroyed
{
	accum 1 bitreset 1
}

trigger deathcheck
{
	accum 1 abort_if_not_bitset 7	// abort if tank not damaged
	accum 1 abort_if_bitset 9	// abort if tank already visibly dead
	accum 1 abort_if_bitset 2	// abort if we are following a spline
	accum 5 abort_if_not_equal 0	// abort if we are in a script lockout

	accum 1 bitset 9				// we're now visibly dead

	trigger self deathcheck_message
	accum 1 bitset 4

	changemodel models/mapobjects/tanks_sd/jagdpanther_africa_tracks2.md3

	setstate tank_smoke default

	kill tank_construct

	trigger self sound_death
	trigger self tracks_stop

	trigger self script_lockout

	trigger self tracks_stop
	startanimation 45 10 15 nolerp norandom
	wait 666
	startanimation 0 1 15 nolerp norandom

	trigger self script_lockout_stop

	resetscript
}

trigger deathcheck_message
{
	accum 1 abort_if_not_bitset 4

	wm_announce "The tank has been damaged!"

	wm_teamvoiceannounce 0 "axis_hq_tank_damaged"
	wm_teamvoiceannounce 1 "allies_hq_tank_damaged_axis"
}

// ========================
// movement

trigger dispatch
{
	accum 3 trigger_if_equal 0 tank run_0
	accum 3 trigger_if_equal 1 tank run_1
	accum 3 trigger_if_equal 2 tank run_2
	accum 3 trigger_if_equal 3 tank run_3
	accum 3 trigger_if_equal 4 tank run_4
	accum 3 trigger_if_equal 5 tank run_5
	accum 3 trigger_if_equal 6 tank run_6
	accum 3 trigger_if_equal 7 tank run_7
      accum 3 trigger_if_equal 8 tank run_8
	accum 3 trigger_if_equal 9 tank run_9
	accum 3 trigger_if_equal 10 tank run_10
	accum 3 trigger_if_equal 11 tank run_11
	accum 3 trigger_if_equal 12 tank run_12

}

trigger move
{
	trigger self move_check
	wait 500
	trigger self move
}

trigger move_check
{
	trigger self stuck_check
	accum 1 abort_if_bitset 3

	trigger self dispatch
}

trigger run_continue
{
	accum 3 inc 1

	trigger self deathcheck
	trigger self stopcheck
	trigger self move
}

trigger run_0
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln0 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_1
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln1 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_2
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln2 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_3
{
	trigger self tracks_forward
	accum 1 bitset 2
//	=======================
	trigger barrier1 remove
//	=======================
	followspline 0 spln3 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_4
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln4 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_5
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln5 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_6
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln6 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

trigger run_7
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln7 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

  trigger run_8
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln8 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

  trigger run_9
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln9 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}
  trigger run_10
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln10 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}
  trigger run_11
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln11 80 wait
	accum 1 bitreset 2

	trigger self run_continue
}

  trigger run_12
{
	trigger self tracks_forward
	accum 1 bitset 2
	followspline 0 spln12 80 wait
	accum 1 bitreset 2

	trigger self script_lockout

	accum 3 inc 1

	trigger tank_sound stop
	trigger self tracks_stop		
	startanimation 5 10 15 nolerp norandom	// stopping
	wait 666
	startanimation 0 1 15 nolerp norandom	// stopped

	wait 900

	trigger tank_turret turn
}

// =========================
// script lockouts

trigger script_lockout
{
	accum 5 inc 1
}

trigger script_lockout_stop
{
	accum 5 inc -1
}

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
}

// ================================
// stop check
trigger stopcheck
{
	trigger self stopcheck_setup
	accum 1 abort_if_not_bitset 6

	trigger self script_lockout

	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_lockout_stop
	resetscript
}

trigger stopcheck_setup
{
	accum 1 bitset 6				// stop if we're stuck/no-one's pushing :)

	accum 1 abort_if_bitset 8		// no one in the trigger, abort

	trigger self stuck_check		// call the stop check function
	accum 1 abort_if_bitset 3		// we're stuck so break out

	accum 1 bitreset 6			// we're free to move
}

// ======================================
// stuck checking

trigger stuck_check
{
	accum 1 bitreset 3

	trigger self stuck_check_barrier
	trigger self stuck_check_scriptlockout
	trigger self stuck_check_finished
}

trigger stuck_check_finished
{
//	The check should be the final spln nbr + 1
	accum 3 abort_if_less_than 13
	accum 1 bitset 3
}

trigger stuck_check_scriptlockout
{
	accum 5 abort_if_equal 0
	accum 1 bitset 3
}

trigger stuck_check_barrier
{
	accum 3 abort_if_not_equal 3
	globalaccum 0 abort_if_not_bitset 0	// abort if barrier not built
	accum 1 bitset 3
}

trigger tank_disable
{
	accum 4 inc 1				// up the stop counter
	accum 4 abort_if_less_than 4

	accum 1 bitset 8				// set stop check

	trigger self deathcheck
}

trigger tank_enable
{
	trigger self stuck_check
	accum 1 abort_if_bitset 3 	// stuck check

	accum 4 set 0			// reset stop counter
	accum 1 bitreset 8		// reset stop check

	accum 1 abort_if_bitset 2 	// already following spline
	accum 5 abort_if_not_equal 0	// are we not in a script lockout?

	accum 1 abort_if_bitset 7 	// death check

	trigger self script_lockout

	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_lockout_stop

	trigger self move
}

trigger tracks_forward
{
	accum 0 abort_if_equal 1
	accum 0 set 1

	remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_forward

	remapshaderflush
}

trigger tracks_stop
{
	accum 0 abort_if_equal 0
	accum 0 set 0

	remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_left
	remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_right
	remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_left
	remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_right
	remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_left
	remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_right

	remapshaderflush
}

trigger tracks_turn_left
{
	accum 0 abort_if_equal 2
	accum 0 set 2

	remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_backward
	remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_backward
	remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_backward
	remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_forward

	remapshaderflush
}

trigger tracks_turn_right
{
	accum 0 abort_if_equal 3
	accum 0 set 3

	remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_backward
	remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_backward
	remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_forward
	remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_backward

	remapshaderflush
}

trigger startfire
{
	startanimation 67 8 10 nolerp norandom noloop
}

trigger stopfire
{
	startanimation 0 1 15 nolerp norandom
}

}

tank_build
{
spawn
{
wait 500
attachtotag tank_shell tag_turret
}
}

tank_construct
{
spawn
{
wait 1000

	kill tank

	constructible_class 2
	constructible_health 1200
	constructible_constructxpbonus 10
	constructible_destructxpbonus 10
}

built final
{
	alertentity tank
	wm_announce "The tank has been repaired!"
}

}

tank_disabler
{
trigger run
{
trigger tank tank_disable
}
}

tank_enabler
{
trigger run
{
trigger tank tank_enable
}
}

tank_fire_sound
{
trigger run
{
setposition tank
alertentity tank_fire_sound
}
}

tank_flash
{
spawn
{
wait 300
attachtotag tank_turret tag_flash
setstate tank_flash invisible
}

trigger run
{
	setstate tank_gunsmoke default
	setstate tank_flash default
	wait 100
	setstate tank_flash invisible
	setstate tank_gunsmoke invisible
}

}

tank_gunsmoke
{
spawn
{
wait 300
attachtotag tank_turret tag_flash
setstate tank_gunsmoke invisible
}
}

tank_shell
{
spawn
{
wait 400
attachtotag tank tag_tank
}
}

tank_smoke
{
spawn
{
wait 300
attachtotag tank_shell tag_smoke
setstate tank_smoke invisible
}
}

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 rebirth
{
	trigger tank sound_rebirth
	wait 1400
	trigger tank sound_idle
}

}

tank_trigger
{
spawn
{
wait 500
attachtotag tank_shell tag_turret
}
}

tank_turret
{
spawn
{
wait 500
attachtotag tank_shell tag_turret
}

trigger turn
{
	wait 1000

	playsound sound/vehicles/tank/turret_spin.wav looping
	faceangles 0 340 0 3000
	stopsound
	playsound sound/vehicles/tank/turret_end.wav

	wait 500

	trigger tank startfire
	playsound sound/vehicles/tank/tank_fire.wav
	trigger tank_flash run
	wait 600
	trigger tank stopfire

	playsound sound/vehicles/tank/turret_spin.wav looping
	faceangles 0 0 0 3000
	stopsound
	playsound sound/vehicles/tank/turret_end.wav
	trigger tank sound_death

	trigger tank script_lockout_stop
}

}

What do I need to add in GTKradiant and in the script to make the tank blow something up? I am assuming a func_explosive or something Thanks for the help!


(shagileo) #2

Woah use the search button :stroggtapir:

I made a similar topic (actually the same one) months ago:
http://www.splashdamage.com/forums/showthread.php?t=16553&highlight=tank+blows

I’ll take a look at your script now, so take a look at the topic and meanwhile I sort out your script :slight_smile:


(isbowhten) #3

… words in “” are there because i am not sure if it is the best word to say what i want.

trigger run_12
{
trigger self tracks_forward
accum 1 bitset 2
followspline 0 spln12 80 wait
accum 1 bitreset 2

trigger self script_lockout

accum 3 inc 1

trigger tank_sound stop
trigger self tracks_stop
startanimation 5 10 15 nolerp norandom // stopping
wait 666
startanimation 0 1 15 nolerp norandom // stopped

wait 900

trigger tank_turret turn
//here we go
// set here the trigger_hurt (the “way” the cannon shoots) to default and alert the “explosion”( target_explosion)
//of the gun
// add a wait (the time the “shell” needs to fly)
// set the hurt invisible again
//alert the func_explosive (with targetname and health=0 ) so the func_explosive is gone then
}

EDIT: read shagileo’s post first if you did not yet.


(vince829) #4

Thanks for the info. I will test this out in a little while. Also, I did use the search button, I just did not find a topic on it. I looked for about an hour :frowning:


(shagileo) #5

Take a look at this post: http://www.splashdamage.com/forums/showpost.php?p=176445&postcount=9
I wanted the tank to destroy castle doors (but I gave the doors the name bankdoor … don’t ask )
it’s all in the “alertentity bankdoors” .

So you give your doors a func_explosive (in radiant) and a targetname (in my case) “bankdoor”
That’s it for radiant

You go to your script and look for something that should look like:
tank_turret

There you follow what your tank is doing. At “trigger turn” your turret of the tank turns … doh
then you continue reading and follow the steps:

trigger tank startfire => speaks for itself
playsound sound/vehicles/tank/tank_fire.wav => sound the tank makes when firing
trigger tank_flash run => a flash comes out of the turret
wait 600
trigger tank stopfire
alertentity bankdoor => the script tells the entity “bankdoor” to blow up by itself

	playsound sound/vehicles/tank/turret_spin.wav looping => the turret is turning in its starting position
	faceangles 0 0 0 3000
	stopsound
	playsound sound/vehicles/tank/turret_end.wav
	trigger tank sound_death

Hope I helped you out a bit :slight_smile:


(vince829) #6

I have gotten my object to be destroyed by the gun which is good. However, if I am in the tank when it fires, I fall through the map. If I am outside the tank when it fires, the tank disappears and the object blows up next. Here is my script:

tank_turret
{
spawn
{
wait 500
attachtotag tank_shell tag_turret
}

trigger turn
{
	wait 1000

	playsound sound/vehicles/tank/turret_spin.wav looping
	faceangles 0 340 0 3000
	stopsound
	playsound sound/vehicles/tank/turret_end.wav

	wait 500

	trigger tank startfire
	playsound sound/vehicles/tank/tank_fire.wav
	trigger tank_flash run
	wait 600
	trigger tank stopfire
        alertentity breachwall

	playsound sound/vehicles/tank/turret_spin.wav looping
	faceangles 0 0 0 3000
	stopsound
	playsound sound/vehicles/tank/turret_end.wav
	trigger tank sound_death

	trigger tank script_lockout_stop
}

}

and

trigger run_25
{
trigger self tracks_forward
accum 1 bitset 2
followspline 0 spln25 80 wait
accum 1 bitreset 2

        trigger self script_lockout

	accum 3 inc 1

	trigger tank_sound stop
	trigger self tracks_stop		
	startanimation 5 10 15 nolerp norandom	// stopping
	wait 666
	startanimation 0 1 15 nolerp norandom	// stopped

	wait 900

	trigger tank_turret turn

}

Do you have any idea why it does those two things? And thanks a million, you guys have helped me out a lot.


(isbowhten) #7

hm… a disappearing tank , in my opinion, can only be caused by a setstate command and another followspline command…

i did not find a command that would make the tank disappear, so maybe the tank and some other entities which are affected by one of those commands have the same targetname/scriptname, so the tank accidently is affected,too …
maybe…


(Magic) #8

Your tank is maybe back to spline 0 again.
Try to add 2 or 3 more splines at the end.


(vince829) #9

I tried adding more splines and it did not work. If someone could check this out.

Here is my .map:

http://www.divshare.com/download/6149498-e59

and my script:

http://www.divshare.com/download/6149512-1df

I checked over everything and nothing stands out. Also, here is the tutorial I followed and my tank prefab. There may be a problem in the tutorial:

http://www.pythononline.co.uk/et/tutorial38.htm

Thanks


(isbowhten) #10

the error is that your last spline has the targetname spln25 …
but in your script you want to follow spln25 !
following a spline means moving between its targetname and its target…
e.g. followspline 10 means moving from 10 to 11 !!
so i just added a spln26 as target for the spln25…<- the target of spln25 has been missed before.

and now it works.
if you wanna keep your tank route then just delete the routine in the script of spln24 and name the spln25 routine to spln24


(shagileo) #11

AAAAAAAAND I had the exact same problem some time ago :smiley:

After some digging I found the thread: http://www.splashdamage.com/forums/showthread.php?t=2228&page=2

Look at posts:
http://www.splashdamage.com/forums/showpost.php?p=175309&postcount=39
http://www.splashdamage.com/forums/showthread.php?t=2228&page=3

So that’s what Good 'ol Isbowhten has done to your script. :cool: nice job, Isbo :wink:

EDIT: oh and do not forget to set up the correct trigger stuck_check_finished

Example: http://www.splashdamage.com/forums/showpost.php?p=175590&postcount=48


(vince829) #12

perfect it does not disappear anymore! Thanks a lot