Rotating Tank Turret Questions


(Softwar) #1

Hi all,

Before the tank in goldrush blows the bankdoor the turret rotates some degrees, my tank turret has to rotate 2 times to blow a gate and a side entrance.

This is the part of 'goldrush’s ’ script where the turret rotates =>


trigger run_76
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln78 50 wait length 32
		accum 1 bitreset 2

		trigger self script_lockout

		trigger self 		tracks_stop
		trigger tank_sound 	stop

		wm_objective_status 2 0 2
		wm_objective_status 2 1 1

		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom

		wait 900

		trigger tank_turret turn

		accum 3 inc 1
	}

What do you have to change in the script if the tank has to shoot straightaway and again 60 degrees to the left.

Please give me the 2 scriptparts I need for this,

Many thx already :smiley:


(thegnat) #2

I think you will have to find out, which frames fit for your turn. Never dealt with tanks so far.

PS: No copy&paste snipplets. :confused:


(Malverik) #3

actually the part you want to change is

tank_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 boomtrigger boom_all		// triggers the hurts around bank explosions (each has its own wait for timing)
		trigger tank_flash run
	}

what you need is change faceangles 0 340 0 3000 where 340 is the absolute angle (east is 0 or 360, north is 90 degrees) and 3000 is how much time it takes (3 seconds in that case)
The other 0’s are if you wanted to move it up/down or tilt sideways

here is the ldr ref:

faceangles <pitch> <yaw> <roll> <duration/GOTOTIME> [ACCEL/DECCEL] 
The entity will face the given angles, taking <duration> to get their. If the GOTOTIME is given instead of a timed duration, the duration calculated from the last gotomarker command will be used instead. 


(Softwar) #4

Sorry, I gave the wrong script part I think

Here is the tank turret part =>


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 boomtrigger boom_all		// triggers the hurts around bank explosions (each has its own wait for timing)
		trigger tank_flash run
	}

	trigger blow_doors
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		alertentity bank_door1
		setstate doorframe invisible
		setstate doorframe_damaged default

		wm_announce "Allied team has destroyed the Bank Doors!"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		wm_set_main_objective		4	0
		wm_set_main_objective		4	1

		wait 100
		trigger bank_door2_damaged bankbackboom

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

So I need to know the faceangles if the tank has to shoot straigtaway and 60 degrees to the left.


(Softwar) #5

Sorry, I gave the wrong script part I think

Here is the tank turret part =>


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 boomtrigger boom_all		// triggers the hurts around bank explosions (each has its own wait for timing)
		trigger tank_flash run
	}

	trigger blow_doors
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		alertentity bank_door1
		setstate doorframe invisible
		setstate doorframe_damaged default

		wm_announce "Allied team has destroyed the Bank Doors!"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		wm_set_main_objective		4	0
		wm_set_main_objective		4	1

		wait 100
		trigger bank_door2_damaged bankbackboom

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

I need to know the faceangles for these 2 directions=>

  1. straigtaway

  2. 60 degrees to the left


(Chruker) #6
  1. straigtaway is 0
  2. 60 degress to the left would be 300

This all assumes that the tank turret is attached to the tank body using the attachtotag command.


(Softwar) #7

In the goldrush script the faceangles are=>


0 340 0 3000

I have to use this=>

for straigtaway: 0 0 0 3000

for 60 degrees to the left: 0 300 0 3000

Please give me the exact faceangles


(Malverik) #8

lol dude, its ABSOLUTE angle, its not relative to the tank or current turret orientation.

what is straightaway for you? is it north, is is east?

and 60 degrees to the left = current angle + 60 degree.

The way it works, you cannot tell the turret “turn left 60 degrees”, you tell him “face that direction”

So you need to look at your map in radiant and see how the tank is gonna be oriented when it reaches the point where it has to fire. From there you look at where the turret is gonna pointing.
Or if you did geometry at school, you do arctan( (y2-y1) / (x2-x1) ) where (x1,y1) is the turret coordinates, and (x2,y2) is the coordinates of the thing to blow up


(Chruker) #9

If you attached the turret to the tank, the turret will turn with the tank. Then the angles isn’t absolute.