Associating regions

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
You can do this in various ways, but I think the easiest is an array. Create a global region array variable. Set each value in your map initialization trigger.

Trigger:
  • Actions
    • Set MyRegion[1] = <region1>
    • Set MyRegion[2] = <region2>
    • etc.


Congratulations, you can now use player numbers to get the corresponding region.
 

pride2518

New Member
Reaction score
4
Sorry, not used to arrays.

So I just have to set
Trigger:
  • Set RegionAR [1] = Red<gen>

?
 

AoW_Hun7312

I'm a magic man, I've got magic hands.
Reaction score
76
Yes, that should be fine. Just continue doing that for all of the regions you have.
 

hopy

Active Member
Reaction score
64
what type of variable?

It's a Region variable with an Array, size is equal to the amount of regions you want.

It can be used in triggers like:
Trigger:
  • Oblivion
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Oblivion [Fire Lord]
    • Actions
      • Set MyRegion[1] = Red Region
      • Set MyRegion[2] = Blue Region
      • For each (Integer A) from 1 to 2, do (Actions)
        • Loop - Actions
          • Set Point = (Center of (MyRegion[Intreger A]
          • Unit - Create 1 Dummy Unit for (Owner of (Triggering unit)) at Point facing Default building facing degrees
          • Custom script: call RemoveLocation (udg_Point)
 

Ashlebede

New Member
Reaction score
43
Don't forget setting the array size to 12... and don't use 1 as first index, but 0 (you have to then use arithmetics to do (Player Number of Player) - 1. You don't want to waste 8180 times the size of a handle-type variable on your RAM, though I ain't sure whether all the 8192 are initialized by default... so 12 should be the array size.
 

Romek

Super Moderator
Reaction score
964
> Don't forget setting the array size to 12...
It doesn't make a difference. The 'array size' simply determines the number of arrays which are initialized to the 'default' value you enter. 0 (if it's allowed) or 1 are ideal, as the map doesn't need to go through a fairly large loop to initialize arrays when it's loading, and all the indices can be used anyway.

> and don't use 1 as first index, but 0 (you have to then use arithmetics to do (Player Number of Player) - 1
There's no need to do that either. :p
That one little slot in the array won't make any difference, but will ease coding.

> You don't want to waste 8180 times the size of a handle-type variable on your RAM
All array's have a size of 8191, regardless of what the GUI says.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top