• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How can i go about this?

Status
Not open for further replies.
Level 8
Joined
Jul 29, 2010
Messages
319
Can't quite work out how to make this work, basically i want this trigger to add +1 to an integer variable if this trigger hasn't already added +1 to that exact Integer variable, how can I go about this?
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • PriorityPoints[(Player number of (Owner of Alpha[Y]))] Equal to (PriorityPoints[(Player number of (Owner of Alpha[Y]))] + 1)
    • Then - Actions
    • Else - Actions
      • Set PriorityPoints[(Player number of (Owner of Alpha[Y]))] = (PriorityPoints[(Player number of (Owner of Alpha[Y]))] + 1)
 
Level 11
Joined
Jun 2, 2004
Messages
849
Not quite sure what you're trying to accomplish here... but to do what you asked would require some sort of flag to be associated with the trigger. So, add a check against a boolean variable, only adding 1 if it's false, and set the boolean to true after it's done this once.
 
Level 7
Joined
Dec 17, 2017
Messages
134
I do not understand. What you are asking is fairly easy to me.
  • Untitled Tigger 01
    • Events
      • (Your Event)
    • Conditions
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X (Your Variable) Equal to ((Initial Value of X you gave) +1)
    • Then - Actions
      • Do nothing
    • Else - Actions
      • Set X (Your Variable) = (X + 1)
 
Level 8
Joined
Jul 29, 2010
Messages
319
I do not understand. What you are asking is fairly easy to me.
  • Untitled Tigger 01
    • Events
      • (Your Event)
    • Conditions
    • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • X (Your Variable) Equal to ((Initial Value of X you gave) +1)
    • Then - Actions
      • Do nothing
    • Else - Actions
      • Set X (Your Variable) = (X + 1)
When i do this, it adds 1 everytime the trigger is run, that is why i am posting here.
 
Level 7
Joined
Dec 17, 2017
Messages
134
Then Turn off Trigger man!
  • Untitled Trigger
    • Events
      • (Your Events)
    • Conditions
    • Actions
    • If (If conditions are true) Then (do Then actions) else (do else actions
    • If - Conditions
    • X Equal to (Initial Value+1)
    • Then-Actions
      • Do nothing
      • Else - Actions
      • Trigger - Turn off (This trigger)
      • Set X = (X + 1)
 
Level 8
Joined
Jul 29, 2010
Messages
319
Then Turn off Trigger man!
This trigger is apart of a series of triggers designed to increase the "priority" of a particular integer variable, then later on when enemy units are spawned they will attack particular player units based on their priority ratings. Ratings are given by things such as max HP, armour, base attack damage and movement speed.
  • Health Matrix
    • Events
    • Conditions
    • Actions
      • Set Y[1] = 1
      • Set Z[1] = 1
      • For each (Integer A) from 1 to ActivePlayerUnits, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Max HP of Alpha[Y[1]]) Greater than (Max HP of Alpha[Z[1]])
            • Then - Actions
              • Set Y[1] = (Y[1] + 1)
              • Set Z[1] = 1
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • RecievedPriorityPoint[1] Equal to False
                • Then - Actions
                  • Set PriorityPoints[(Player number of (Owner of Alpha[Y[1]]))] = (PriorityPoints[(Player number of (Owner of Alpha[Y[1]]))] + 1)
                • Else - Actions
            • Else - Actions
              • Set Z[1] = (Z[1] + 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Z[1] Greater than or equal to ActivePlayerUnits
                • Then - Actions
                  • Set Z[1] = 1
                  • Set Y[1] = (Y[1] + 1)
                • Else - Actions
My system is relatively operational, now i just need to figure out the second part of my trigger.
I'm trying to design a trigger that will figure out which Integer variable has the highest value.
  • Priority
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ActivePlayerUnits, do (Actions)
        • Loop - Actions
          • Player Group - Pick every player in (All allies of (Owner of Alpha[Y[(Integer A)]])) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • PriorityPoints[(Player number of (Owner of Alpha[Y[(Integer A)]]))] Greater than PriorityPoints[(Player number of (Picked player))]
                • Then - Actions
                  • Special Effect - Create a special effect attached to the overhead of Alpha[Y[1]] using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
                • Else - Actions
 
Level 8
Joined
Jul 29, 2010
Messages
319
Okay, now it makes sense. You should have explained it earlier. Hmm, have to think about it....
Sorry for not explaining it completely, but yes you see my issue now, it's very hard to make a system that finds the highest value from a list of integers when all those integers also have index's and the index's used for those variables also have index's, i think i might have made this a little too complicated
 
Level 8
Joined
Jul 29, 2010
Messages
319
Nothing is impossible with the WE, my friend. Just do not lose hope, I'll be trying to solve your problem
I've run into another snag, though i've almost figured it out
  • Player Units Index
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • -------- (Integer A) controls how many index's will be created --------
      • For each (Integer A) from 1 to ActivePlayers, do (Actions)
        • Loop - Actions
          • Set Playercount = (Playercount + 1)
          • Unit Group - Pick every unit in (Units owned by (Player(Playercount))) and do (Actions)
            • Loop - Actions
              • For each (Integer B) from 1 to ActivePlayerUnits, do (Actions)
                • Loop - Actions
                  • Set U = (U + 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in INDEXED_UNITS) Equal to False
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to INDEXED_UNITS
                      • Set Alpha[Y[U]] = (Picked unit)
                      • Set Alpha[Z[U]] = (Picked unit)
                      • Floating Text - Create floating text that reads (String(Playercount)) above Alpha[Y[U]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Else - Actions
      • Game - Display to (All players) the text: (String(Playercount))
My issue i think lies with the Action
  • Unit Group - Pick every unit in (Units owned by (Player(Playercount))) and do (Actions)
i'm trying to figure out how to assign variables individually to units that are part of the same group, with this trigger as it is now, it simply gives all units in the group the value of 1 when i want each unit in the group to be given the value of 1, 2, 3 etc... I cannot figure out how to do it.

EDIT: I managed to figure it out with this trigger
  • Player Units Index
    • Events
      • Time - Elapsed game time is 0.05 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to ActivePlayers, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in (Units owned by (Player(U))) and do (Actions)
            • Loop - Actions
              • For each (Integer A) from 1 to ActivePlayerUnits, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) Equal to Alpha[Y[U]]
                    • Then - Actions
                    • Else - Actions
                      • Set U = (U + 1)
                      • Set Alpha[Y[U]] = (Picked unit)
                      • Set Alpha[Z[U]] = (Picked unit)
                      • Floating Text - Create floating text that reads (String(U)) above Alpha[Y[U]] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • -------- (Integer A) controls how many index's will be created --------
      • Game - Display to (All players) the text: (String(Playercount))
 
Last edited:
Status
Not open for further replies.
Top