ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

VariableNames: Difference between revisions

From ModEnc
Jump to navigation Jump to search
Updating with new sidebar
Crimsonum (talk | contribs)
Better looking tables
 
(2 intermediate revisions by the same user not shown)
Line 21: Line 21:
  Index=VARIABLE_NAME
  Index=VARIABLE_NAME


{| style="width: 80%" border=1 class="table_descrowdesccol"
{| style="width: 80%" class="table_descrowdesccol wikitable"
|+ Meanings of each string
|+ Meanings of each string
! style="width: 13em; " | String
! style="width: 13em; " | String
Line 41: Line 41:
  Index=VARIABLE_NAME,INITIAL_VALUE
  Index=VARIABLE_NAME,INITIAL_VALUE


{| style="width: 80%" border=1 class="table_descrowdesccol"
{| style="width: 80%" class="table_descrowdesccol wikitable"
|+ Meanings of each string
|+ Meanings of each string
! style="width: 13em; " | String
! style="width: 13em; " | String
Line 47: Line 47:
|-
|-
! {{Anchor|Index|ts_l}}
! {{Anchor|Index|ts_l}}
| This is a variable's index. Unlike indexes in lists like [InfantryTypes], it actually matters - the game allocates space for 100 local variables, and uses the Index to decide which of them this line is about.
| This is a variable's index. Unlike indexes in lists like [InfantryTypes], it actually matters - the game allocates space for 50 (100 in YR) local variables, and uses the Index to decide which of them this line is about.
|-
|-
! {{Anchor|VARIABLE_NAME|ts_l}}
! {{Anchor|VARIABLE_NAME|ts_l}}
Line 53: Line 53:
|-
|-
! {{Anchor|INITIAL_VALUE|ts_l}}
! {{Anchor|INITIAL_VALUE|ts_l}}
| The Variable's value at map start. Can be set to either {{Tt|0}}('false') or any other numeric value ('true').
| The Variable's value at map start. Can be set to either {{Tt|0}} ('false') or any other numeric value ('true').
|}
|}
=== Hardcoded Globals ===
A few of the global variable IDs (indexes) have hardcoded properties:
* If variable 0 is set, then the next [[scenario]] will use an alternate starting position as defined by its {{sl|Basic|AltHomeCell}}.
* If variable 1 is set, then the campaign will proceed to an alternate scenario as defined by {{sl|Basic|AltNextScenario}} in the ''current'' scenario.


== Best of Both Worlds (Blade's post) ==
== Best of Both Worlds (Blade's post) ==

Latest revision as of 19:35, 16 May 2024

This page should correctly be named "[VariableNames]"; it is wrong due to technical restrictions.



This section exists in both Rules(md).ini and maps and is used for similar purposes in both cases: it contains a list of boolean variables in this map that map triggers can change and be activated by (e.g., if you performed a bonus objective, you can expect less resistance from one enemy party, or, when playing the singleplayer campaigns, even get an extra mission after completing the current one). The difference between the two sections is explained below.

Tiberian Dawn, Red Alert/Counterstrike/Aftermath

Section does not exist.

Tiberian Sun/Firestorm/Red Alert 2/Yuri's Revenge

In rules(md).ini

This section comprises a list of all Global Variables available in the game. Global Variables are boolean variables, their state is preserved between missions, but not saved in savegames.

The [VariableNames] section takes the following format:

[VariableNames]
Index=VARIABLE_NAME
Meanings of each string
String Meaning
Index This is a variable's index. Unlike indexes in lists like [InfantryTypes], it actually matters - the game allocates space for 50 global variables, and uses the Index to decide which of them this line is about.
VARIABLE_NAME The Variable's name. It is limited to 40 characters in length when reading but not used ingame.

In Maps

This section comprises a list of all Local Variables available in this map. Local Variables are boolean variables, their state is saved in savegames, but not carried over between missions.

The [VariableNames] section takes the following format:

[VariableNames]
Index=VARIABLE_NAME,INITIAL_VALUE
Meanings of each string
String Meaning
Index This is a variable's index. Unlike indexes in lists like [InfantryTypes], it actually matters - the game allocates space for 50 (100 in YR) local variables, and uses the Index to decide which of them this line is about.
VARIABLE_NAME The Variable's name. It should not exceed 40 characters in length and shouldn't contain commas even though it is not used ingame.
INITIAL_VALUE The Variable's value at map start. Can be set to either 0 ('false') or any other numeric value ('true').

Hardcoded Globals

A few of the global variable IDs (indexes) have hardcoded properties:

  • If variable 0 is set, then the next scenario will use an alternate starting position as defined by its [Basic]AltHomeCell=.
  • If variable 1 is set, then the campaign will proceed to an alternate scenario as defined by [Basic]AltNextScenario= in the current scenario.

Best of Both Worlds (Blade's post)

It is (theoretically) possible to carry an event (say capture a battle lab) through to having an effect on some later level (say allowing you to build a certain unit you normally cannot), but it is frustrated by the auto save feature that saves at the start of a level.

During a level, have some event you want to carry forward set a 'Local'. These are known to be carried by saves games as a nessesity. When the win condition is met, actually have two win triggers that have the 'Local' set or clear as one of the conditions. The clear one just triggers the win, while the set one sets a 'global' as well triggering the win. This will carry over to the next level and the player cannot save in the mean time to wipe it out (only the auto save can...maybe). In the next level, have a trigger that sets a new 'Local' to carry the 'global' during the level if the 'global' is set at the start of the mission. Just repeat this over as many levels as needed in order to carry the value to the level where it will have its effect. I've never really tested this and it remains just a theory of mine and I don't really know if autosave would save before or after the 'global variable' has had chance to convert to a 'local variable' so it remains a potential spanner in the works.