Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Score & team-rescoping variables #1220

Merged
merged 2 commits into from
Aug 31, 2023
Merged

Add Score & team-rescoping variables #1220

merged 2 commits into from
Aug 31, 2023

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Aug 19, 2023

Depends on #1214 being merged first.

Implements score variable, which is a way to directly access (read/write) a competitor's score. The variable is scoped to team.
<score id="team_score" />

Also implements a team-rescoping variable, which allows using a specific teams' value from a team-scoped variable, as a match-scoped variable.
<with-team id="red_team_score" var="team_score" team="red"/>

A more fully-fledged example:

<variables>
  <score id="team_score" />
  <with-team id="red_team_score" var="team_score" team="red" />

  <variable id="other" scope="team" /> <!-- A dummy team variable -->
  <!-- A match-scoped variable for the value of other for red team -->
  <with-team id="other_red" var="other" team="red" />
  <!-- A match-scoped variable for the value of other for blue team -->
  <with-team id="other_blue" var="other" team="blue" />
</variables>

<actions>
  <trigger scope="player" filter="some-filter">
    <action>
      <set var="red_team_score" value="10"/>
      <set var="team_score" value="team_score+5" />
    <action>
  </trigger>
</actions>

Whenever some-filter matches for a player (eg: entering a region), it will trigger an action that sets red team's score to exactly 10, then adds 5 to the score of the team the player is in.
In other words, if a player in red team triggers some-filter, red is reset to 10 + 5 = 15, no other scores are affected.
if a player in blue team triggers some-filter, red is reset to 10, and blue wins 5 points.

@Pablete1234
Copy link
Member Author

Either merge after #1218, or simply close #1218 after merging this, as it superceeds it.

cswhite2000
cswhite2000 previously approved these changes Aug 22, 2023
Electroid
Electroid previously approved these changes Aug 23, 2023
@Electroid
Copy link
Member

Conflicts need to be resolved, but lgtm.

@Pablete1234 Pablete1234 dismissed stale reviews from Electroid and cswhite2000 via f77da9f August 23, 2023 18:25
@Pablete1234 Pablete1234 force-pushed the score-variable branch 2 times, most recently from f77da9f to 4722115 Compare August 23, 2023 18:26
@Pablete1234
Copy link
Member Author

@Electroid conflicts fixed, please re-review to merge. This is now urgent as dev branch has a broken syntax for variables that we don't want map authors relying upon

@Pablete1234 Pablete1234 added the urgent Breaks the plugin label Aug 23, 2023
@Electroid Electroid merged commit 73afe50 into dev Aug 31, 2023
3 checks passed
@Electroid Electroid deleted the score-variable branch August 31, 2023 06:03
@Pablete1234 Pablete1234 mentioned this pull request Sep 2, 2023
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready PR is ready to merge urgent Breaks the plugin
Development

Successfully merging this pull request may close these issues.

3 participants