Tank troubles


(DaRkFiRe) #1

Hello everyone. I’ve been poking my head around in the tank department, and have gotten a major headache.

Here, it’s not solid, and without light. I’m using a misc_model instead of a model2 on the script_mover so I can attach the browning gun the the turret. I’ve rotated the clip brushes 90 degrees from where I want the tank to move, which leads into my next problem:

My tank clips are encased beneath the map. However, when I leave the clips unrotated, they rotate themselves 90 degrees, and stay above the map :???:

I’ve read Chavo’s problem from a few months ago about his problems, and they seem similar. Though I didn’t find anything that would help me here.

So, what I guess I’m asking is: Chavo, how did you resolve your problem?


(chavo_one) #2

From your description it sounds like you have more wrong than right so I’m not sure where to start.

I’m not going to rehash what the LDR already says, but I will list out the steps to getting your core tank entities straight. The following steps are specific to the churchill. The jagdpanther would be slightly different. So, from the beginning:

  1. Put the tank model in the map as a misc_model, and don’t rotate it. (It should be pointed due east.) This model will be used as a reference for making the clip brushes.
  2. Insert the tank turret into the map as a misc_gamemodel. This will be used as a reference for making the clip brushes as well. However, we will actually be using it later so it must be a misc_gamemodel. Set it’s targetname and scriptname to “tank_turret”.
  3. Using the tank models as references, build a clip brush representation of the tank. Add an origin, and make it a script_mover.
  4. Delete the misc_model tank body that you used as a reference.
  5. Set some very important key/values on the clip brush script mover:
    …[a] model2 -> models/mapobjects/tanks_sd/churchhill.md3
    …[b] gun -> browning
    …[c] tagent -> tank_turret
    …[d] spawnflags -> compass, solid, explosivedamageonly, resurectible, mounted_gun

Remember, this is not a comprehensive list of all the key/value pairs and spawnflags. It is just the beginning details that most people miss. Don’t forget that you can open up the fueldump bsp file in wordpad and look at all of the entities and their values. That was how I got my tank working.


(grizzlybear) #3

eeerrrrmmmmmmmmmmmmmmm… goldrush

pull out the tank and then seperate all the components so u can clearly see what is targeting what and what entitys contain what
(only rotate thru the script )or it will go fuzzy :wink:


(DaRkFiRe) #4

I’ve done what Chavo said, and rotated the clips via scripting. My problem now is, nothing will move or repair. I’m very sure it’s my script:

game_manager
{
	spawn
	{
			
	}

}

tank
{
	spawn
	{
	wait 400
	
	faceangles 0 360 0 360

	trigger tank sound_idle
	trigger tank tracks_stop
	}

	///---------------------------
	///--------Triggers-----------
	
	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

    // Any just started moving stuff goes here

    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 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 move_check
	{
    trigger self stuck_check
    accum 1 abort_if_bitset 3

    trigger self dispatch
	}

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

	trigger dispatch
	{
    accum 3 trigger_if_equal 0 tank run_0
    accum 3 trigger_if_equal 133 tank run_133
	}
	
	trigger run_0
	{
    accum 1 bitset 2
    trigger tank_turret2 run_0
    followspline 0 spln0 80 wait length -64
    accum 1 bitreset 2

    trigger self run_continue
	}
	
	trigger run_incpos
	{
    accum 3 inc 1
	}

	trigger run_continue
	{
    trigger self run_incpos
    trigger self deathcheck
    trigger self stopcheck
    trigger self move
	}
	
	trigger stuck_check
	{
    accum 1 bitreset 3

    trigger self stuck_check_bridge_built
    trigger self stuck_check_bridge_dyna
    trigger self stuck_check_scriptlockout
    trigger self stuck_check_finished
	}

	trigger stuck_check_finished
	{
    accum 3 abort_if_less_than 134
    accum 1 bitset 3
	}

	trigger stuck_check_scriptlockout
	{
    accum 5 abort_if_equal 0
    accum 1 bitset 3
	}
	
	trigger stopcheck_setup
	{
    accum 1 bitset 6
    accum 1 abort_if_bitset 8
    trigger self stuck_check
    accum 1 abort_if_bitset 3
    accum 1 bitreset 6
	}

	trigger stopcheck
	{
    trigger self stopcheck_setup
    accum 1 abort_if_not_bitset 6
    trigger self script_lockout

    // 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_lockout_stop
    resetscript
	}
	
	trigger script_lockout
	{
    accum 5 inc 1
	}

	trigger script_lockout_stop
	{
    accum 5 inc -1
	}
	
	death
	{
    accum 1 bitset 7
	}

	trigger deathcheck
	{
    accum 1 abort_if_not_bitset 7
    accum 1 abort_if_bitset 9
    accum 1 abort_if_bitset 2
    accum 5 abort_if_not_equal 0

    accum 1 bitset 9

    changemodel models/mapobjects/tanks_sd/churchhill_broken.md3
    setstate tank_smoke default

    alertentity kill_tank

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

rebirth
{
    accum 1 bitreset 9
    accum 1 bitreset 7
	{
    trigger self script_lockout
    changemodel models/mapobjects/tanks_sd/churchhill_oasis.md3
	
    setstate tank_smoke invisible
	}
    trigger tank_sound rebirth
    wait 500
	{
    trigger tank script_lockout_stop
	}
	
}

tank_disabler
{
    trigger run
    {
        trigger tank tank_disable
    }
}

tank_enabler
{
    trigger run
    {
        trigger tank tank_enable
    }
}

tank_trigger
{
    spawn
    {
        wait 100
        attachtotag tank tag_turret
    }
}
 
tank_build
{
    spawn
    {
        wait 100
        attachtotag tank tag_turret
    }
}

tank_construct
{
    spawn
    {
        wait 400
        constructible_class 2
    }

    built final
    {
        alertentity tank
        wm_announce "Tank Repaired"
    }

    trigger final_pos
    {
        constructible_constructxpbonus 3
        constructible_destructxpbonus 3
    }
}

I’m not totally sure what’s wrong, because I’m new to script_movers. If someone could tell me what’s wrong with it, I’ll gladly fix it :chef:

And if anyone is wondering, here is my tank entity from my .map:

"model2" "models/mapobjects/tanks_sd/churchhill_oasis.md3"
"health" "1200"
"gun" "browning"
"tagent" "tank_turret"
"description" "Churchill Mk VIII"
"scriptname" "tank"
"spawnflags" "190"
"classname" "script_mover"

(chavo_one) #5

When the tank spawns you should attach it to a spline. That will do two things.

  1. The tank will point in the correct direction, so you won’t have to mess with faceangles.
  2. The tank will be properly set up to move on the spine, jerk free, when a player moves it.

Here’s the spawn function for my tank in venice:


	spawn
	{
		wait 50
		trigger self sound_idle

		accum 1 bitset 5
		trigger self tracks_stop

		//Reset the tank into correct position
		followspline 0 spln_st 10000 wait length -64

	}

Also, if the tank won’t move or repair, it sounds like your target and targetnames are messed up. Make sure you have the following:

tank_build [trigger_objective_info] -> tank_construct [func_constructible]

tank_trigger [trigger_multiple] -> tank_enabler [target_script_trigger] -> run [script function]

[func_timer] -> tank_disabler [target_script_trigger] -> run [script function]


(DaRkFiRe) #6

Thanks for the info!

Here is the my spawn function for the tank routine, with the followspline command:

spawn
	{
	wait 400
	
	followspline 0 spln_0 10000 wait length -64

	trigger tank sound_idle
	trigger tank tracks_stop
	}

I’m still yet to test it though, I’ll get back to you on that. As for the targetnames, I’ve double checked, and I am positive that all the the targets and targetnames are correct. I’ll check again though.


(Chruker) #7

Try using the ordinary churchhill.md3 model during development. Because I think I remember a post about the oasis model of it, was missing some tags in the model. Ohh, here it was: http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&p=22545#22545

I can see its the post where chavo learned his stuff :slight_smile:


(DaRkFiRe) #8

I actually did what Chavo did before and renamed the snow churchhill’s .tag files with the _oasis extension, and it all worked fine :slight_smile:

Now, the tank moves, but at a really fast pace. When it reaches the second spline, it drives into the ground, while still in the moving animation :???: I think my splines are facing the wrong angle (at this point it’s all I can think of). My tank turret also stays behind while the tank moves forward.


(grizzlybear) #9

mmmmmm… there is a } above rebirth that should not be there (rebirth is part of the tank script)

as parts of the tank spawn they attach to the tag of the tank shell whitch attaches to the tag of the tracks which is the actual mover

get the basic tracks sorted as they are the mover
then start adding bits to the mover with attatch to tag

ps. splines need target and targetname (green line will tell u u have it right) mover will follow this direction(unless told to point elswhere by using faceangles)
turret has its own script to follow in fueldump (look lower down ;)) (also bridge and dyno bits are not needed in scriptlockouts)(easier to add them later if needed )

try using the goldrush tank and swapping the jagdpanzer model for the sherman model ect.(then at least u know u have set all the map entitys correctly as u have something to check them against)

speed is set in the script
followspline 0 spl_1 100(speed) wait