HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

helpme - ARRAYS and "player-owned" regions&triggers

09-03-2002, 03:55 AM#1
Guest
these should be simple to solve...

on my map I have 20 unique heroes that you can choose from to use.
Each of them "morph" twice into better heroes with cooler models etc.

Problem 1:
to make the heroes morph, it takes one trigger for each morph for each hero for each player
2x20x9 = a lot of repetitive triggers

all the user players have the same heroes and same everything, so I want to create triggers that work for everyone instead of having to define it for each player and copy

Event(s):
Unit - Player Owned unit by Player 1 (Red) gains a level

---So how could I make it work for all players and not just one specific player? If I change "player 1" to "owner of (triggering unit)" it doesn't work.

Problem 2:
to place the heroes in the map after they are selected, they will go into an x number of pre-determined regions at random if another player has not already picked there

I came up with two different methods to accomplish this:

Method 1 - keep an array specifying valid regions, have each player select one at random one by one and then remove that region from the array or make it so that it is no longer considered once it is picked

Method 2 - each player "owns" a region and the region locations are randomized to the pre-determined entrance places on the map.

So how could I do either of those with this editor? In c++ it would be simple but this is not c++.

Is there anyone that is smart enought that could help me out? Thanks,

Avatar020
09-03-2002, 10:37 AM#2
Guest
1)

Just have an event for each player in the same trigger, and then use owner of triggering unit in your actions:

Events:
Unit - Player Owned unit by Player 1 (Red) gains a level
Unit - Player Owned unit by Player 2 (Blue) gains a level
Unit - Player Owned unit by Player 3 (Teal) gains a level
Etc...

Actions:
Whatever you're doing.

2)
I'm sure there's variable ways to do this. What I would probably do is create a Region Array of all your regions and a Boolean Array for if it's valid or not.

Actions:
Set RandomPosition = Random integer between 1 and NumStartPositions
If RegionTaken[RandomPosition] equal to False then [Probably run a trigger placing thing unit(s) or just use a single action if it's just the Hero] else do Trigger - Run (This Trigger)