• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Score System

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
I wanted to make a game where there the host picks how many rounds there are. Players can
earn points for winning each round. Say there are 10 rounds, the game will end after the 10th
round. I can do all that, but I was wondering how to calculate which player has the most points?
I need to know how in order to detect which player actually wins at the end of the 10 rounds.

Here are the (simplified versions) of my triggers which calculate player's "score" and run the "Game
Over" trigger when the round limit is reached.

  • Add Score
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Race of (Triggering unit)) Equal to Undead
    • Actions
      • Set Score[(Player number of (Owner of (Triggering unit)))] = (Score[(Player number of (Owner of (Triggering unit)))] + 1)
  • Round End
    • Events
      • Time - RoundOver expires
    • Conditions
    • Actions
      • Set CurrentRound = (CurrentRound + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CurrentRound Equal to NumberOfRounds
        • Then - Actions
          • Trigger - Run Game Over <gen> (checking conditions)
        • Else - Actions
I just need help creating the Game Over trigger. Each player will have his/her own points
saved into an integer array called "score". How to detect which player has the most points
in order to "victory" that person and "defeat" the others?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
maybe loop over all 12 player each time when a player got point and use 1 variable?

var = 0
like for a = 1 to 12
if score[a] > var then
set var = score[a]
if var == 10 then
victory to player[a]
defeat to others
endif
endif
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
i used random score but u have your own system what add score or no but this is only a example to scores

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set MaxScore = 10
      • Set Score[1] = 2
      • Set Score[2] = 1
      • Set Score[3] = 6
      • Set Score[4] = 3
      • Set Score[5] = 5
      • Set Score[6] = 7
      • Set Score[7] = 4
      • Set Score[8] = 2
      • Set Score[9] = 10
      • Set Score[10] = 2
      • Set Score[11] = 0
      • Set Score[12] = 9
this add to ur scoreing trigger where u add the score

  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set I = 0
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Score[A] Greater than I
            • Then - Actions
              • Set I = Score[I]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • I Equal to MaxScore
                • Then - Actions
                  • Game - Victory (Player(A)) (Show dialogs, Show scores)
                  • Set I = 1
                  • For each (Integer B) from 1 to 12, do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Integer B) Not equal to A
                        • Then - Actions
                          • Game - Defeat (Player((Integer B))) with the message: Defeat!
                        • Else - Actions
                • Else - Actions
              • Trigger - Turn off (This trigger)
            • Else - Actions
 

Attachments

  • _1scoreblabla.w3x
    16.8 KB · Views: 36
Status
Not open for further replies.
Top