Why doesn't this do anything?

cstorm

New Member
Reaction score
1
My map has a multiboard that has an integer as one of the strings, but when i change the integer it doesnt change on the multiboard ingame.
This is the multiboard
Code:
CreateScoreBox MultiboarVers
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Multiboard - Create a multiboard with 2 columns and 2 rows, titled Squares Controlled
        Set MultiBoard = (Last created multiboard)
        Multiboard - Set the text for MultiBoard item in column 1, row 1 to Team 1
        Multiboard - Set the text for MultiBoard item in column 2, row 1 to Team 2
        Multiboard - Set the width for MultiBoard item in column 1, row 1 to 8.00% of the total screen width
        Multiboard - Set the width for MultiBoard item in column 2, row 1 to 8.00% of the total screen width
        Multiboard - Set the width for MultiBoard item in column 1, row 2 to 8.00% of the total screen width
        Multiboard - Set the width for MultiBoard item in column 2, row 2 to 8.00% of the total screen width
        Multiboard - Set the text for MultiBoard item in column 1, row 2 to (String(TeamOneScore))
        Multiboard - Set the text for MultiBoard item in column 2, row 2 to (String(TeamTwoScore))

This is the trigger that changes the integer.

Code:
Add Points Team1
    Events
        Unit - A unit Changes owner
    Conditions
        (Unit-type of (Ownership-changed unit)) Equal to Square Center (large)
    Actions
        Player Group - Pick every player in Team1 and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Previous owner) Not equal to (Picked player)
                    Then - Actions
                        Wait 0.50 seconds
                        Set TeamOneScore = (TeamOneScore + 1)
                    Else - Actions
                        Do nothing
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
Because the multiboard doesnt save the integer but only a text.

your second trigger needs to look like this:
Trigger:
  • Add Points Team1
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Ownership-changed unit)) Equal to Square Center (large)
    • Actions
      • Player Group - Pick every player in Team1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Previous owner) Not equal to (Picked player)
            • Then - Actions
              • Wait 0.50 seconds
              • Set TeamOneScore = (TeamOneScore + 1)
              • Multiboard - Set the text for MultiBoard item in column 1, row 2 to (String(TeamOneScore))
            • Else - Actions
              • Do nothing
 

cstorm

New Member
Reaction score
1
Because the multiboard doesnt save the integer but only a text.

your second trigger needs to look like this:
Trigger:
  • Add Points Team1
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Ownership-changed unit)) Equal to Square Center (large)
    • Actions
      • Player Group - Pick every player in Team1 and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Previous owner) Not equal to (Picked player)
            • Then - Actions
              • Wait 0.50 seconds
              • Set TeamOneScore = (TeamOneScore + 1)
              • Multiboard - Set the text for MultiBoard item in column 1, row 2 to (String(TeamOneScore))
            • Else - Actions
              • Do nothing

I tryed this but the multiboard stays the same, the variable integer starts out with an initial value of three, should it start with 0 or does this matter?
Note: I'd also like to note that Team1 is a player group variable with players 1-3 have already been set into it.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
no, doesnt matter at all.

this should work. Are you sure the variable is increased by this trigger? Try adding a Debug-Message.

By the way, are you having another trigger which might run parallel which might subtract the variable?

And remove the "Do Nothing" cause it really does what it says besides wasting performance.
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
i optimized it a little bit, works like a charm.

Trigger:
  • Add Points Team1
    • Events
      • Unit - A unit Changes owner
    • Conditions
      • (Unit-type of (Ownership-changed unit)) Equal to Square Center (groß)
      • ((Owner of (Triggering unit)) is in Team1) Equal to True
      • ((Previous owner) is in Team1) Equal to False
    • Actions
      • Set TeamOneScore = (TeamOneScore + 1)
      • Multiboard - Set the text for MultiBoard item in column 1, row 2 to (String(TeamOneScore))


by the way, you could spare yourself alot of time with the trigger
Trigger:
  • Square1
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Square Holder
      • And - All (Conditions) are true
        • Conditions
          • (Square1 <gen> contains (Matching unit)) Equal to False
          • (Square1 <gen> contains (Constructed structure)) Equal to True
    • Actions
      • Unit - Change ownership of Square Center (groß) 0090 <gen> to (Owner of (Constructed structure)) and Change color

if you just save the circles of power and the rects into an array.
it should then look like this:
Trigger:
  • Square_Generic
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Square Holder
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 25, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SquareRectWithID[(Integer A)] contains TempPoint) Equal to True
            • Then - Actions
              • Unit - Change ownership of SquareWithID[(Integer A)] to (Owner of (Constructed structure)) and Change color
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
 

cstorm

New Member
Reaction score
1
if you just save the circles of power and the rects into an array.
it should then look like this:
Trigger:
  • Square_Generic
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Square Holder
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • For each (Integer A) from 1 to 25, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (SquareRectWithID[(Integer A)] contains TempPoint) Equal to True
            • Then - Actions
              • Unit - Change ownership of SquareWithID[(Integer A)] to (Owner of (Constructed structure)) and Change color
            • Else - Actions
      • Custom script: call RemoveLocation (udg_TempPoint)
Using this trigger would save me from making a trigger for each square?
 

Accname

2D-Graphics enthusiast
Reaction score
1,464
in case you set the variables SquareRectWithID[...] and SquareUnitWithID[...] properly, yes.

these are arrays in which you just save the rects and their proper circles of power.
for example:
SquareRectWithID[1] = <rect in the top left corner>
SquareUnitWithID[1] = <that circle in the top left corner>
SquareRectWithID[2] = <the next rect>
SquareUnitWithID[2] = <that circle in the next rect>
SquareRectWithID[3] = ...
SquareUnitWithID[3] = ...
SquareRectWithID[...] = ...
SquareUnitWithID[...] = ...

and since you have 25 rects / squares you need to set all 25 into the variable. but thence you are done.
 

cstorm

New Member
Reaction score
1
Still being difficult here's the newest copy of the map, with that triggering it still doesnt change owner...
 

Attachments

  • Square Control V.05.w3x
    40.8 KB · Views: 121
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top