TRI file tips 'n tricks

Campaign editing

Moderators: Lone Wolf, Snake Man

Post Reply
User avatar
DoctorX
Recruit
Posts: 38
Joined: 2009-06-04 02:15:18
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

TRI file tips 'n tricks

Post by DoctorX » 2009-07-09 05:12:20

Here are a few tricks with the .tri file I've been experimenting with in the campaign I'm currently designing. They haven't been tested fully but so far they seem promising.

I have added an indentation scheme to the code just to make it easier to follow. Don't use indentation in the actual .tri file or it will cause a crash.

User avatar
DoctorX
Recruit
Posts: 38
Joined: 2009-06-04 02:15:18
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by DoctorX » 2009-07-09 05:14:54

STALLED CAMPAIGN PREVENTION-

This one is intended to reignite a stalled campaign. It acutally combines two events into one. If no events occur after 100 campaign hours since the last event, an initiative bias is randomly given to either the red side or the blue side. The idea is that if neither team is on the offensive it will force one of them onto it, or if one team has been on the offensive for the whole time but can't get anything accomplished then they will either lose the initiative to the other team, or get a kick in the pants to increase the intensity of their assault.

Once this event is triggered, if it is not reset within 140 hours the campaign will then end with the standard campaign timeout ending (so the campaign would timeout after a total of 240 "bordom" hours in this case).

Although not shown here, it is important to note that this event (event 20 in this case) is manually reset by every other event in the .tri file when they are triggered. (I've also added the #RESET_BORDOM_TIMEOUT command to every other event in my .tri file because I've noticed that when an event is triggered sometimes it doesn't automatically reset the bordom hours)

Code: Select all

// Event #20 - Campaign Slowdown (No events occurred in the last 100 hours - Randomly 
// shift the initiative to one of the teams, reset the tempo / No events occurred in 
// last 240 hours - Play movie 114 and end game):
#IF_EVENT_PLAYED 20

	// If event 20 already happened then the random bias has already been applied 
	// and there has been at least 100 bordom hours.  If 140 more bordom hours go 
	// by (for a total of 240 bordom hours) the campaign will end in a stalemate:
	#IF_BORDOM_HOURS 140
		#PLAY_MOVIE 114
		#END_GAME 20
	#ENDIF
#ELSE

	// 100 hours have elapsed since the last event occured - the campaign has 
	// gotten stale:
	#IF_BORDOM_HOURS 100

		// Basically, flip a coin here.  If it comes up heads give the blue side 
		// a boost in initiative to try to ignite an offensive:
		#IF_RANDOM_CHANCE 50
			#SHIFT_INITIATIVE 6 2 50
			#SET_TEMPO 255
			#RESET_BORDOM_TIMEOUT
			#DO_EVENT 20

		// If the coin comes up tails, give the initiative boost to the red side 
		// instead:
		#ELSE
			#SHIFT_INITIATIVE 2 6 50
			#SET_TEMPO 255
			#RESET_BORDOM_TIMEOUT
			#DO_EVENT 20
		#ENDIF
	#ENDIF
#ENDIF
Last edited by DoctorX on 2009-07-09 05:32:40, edited 1 time in total.

User avatar
DoctorX
Recruit
Posts: 38
Joined: 2009-06-04 02:15:18
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by DoctorX » 2009-07-09 05:16:39

PRIORITY MANAGEMENT-


In my campaign, each side has three objectives to capture to achieve victory. For the red side those objectives are Seoul, Choongwon, and Wonsan (Wonsan is initially occupied by the blue side in this campaign). For the blue side, they must capture P'yongyang, Ch'aryon'gwan, and hold Wonsan.

This being the case, once a team captures an objective, there are 4 options open to them as for what to attack or re-capture next. Rather than leave this decision up to the campaign engine I've instead made it so the next move will be to the next objective of the most tactical significance.

Here is an example of what happens when Choongwon either falls to the red side or is recaptured by the blue side. Each of the other primary objectives has a similar event for it. The idea here is that if Choongwon is captured by the red side, the red side will first look to see if they still hold Ch'aryon'gwan. If not, then they will move to recapture it. If they still hold it, they will then make sure they still hold P'yongyang. If they still control all of their own objectives, they then will look to capture Wonsan, and finally if all of those objectives are in their control then they will decide to attack Seoul.

Similarly, if the blue side recaptures Choongwon they will check through their own objectives in the following order: Seoul, Wonsan, P'yongyang, and then Ch'aryon'gwan. Once they find one they don't control it will become their next objective.

Code: Select all

// Event #5 - Choongwon Falls (ROK loses control of Choongwon and Choongwon 
// Airbase objectives - Make next red side objective top priority / ROK 
// recaptures Choongwon objectives - Make next blue side objective top 
// priority):
#IF_EVENT_PLAYED 5

	// Blue side recaptures Choongwon:
	#IF_CONTROLLED 2 A 590 870

		// Note I've added a "reset_bordom_timeout" and "reset_event 20" 
		// command.  These are for the stalled campaign prevention 
		// event that I described above.
		#RESET_BORDOM_TIMEOUT
		#RESET_EVENT 5
		#RESET_EVENT 20

		// Event 4 is "Seoul falls" - If that happened then make 
		// Seoul top priority:
		#IF_EVENT_PLAYED 4
			#SET_PAK_PRIORITY 2 404 95
			#SET_PAK_PRIORITY 6 404 95
			#SET_PAK_PRIORITY 2 590 95
			#SET_PAK_PRIORITY 6 590 95
			#SET_PAK_PRIORITY 2 260 95
			#SET_PAK_PRIORITY 6 260 95
			#SET_PAK_PRIORITY 2 464 95
			#SET_PAK_PRIORITY 6 464 95
			#SET_PAK_PRIORITY 2 228 100
			#SET_PAK_PRIORITY 6 228 100

		// If Seoul is still in blue hands then decide what objective 
		// to concentrate on next:
		#ELSE

			// Event 6 is "Wonsan Falls" (note - Wonsan is initially 
			// controlled by blue side at the start of my campaign) 
			// If blue side no longer controlls Wonsan then make that 
			// the next objective:
			#IF_EVENT_PLAYED 6
				#SET_PAK_PRIORITY 2 228 95
				#SET_PAK_PRIORITY 6 228 95
				#SET_PAK_PRIORITY 2 590 95
				#SET_PAK_PRIORITY 6 590 95
				#SET_PAK_PRIORITY 2 260 95
				#SET_PAK_PRIORITY 6 260 95
				#SET_PAK_PRIORITY 2 464 95
				#SET_PAK_PRIORITY 6 464 95
				#SET_PAK_PRIORITY 2 404 100
				#SET_PAK_PRIORITY 6 404 100
			#ELSE

				// Event 8 is "P'yongyang captured" - if this happened 
				// then decide what other red side objective to attack:
				#IF_EVENT_PLAYED 8

					// Event 9 is "Ch'aryon'gwan captured" - if 
					// this has not happened yet then make it the 
					// next objective:
					#IF_EVENT_PLAYED 9
					#ELSE
						#SET_PAK_PRIORITY 2 404 95
						#SET_PAK_PRIORITY 6 404 95
						#SET_PAK_PRIORITY 2 228 95
						#SET_PAK_PRIORITY 6 228 95
						#SET_PAK_PRIORITY 2 590 95
						#SET_PAK_PRIORITY 6 590 95
						#SET_PAK_PRIORITY 2 260 95
						#SET_PAK_PRIORITY 6 260 95
						#SET_PAK_PRIORITY 2 464 100
						#SET_PAK_PRIORITY 6 464 100
					#ENDIF

				// If P'yongyang has not yet been captured by the blue 
				// side then make it top priority:
				#ELSE
					#SET_PAK_PRIORITY 2 404 95
					#SET_PAK_PRIORITY 6 404 95
					#SET_PAK_PRIORITY 2 228 95
					#SET_PAK_PRIORITY 6 228 95
					#SET_PAK_PRIORITY 2 590 95
					#SET_PAK_PRIORITY 6 590 95
					#SET_PAK_PRIORITY 2 464 95
					#SET_PAK_PRIORITY 6 464 95
					#SET_PAK_PRIORITY 2 260 100
					#SET_PAK_PRIORITY 6 260 100
				#ENDIF
			#ENDIF
		#ENDIF
	#ENDIF
#ELSE

	// Blue side loses control of Choongwon (I did it this way rather than 
	// explicitly check if DPRK controls the Choongwon objectives because 
	// in my campaign there are two separate enemy teams.  I omitted the 
	// other enemy team from these examples to try to keep it simple.)
	#IF_CONTROLLED 2 O 590 870
	#ELSE

		// Here's those two extra lines for the stalled campaign event 
		// again.  You would only need do_event 5 here if not using that:
		#RESET_BORDOM_TIMEOUT
		#DO_EVENT 5
		#RESET_EVENT 20

		// Event 9 is "Ch'aryon'gwan captured" - if this happened then 
		// the red side should try to recapture that first since it is 
		// the deepest in DPRK territory:
		#IF_EVENT_PLAYED 9
			#SET_PAK_PRIORITY 2 404 95
			#SET_PAK_PRIORITY 6 404 95
			#SET_PAK_PRIORITY 2 228 95
			#SET_PAK_PRIORITY 6 228 95
			#SET_PAK_PRIORITY 2 590 95
			#SET_PAK_PRIORITY 6 590 95
			#SET_PAK_PRIORITY 2 260 95
			#SET_PAK_PRIORITY 6 260 95
			#SET_PAK_PRIORITY 2 464 100
			#SET_PAK_PRIORITY 6 464 100

		// Red side still controls Ch'aryon'gwan so decide what is the 
		// next most tactically important objective:
		#ELSE

			// Event 8 is "P'yongyang captured" so the red side 
			// should regain their capitol:
			#IF_EVENT_PLAYED 8
				#SET_PAK_PRIORITY 2 404 95
				#SET_PAK_PRIORITY 6 404 95
				#SET_PAK_PRIORITY 2 228 95
				#SET_PAK_PRIORITY 6 228 95
				#SET_PAK_PRIORITY 2 590 95
				#SET_PAK_PRIORITY 6 590 95
				#SET_PAK_PRIORITY 2 464 95
				#SET_PAK_PRIORITY 6 464 95
				#SET_PAK_PRIORITY 2 260 100
				#SET_PAK_PRIORITY 6 260 100

			// All red side objectives are secured - time to 
			// attack the ROK:
			#ELSE

				// Event 6 is "Wonsan falls" (remember Wonsan 
				// is a blue city in this campaign) - if this 
				// happened already then the red side can move 
				// on to the next highest priority blue side 
				// objective:
				#IF_EVENT_PLAYED 6

					// Event 4 is "Seoul falls" - if this 
					// didn't happen yet then make it the 
					// next objective:
					#IF_EVENT_PLAYED 4
					#ELSE
						#SET_PAK_PRIORITY 2 404 95
						#SET_PAK_PRIORITY 6 404 95
						#SET_PAK_PRIORITY 2 590 95
						#SET_PAK_PRIORITY 6 590 95
						#SET_PAK_PRIORITY 2 260 95
						#SET_PAK_PRIORITY 6 260 95
						#SET_PAK_PRIORITY 2 464 95
						#SET_PAK_PRIORITY 6 464 95
						#SET_PAK_PRIORITY 2 228 100
						#SET_PAK_PRIORITY 6 228 100
					#ENDIF

				// Wonsan still in blue hands - red side 
				// should move in to capture it:
				#ELSE
					#SET_PAK_PRIORITY 2 228 95
					#SET_PAK_PRIORITY 6 228 95
					#SET_PAK_PRIORITY 2 590 95
					#SET_PAK_PRIORITY 6 590 95
					#SET_PAK_PRIORITY 2 260 95
					#SET_PAK_PRIORITY 6 260 95
					#SET_PAK_PRIORITY 2 464 95
					#SET_PAK_PRIORITY 6 464 95
					#SET_PAK_PRIORITY 2 404 100
					#SET_PAK_PRIORITY 6 404 100
				#ENDIF
			#ENDIF
		#ENDIF
	#ENDIF
#ENDIF
Last edited by DoctorX on 2009-07-09 05:37:12, edited 1 time in total.

User avatar
DoctorX
Recruit
Posts: 38
Joined: 2009-06-04 02:15:18
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by DoctorX » 2009-07-09 05:17:49

INITIATIVE MANAGEMENT-

Since there are three primary objectives for each team, it seems logical that if the war is going well for one side and they have captured two of the three they should get a boost in initiative as a reward. (Woo-hoo!! We kicked their asses all the way back to P'yongyang *high five* We got 'em on the run now boys - don't let up now!)

To achieve this - here is an example of an event that checks if two of the three events have occurred that will lead to a victory condition for the team. In this case if the blue side is still in control of Wonsan and has captured P'yongyang - they will get an initiative boost to send them truckin' up toward Ch'aryon'gwan and on to victory.

Code: Select all

// Event #13 - P'yongyang and Wonsan Captured (ROK controls both P'yongyang 
// and Wonsan objectives - Put red side on defensive, put ROK on offensive, 
// shift initiative to ROK, reset the tempo):
#IF_EVENT_PLAYED 13

	// Event 8 is "P'yongyang captured":
	#IF_EVENT_PLAYED 8

		// Event 6 is "Wonsan falls" - if this happened it means that 
		// the blue side lost one of the two objectives that triggered 
		// this event so take away the boost in initiative they were 
		// given:
		#IF_EVENT_PLAYED 6
			#SHIFT_INITIATIVE 2 6 50
			#RESET_BORDOM_TIMEOUT
			#RESET_EVENT 13
			#RESET_EVENT 20
		#ENDIF

	// Same thing here - if this event has been triggered then P'yongyang 
	// had been captured.  Since the red side regained it then take away 
	// the initiative boost from the blue side and give it back to the 
	// red side:
	#ELSE
		#SHIFT_INITIATIVE 2 6 50
		#RESET_BORDOM_TIMEOUT
		#RESET_EVENT 13
		#RESET_EVENT 20
	#ENDIF
#ELSE

	// Check if P'yongyang has been captured (event 8):
	#IF_EVENT_PLAYED 8

		// Check if Wonsan has not fallen (again - Wonsan is blue at 
		// the start of this campaign):
		#IF_EVENT_PLAYED 6
		#ELSE

			// Okay - blue side has indeed captured P'yongyang and 
			// still holds Wonsan so reward the blue side with a boost 
			// in initiative.  I've also included the change_priority 
			// commands to force the blue side onto the offensive and 
			// red side on the defensive, although I think these commands 
			// are now obsolete.  Also - as in the above example - there 
			// is the reset_bordom_timeout and reset_event 20 commands 
			// that are only necessary if using the stalled campaign 
			// prevention event:
			#SHIFT_INITIATIVE 6 2 50
			#CHANGE_PRIORITIES 6 1
			#CHANGE_PRIORITIES 2 2
			#SET_TEMPO 255
			#RESET_BORDOM_TIMEOUT
			#DO_EVENT 13
			#RESET_EVENT 20
		#ENDIF
	#ENDIF
#ENDIF

ccc
Chief of Staff
Posts: 4857
Joined: 2000-08-06 22:01:01

Re: TRI file tips 'n tricks

Post by ccc » 2009-07-09 10:09:56

geez.. i need more time to read and digest them..great job!

ccc
Chief of Staff
Posts: 4857
Joined: 2000-08-06 22:01:01

Re: TRI file tips 'n tricks

Post by ccc » 2009-07-09 12:28:25

my 0.02c,

- the stall prevention tweak is cool - the trigger, if work properly, will result in continous ground fighting - till one side running out of all its combat units.

- the priority tweak, very creative..it adds more human control on campaign logic..make the war [semi-dynamic].

good = war strategy of both sides becomes scripted, excuted orderly, and effectively driven by [stall prevention tweak].
bad = lost fluidity of war, lost "strategic surprise".

Snake Man
Commander-In-Chief
Posts: 9338
Joined: 2000-07-31 22:01:01
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.
Location: PMC
Contact:

Re: TRI file tips 'n tricks

Post by Snake Man » 2010-07-31 10:23:24

Excellent stuff DoctorX, thanks for posting! :)

If you have more, even some basic templates for both sides of the war, please post so we can learn some more.
PMC Tactical Forum New User Registration please read new info here.

PMC since 1984

Editing knowledge, visit PMC Editing Wiki
The leading, most detailed and comprehensive modification made for the Vietnam War - Vietnam: The Experience homepage
View our videos in PMC Youtube channel

PMC Tactical forum Advanced Search is power.

"ALPHA BLACK TO PAPA BEAR. ALL RUSSIANS ARE TOAST. OVER."

Dobey
Newbie
Posts: 3
Joined: 2010-03-27 03:46:25
Gaming Interests: ArmA, ArmA 2, Falcon 4.0 and OFP.
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by Dobey » 2010-08-06 07:57:19

Hi Guys,

I'm trying incorporate the trigger file for desert storm theatre that is listed in the wiki to enable me to have hostilities break out a couple of hours after the campaign starts to allow set-up of tankers and AWACS prior to the shooting.
This is the triger file as copied from the wiki:

Code: Select all

//
// OPERATION DESERT STORM historical 1991 campaign
//

//
// initialize
//
#TOTAL_EVENTS 2
#SET_TEMPO 150
#ENDINIT


// event 1?
#IF_EVENT_PLAYED 1
#ELSE
#IF_CAMPAIGN_DAY G 1
#SET_TEMPO 255
#CHANGE_RELATIONS 2 6 5
#PLAY_MOVIE 108
#DO_EVENT 1
#ENDIF
#ENDIF


// 
// US/Coalition controls KUWAIT
//
#IF_CONTROLLED 2 O 3083
#PLAY_MOVIE 116
#DO_EVENT 2
#END_GAME 2
#ENDIF
// End
#ENDSCRIPT
Prior to this I set team team 2 and 6 to "Hostile" status rather than "At War"
The trigger file looks like it should work properly and at midnight on Day 1 I do get an news report stating that "China declares war on South Korea". However the AI will not frag any missions for the Iraqi planes, and when I turned the Allied ATO on to AI it only fragged defensive missions in friendly territory for coalition planes, so it seems that it is NOT triggering war.

The only thing I can think of is that perhaps the engine requires there to be war from the start. Teams can join an ongoing war, but it won't start a war if no-one is fighting???
Has anyone gotten this trigger to work or another trigger that allows a delay to hostilites?

User avatar
Luk
Brig. General
Posts: 455
Joined: 2007-04-23 09:59:36

Re: TRI file tips 'n tricks

Post by Luk » 2010-08-17 17:31:56

Does it exist some relation between campaign *.tri file events(located in TRI) and events included in *.cam file?
There are 21 slots for the CAM in Tacedit. I guess it is always the same(empty) for all CAMs. (???)

Image

This is a TRI file, ccc posted in this post:
viewtopic.php?f=14&t=21382&start=40

Code: Select all

#TOTAL_EVENTS 5
//
// :::::::::::::::::::::::::::::::::::::::::;
//
// #SET_EVENT will set the activated flag for any
// events we want to be initially activate
// ie: Seoul already should be marked as
// captured in the Pusan parameter scenario
//
// This marks the ROK as initially on the defensive
#SET_EVENT 1
#PARENTRECALCDEPTH 4
// This sets the initial tempo
#SET_TEMPO 255
#ENDINIT
//
// :::::::::::::::::::::::::::::::::::::::::;
//
// Now come the individual triggers
//
// Event #1
// Combined forces go on offensive
//
#IF_EVENT_PLAYED 2
#IF_ON_OFFENSIVE 2
#PLAY_MOVIE 106
#DO_EVENT 1
#RESET_EVENT 2
#ENDIF
#ENDIF
//
// Event #2
// Combined forces go on defensive
//
#IF_EVENT_PLAYED 1
#IF_ON_OFFENSIVE 6
#PLAY_MOVIE 107
#DO_EVENT 2
#RESET_EVENT 1
#ENDIF
#ENDIF
//
// Event #3
//
// US/Coalition controls KUWAIT and AL BASRAH
//
#IF_CONTROLLED 2 A 3083 2793
#PLAY_MOVIE 116
#DO_EVENT 3
#END_GAME 3
#ENDIF
//
// Event #4
// Stalemate
//
#IF_BORDOM_HOURS 240
#PLAY_MOVIE 114
#DO_EVENT 4
#END_GAME 4
#ENDIF
//
// Event #5
// Timeout
//
#IF_CAMPAIGN_DAY G 15
#PLAY_MOVIE 115
#DO_EVENT 5
#END_GAME 5
#ENDIF
//
// End
#ENDSCRIPT
There are 5 events for example.
Does it mean, that ODS *.cam file has something defined in it's 5 slots?

I am also very interested, where are the PAKs settings stored. It is easy to find mission priorities etc in taceditor. But there are not any PAKs priorities. Well it looks, we can set it using events - but also campaigns with very simple(1event) TRI file has PAK priorities defined. So I guess it could be defined inside CAM as well.

I am really sorry, if it looks like offtopic here in "TRI file tips 'n tricks". There are really nice tricks, DoctorX posted above. I am just worried about some crucial linkeage overlook (after long TRI file tweaking for example).

Thanks
Luk

ccc
Chief of Staff
Posts: 4857
Joined: 2000-08-06 22:01:01

Re: TRI file tips 'n tricks

Post by ccc » 2010-08-18 01:16:50

i don't know if the event count is code-related or editable.

in your first pic, it shows total 22 events, fits the the event count in default korea TRI files.

I think, the event is used for TRI AND may related to movies.

i've not tried editing the content of [Flags]-<none> slot.

demer928
Banned user
Posts: 208
Joined: 2009-05-06 20:48:30
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by demer928 » 2010-08-18 01:23:40

There are no "Silver Bullet's, Magic,or Hidden Files" in Falcon. What you may effect over here in this "File" has a "BIG" effect over there on this "File"!!!! Be Careful!!!!


Regard's,
demer

@ccc,TacEdit "READ"S" the .tri file in. If you only have one event,then that is all it "read's".

User avatar
DoctorX
Recruit
Posts: 38
Joined: 2009-06-04 02:15:18
Gaming Interests: Falcon 4.0
Editing Interests: All, I (try) to edit everything.

Re: TRI file tips 'n tricks

Post by DoctorX » 2010-08-24 20:00:58

Luk wrote:Does it exist some relation between campaign *.tri file events(located in TRI) and events included in *.cam file?
There are 21 slots for the CAM in Tacedit. I guess it is always the same(empty) for all CAMs. (???)
The events settings in the .cam file should always match the events settings in the .tri file. For instance, if in your .tri file you have initial events, such as:

Code: Select all

// Starting event (ROK initially on the defensive):
#SET_EVENT 10
Then Event 10 should be set to "happened" in the .cam file as well.

As far as the slots, it seems 21 events is the max you can have, there are never any more or less in the .cam file. For the "Max events" setting in the .tri file, I always set that to the actual number of events I have created in the .tri file.

BTW- NEVER USE EVENT 0 FOR ANYTHING!!! It will cause problems.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests