What is it used for?

Zanderist

New Member
Reaction score
5
I've never had or seen a clear answer about for each integer A do actions, I don't know how to use it at all.

Does it work with variables that are arrayed?

Secondly, I've never had a custom script used for memory leaks work.
 

Shura

New Member
Reaction score
45
The For each Integer A action will run a loop, with the value of Integer A starting at the first number you entered and increasing by one until it reaches the last number you entered. Example:
Trigger:
  • Actions
    • For each (Integer A) from 1 to 10, do (Actions)
      • Loop - Actions
        • Unit - Kill Unit[(Integer A)]

Would kill all units in the Unit Array from 1 to 10.

For the custom scripts, you have to make sure they are typed exactly right, with capitals included. If it still doesn't work, post it here and we can fix it.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
Another example of the loop Integer A

Trigger:
  • Difficulty
    • Events
      • Time - Elapsed game time is 0.25 seconds
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to (==) Is playing
            • Then - Actions
              • Set NumberOfPlayers = (NumberOfPlayers + 1)
            • Else - Actions
      • Wait 0.65 seconds
      • Player - Set Player 12 (Brown) handicap to (35.00 x (Real(NumberOfPlayers)))%
      • Player - Set Neutral Hostile handicap to (35.00 x (Real(NumberOfPlayers)))%

It's set to make the enemies in this RPG I am making (And likely will never finish...) weaker/stronger depending on the number of players currently playing. the Integer A loops through each of the player slots, checking to see if that player is playing or not.
 

Zanderist

New Member
Reaction score
5
Here's a new question.

Is there a condition that says that "Unit is within range of other unit?

For example: (using a different game) Sim city requires that it's zones have road connections. I'm looking for a condition that would only allow buildings to upgrade if they were near a road structure.
 

Shura

New Member
Reaction score
45
Real comparison. Math - Distance between points. Use the points of the two units and the range that you want.
 

Shura

New Member
Reaction score
45
You can't get the position of a unit-type...
If you're trying to detect when a unit of a certain type comes within range of a specific unit, you could make a periodic trigger, and then pick every unit within a certain range of your specific unit, and check if any of them are of your unit type.
 

Zanderist

New Member
Reaction score
5
or simply use the event "Unit Comes Within Range of Unit"

See I wouldn't have a problem with that, but I'm trying to use reverse engineering on the genesis of empires map.

I don't understand how the author was able to use roads in order to have the zones upgrade.

I think it might have something to do with that.

But I just got hit with an awesome idea.


Can you use a unit variable as an array?

And that every time you build a road unit it you have it set to the unit variable and +1 to the index?
 

Zanderist

New Member
Reaction score
5
I'm basically asking how do I have it so a unit can only be replaced to a higher level one when it is near a certain unit.
 
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