by Archaeopterix of Ambition Designs
A thorough look at the scripting process new to Rise of Legends - an aspect vital to any scenario, which makes this article itself almost vital in learning how to understand the coding and build upon the understanding. The article takes the reader through a BHG script, explaining everything most carefully and elaborating on the various areas so you don't just replicate the BHG code - you write your own.
The guide will take you from the very basics of scripting, through functions, prepositional logics, the hierarchy and every essential bit, illustrating everything with cool, clear examples and excerpts from an existing bhg map's script. Preview:
Quote:
When will the following x be true and when will it be false?
... Is x set to true when A is true but B and C aren't? Is x set to true if A is false, B is false but C is true? See if you can figure it out!
boolean x = !(A && B) |
...
Quote:
After this logical interuption, let's go back to the script.
... line 76-81
diplo_disable("1");
diplo_disable("2");
//intro cutscene
queue_cutscene("intro");
}
...
Apparently the diplomacy is disabled or locked for players 1 and 2, meaning that they cannot change teams anymore. Then, a cutscene named "intro" is started. This cutscene is created and named in the editor, so "intro" just refers to that one. And then, what do we see: a closing curly bracket }! It is the end of run_once, but not yet the end of the void on_solo_game_frame(), of course.
Quote:
... line 345 First, the variable scan is set to 0. Then, as long as the value in scan is lower than the size of the unit group "trucks", whatever is between the curly brackets is performed again and again. Eventually, the value of the scan variable is increased. "scan++" is actually a shortcut for "scan = scan +1", because it is used so often. In summary, this thing loops through all units in the unit group, one by one. Understood?
for (scan = 0; scan
...
Please send all your questions and suggestions to
And may you become a scripting legend!
VimpMeat (4.5) | Heroines (4.9) | Treasure Hunt (4.4) | Heroines II: The Survival (4.7) | Heroines III: Winter Solstice