Giving Medals
From Original War Support Wiki
Tutorials -> Giving Medals
Contents |
Introduction
Giving medals in the end of a mission is a little sophisticated. In short: What you have to do is to use function AddMedal three times to add information about all three medals to a temporary pool of data and then execute this data using function GiveMedals. It is therefor essential that function GiveMedals is executed after the AddMedal functions (if it was executed before, nothing would happen since the information pool would be empty). The mentioned information about the medals is not just if a medal should be given or not – it is also what text should be displayed when the player mouses over the medal (or the empty medal slot if the medal was not given). This text is defined in texts.txt.
Syntax "Medal info"
This is syntax for defining information about a medal in texts.txt:
* Identifier + Medal text 1 (medal is given) + Medal text 2 (medal is given) ... - Medal text 1 (medal is not given) - Medal text 2 (medal is not given) ... *
Template AddMedal
AddMedal('Medal_text_identifier',integer);
Medal_text_identifier - The identifier of the "medal text" defined in texts.txt (must be in inverted commas since it's an external reference).
integer - An integer. If the integer is positive, the medal is given; if it is negative the medal is not given. If it is "1" the text after the first "+" in texts.txt is displayed; if it is "2" the text after the second "+" in texts.txt is shown and so on. The same applies for "-".
Example 1
Texts.txt:
* Destroy + You destroyed all enemy buildings + You destroyed almost all enemy buildings - You destroyed no enemy buildings - You destroyed only few enemy buildings *
SAIL:
AddMedal('Destroy',-2);
Now this medal is not given and the following text will be displayed when you mouse over the medal slot: "You destroyed only few enemy buildings".
Template GiveMedals
GiveMedals('texts.txt_identifier');
texts.txt_identifier - an identifier in texts.txt defined before the "medal info" (must be in inverted commas since it's an external reference).
Syntax "GiveMedals identifier"
^ Identifier
Example 2
Texts.txt:
^ MAIN * Destroy + You destroyed all enemy buildings + You destroyed almost all enemy buildings - You destroyed no enemy buildings - You destroyed only few enemy buildings *
SAIL:
AddMedal('Destroy',-2); GiveMedals('MAIN');