Part 1
Create a (JASS) trigger that runs when a player presses the 'Esc' button (Skip Cinematic).
The trigger's goal is to count how often a player has hit the 'Esc' button, and to print the correct value on screen.
The trigger must be MPI (tip: always search for things you don't know Elemental Coder Guide).
Part 2
If you don't already have done so, do now the "Part 2" without using any "if statement".
Tip: Each player has a unique player number.
Create a (JASS) trigger that runs when a player presses the 'Esc' button (Skip Cinematic).
The trigger's goal is to count how often a player has hit the 'Esc' button, and to print the correct value on screen.
The trigger must be MPI (tip: always search for things you don't know Elemental Coder Guide).
Part 2
If you don't already have done so, do now the "Part 2" without using any "if statement".
Tip: Each player has a unique player number.
vJASS:
//! zinc
library VariableArray {
private {
integer Counter[];
function onInit() {
trigger trgEsc = CreateTrigger();
integer Index = 0;
while( Index < bj_MAX_PLAYERS ) {
TriggerRegisterPlayerEvent( trgEsc, Player( Index ), EVENT_PLAYER_END_CINEMATIC );
Index = Index + 1;
}
TriggerAddAction( trgEsc, function() {
player pl = GetTriggerPlayer();
integer id = GetPlayerId( pl );
Counter[id] = Counter[id] + 1;
DisplayTextToPlayer( pl, 0, 0, GetPlayerName( pl ) + ": " + I2S( Counter[id] ) );
pl = null;
});
trgEsc = null;
}
}
}
//! endzinc