Settings variables for looped actions

N582114

New Member
Reaction score
2
Is it possible to add each of these visibility modifiers to its own variable?

Trigger:
  • For each (Integer A) from 1 to 8, do (Actions)
    • Loop - Actions
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiona <gen>
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionb <gen>
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionc <gen>
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiond <gen>

I want to be able to destroy them in the future.
 
Trigger:
  • For each (Integer A) from 1 to 8, do (Actions)
    • Loop - Actions
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiona <gen>
      • Set Visibility[Integer A] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionb <gen>
      • Set Visibility[Integer A] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionc <gen>
      • Set Visibility[Integer A] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiond <gen>
      • Set Visibility[Integer A] = Last created visibility modifier


selectiona = 1
selectionb = 2
....
 
+rep, but you should note that using it like that will override different visibility triggers. They're all different.
 
you should better use something like this:
Trigger:
  • For each (Integer A) from 1 to 8, do (Actions)
    • Loop - Actions
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiona <gen>
      • Set Visibility[1 + (Integer A * 4)] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionb <gen>
      • Set Visibility[2 + (Integer A * 4)] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionc <gen>
      • Set Visibility[3 + (Integer A * 4)] = Last created visibility modifier
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiond <gen>
      • Set Visibility[4 + (Integer A * 4)] = Last created visibility modifier

this is a virtual 2 dimensional array.

in the first loop (IntegerA is equal to 1) it will use Visibility[5],[6],[7] and [8] when IntegerA is equal to 2 Visibility[9],[10],[11] and [12] are used, and so on and so on.
 
so what your saying Accname, is that for Player 1, it'll use Visibility [5][6][7][8] variables.. and then for Player 2, it'll use [9][10][11][12]... and so on.. right?
 
You could change the "Visibility[1+(IntegerA*4)]" into "Visibility[1+((IntegerA-1)*4)", so that your array starts at [1] instead of [5].

This leads to a smaller array.
 
I followed your advice and tried to destroy the visibility modifiers. It doesn't work however. I might of numbered the Integer A loop on the destruction trigger wrong.

Trigger:
  • For each (Integer A) from 1 to 8, do (Actions)
    • Loop - Actions
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiona <gen>
      • Set herovisiblity[(1 + (((Integer A) - 1) x 4))] = (Last created visibility modifier)
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionb <gen>
      • Set herovisiblity[(1 + (((Integer A) - 1) x 4))] = (Last created visibility modifier)
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectionc <gen>
      • Set herovisiblity[(1 + (((Integer A) - 1) x 4))] = (Last created visibility modifier)
      • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Selectiond <gen>
      • Set herovisiblity[(1 + (((Integer A) - 1) x 4))] = (Last created visibility modifier)


Destroying the modifiers:

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Player number of (Owner of (Buying unit))) Equal to 1
    • Then - Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Visibility - Destroy herovisiblity[(Integer A)]
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player number of (Owner of (Buying unit))) Equal to 2
        • Then - Actions
          • For each (Integer A) from 5 to 9, do (Actions)
            • Loop - Actions
              • Visibility - Destroy herovisiblity[(Integer A)]
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player number of (Owner of (Buying unit))) Equal to 3
            • Then - Actions
              • For each (Integer A) from 10 to 14, do (Actions)
                • Loop - Actions
                  • Visibility - Destroy herovisiblity[(Integer A)]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player number of (Owner of (Buying unit))) Equal to 4
                • Then - Actions
                  • For each (Integer A) from 15 to 19, do (Actions)
                    • Loop - Actions
                      • Visibility - Destroy herovisiblity[(Integer A)]
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player number of (Owner of (Buying unit))) Equal to 5
                    • Then - Actions
                      • For each (Integer A) from 20 to 24, do (Actions)
                        • Loop - Actions
                          • Visibility - Destroy herovisiblity[(Integer A)]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Player number of (Owner of (Buying unit))) Equal to 6
                        • Then - Actions
                          • For each (Integer A) from 25 to 29, do (Actions)
                            • Loop - Actions
                              • Visibility - Destroy herovisiblity[(Integer A)]
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Player number of (Owner of (Buying unit))) Equal to 7
                            • Then - Actions
                              • For each (Integer A) from 30 to 34, do (Actions)
                                • Loop - Actions
                                  • Visibility - Destroy herovisiblity[(Integer A)]
                            • Else - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • (Player number of (Owner of (Buying unit))) Equal to 8
                                • Then - Actions
                                  • For each (Integer A) from 35 to 39, do (Actions)
                                    • Loop - Actions
                                      • Visibility - Destroy herovisiblity[(Integer A)]
                                • Else - Actions
 
Instead of having some crazy long trigger with lots of if/then/else functions, you could try something like this:

Trigger:
  • Actions
    • For each (Integer A) from (Player number of (Owner of (Triggering unit))) to ((Player number of (Owner of (Triggering unit))) + 3), do (Actions)
      • Loop - Actions
        • Visibility - Destroy herovisibility[(Integer A)]
 
and also

replace Integer A
with
4 + (Integer A * 4)] in the actions
 
Like this?

Trigger:
  • For each (Integer A) from (Player number of (Owner of (Buying unit))) to ((Player number of (Owner of (Buying unit))) + 3), do (Actions)
    • Loop - Actions
      • Visibility - Destroy herovisiblity[(4 + ((Integer A) x 4))]
 
This doesn't work. It appears to be how the variables are set.

The visibility modifiers don't get destroyed/disabled even by setting a specific one to a specific variable, however.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    It is weird seeing a way more realistic users online number
  • The Helper The Helper:
    Happy Tuesday Night!
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top