Implement #776: Level script - fixed alliances #1969
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #776
Used the last 3 unused bits in
player->allied_players
to represent which allies (blue, green, yellow) are locked. This means that this functionality is currently limited to single player.Changes to
ALLY_PLAYERS
:ALLY_PLAYERS(PLAYER1,PLAYER2,0)
ALLY_PLAYERS(PLAYER1,PLAYER2,1)
ALLY_PLAYERS(PLAYER1,PLAYER2,2)
ALLY_PLAYERS(PLAYER1,PLAYER2,3)
New command:
IF_ALLIED({PLAYER},{PLAYER}{OP}{VALUE})
:Allows you to check the ally status of any two players. This will allow all sorts of use cases, such as forming a reply alliance in single player, or special events in multiplayer if two particular players are allied.
Example script:
Add this to the end of Korros Tor (
levels\deepdngn\map00081.txt
) or any other 2 player map.Allying with green causes the player to automatically win the level. I am not exactly sure why, since I would have thought the unally with blue would execute first, before the ally with green command. I guess there is something about the way scripts are executed which I don't quite understand.