Prefab and scripting for a 'grab 'n cap' objective


(Ifurita) #1

First off, big thanks to Mean Mr. Mustard, who turns out not to be so mean. In any case, I finally got my returnable objectives working and thought I’d post a prefab of the entities, my script, and a graphic showing how everything works, with the key values I used.

First off, the graphic shows a box of gold that the axis must take (allied_gold) and return to their getaway truck (axis_truck). There are two goldbox markers at the truck showing the current state of the objective, secured (allied_gold_captured) or still in play (allied_gold_red). I set this up as a team_CTF_blueflag entity even though Axis are typically thought of as the red team (Doh!)

To start off, think of the flag and objective as two seperate pieces, I’ve labeled them in the graphic as the pickup point (where you’re going to grab the flag) and the dropoff point (where you’re going to take the objective). I’ve used the truck model, but it’s largely irrelevent. All that matters is the triggers.

The Pickup Point

  1. Start off with a Team_CTF_blueflag entity and specify the skin and model you want the player, in-game, to see. I’ve used the gold box from Goldrush. The scriptname, allied_gold (see below), is going to provide all the specifics about what happens when the flag is captured, returned, and secured

  2. Add a brushwork trigger around the flag and make it a Trigger_Objective_Info entity. Specify the command map icons you want the allied or axis team to see. The spawnflags=2 correspond allied_objective, meaning that the allies own it at game start

  3. Now, in order for the command map icon to show up, you need a misc_commandmap_marker. This needs to be targetted by the TOI and will display the specified icon on the command map, WHERE THE TOI IS LOCATED. In this case, I want to show the gold bar icon, so the allied_gold TOI targets allied_gold_cm_marker

The Dropoff Point

The dropoff point looks complicated but is pretty simple too.

  1. Create a trigger_flagonly_multiple entity. This entity will trigger whenever a flag, color is controlled by the spawnflags, is run thru the trigger space. If you have multiple team_CTF_blue/redflag entities, you only need one trigger_flagonly_multiple entity. This also means that whatever script you run, has to be general to all flags and not specific any one particular objective.

In my case, the script ‘allied_objectives’ triggers a game_manager script and checks to see if both flags have been captured, thus ending the game

  1. Now, we want to have a command map marker for the truck too. Add a trigger_objective_info and misc_commandmap_marker entities for the truck in the same way as we did at the pickup point. It’s an axis truck, so I named mine axis_truck_cm_marker, which is targetted by the axis_truck_toi entity.

  2. Lastly, we want to have a box of gold in 2 states, which shows whether the gold has been secured or in play. This is simply controlled by a setstate argument in the ‘allied_gold’ script and is automatically triggered by the spawn and captured events. I’ve used a similar argument in the secured and return events to turn the command map marker (allied_gold_cm_marker) on and off.

I think that’s about it. Here is the graphic:

Here is the prefab:

http://www.rtcwonline.com/dummies/maps/prefab_iffy_objective.zip

and lastly, here are the relevant scripts:


//Gold
	allied_gold
	{
		spawn
		{
			wait 200
			setstate allied_gold_captured invisible 
		}

		trigger stolen
		{
			wm_announce 0 "Return the Allied gold to the getaway truck"
			wm_announce 1 "The Axis have stolen the Allied gold"
			setstate allied_gold_cm_marker invisible
		}

		trigger returned
		{
			wm_announce 0 "The Allies have retrieved the gold"
			wm_announce 1 "Gold returned!  Protect the gold"
			setstate allied_gold_cm_marker default
		}

		trigger captured
		{
			wm_announce "The Axis have secured the Allied gold"
			setstate allied_gold_red invisible
			setstate allied_gold_captured default
		}
	}

	allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity 
	{	
	death
		{
			trigger game_manager obj1
		}
	}

Hope this is useful to someone


(sock) #2

First off, very nice work with the prefab and diagram. Its a cool feature of ET and one which mappers should make good use of.

There is a couple of small errors in your prefab/script. The script does not use “accum 6” so no point in defining it. The “trigger_objective_info” for the pickup point has a “objflags” key defined which refers to pulsating objectives on the command map. The sample map has a rogue origin brush over near the “allied_gold_cm_marker”, “misc_command_marker”.

Sock
:moo:


(Ifurita) #3

thanks, will fix that

Edit: Fixed


(Mean Mr. Mustard) #4

I think there is a small error in the ‘trigger returned’ script. You want to make the cm_marker visible when the gold is returned

trigger returned 
      { 
         wm_announce 0 "The Allies have retrieved the gold" 
         wm_announce 1 "Gold returned!  Protect the gold" 
         setstate allied_gold_cm_marker default 
      } 


(Ifurita) #5

fixed


(K:os) #6

anyone still got this prefab please?

the link above doesn’t work anymore

Thanks

Adam


(Ifurita) #7

http://www.fileplanet.com/dl.aspx?/planetwolfenstein/4newbies/prefab_iffy_objective.zip


(K:os) #8

ta very much