HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Structure in Region ?

01-07-2003, 07:18 PM#1
Loofy
My map needs a trigger which gives 1000 gold to a player if he owns any type of struture in REGION X after 3:00 minutes.

I can't seem to get the right condition working. I cannot tie the REGION and Any Type of Structure together. I can only get one or the other. Help? emote_confused
01-07-2003, 07:38 PM#2
DKSlayer
Just make a Region around the structure, and then when they walk into the region and hold it for 3min you can assume they have that structure.
Is that what you are looking for if not please explain further, so I may be of assistance.
Thanks
DKSlayer
01-07-2003, 08:02 PM#3
Seres
Try this...

Make an Event, Unit Enters Region

Make a condition, Unit Equal to Building (a Boolean condition)

Make an Action, Turn on Trigger (GiveMoney)

Make another trigger, call it GiveMoney (or whatever) and make the Event, Periodic - Every 180 seconds, and the Action, Give Player 1000 gold.

Sorry I cannot give the specific trigger names, I don't know them off of the top of my head. Also, remember to set the GiveMoney trigger to InitiallyOff
01-07-2003, 08:13 PM#4
Loofy
Peres that is what I have right now, the only problem is that I need the structure to be fully completed, not partially built.

Basically this is what happens (or supposed to happen in my map)

Think of a region called Azeroth. In that region is a beacon. When you have a structure built in that region the beacon becomes yours. And every 3 minutes the # of beacons you own gives you money. But the problem with that is Anyone can just start to create a structure in the region and the beacon will immediately turn to the player's color. You could then just cancel building and you would still own the beacon giving you money per turn (3:00 mins).

Checking to make sure that there is a structure in the region every 3:00 mins ensures that people do not just cancel structures and get the beacons for free. If I cannot find a solution I will do something weird like making the building build in one second so you cannot cancel in time. Of course that would rather ruin the fun of constructing buildings if they take one second to build.

Help?
01-07-2003, 08:16 PM#5
Seres
Hm...I guess I just read that wrong. The trigger I suggested above would only work if you want it to give them 1000 gold EVERY three minutes. If you want it to give them 1000 gold only once, try this...

Instead of having the first trigger's Action turn on another trigger, have it start a countdown timer (you can make them through variables in the variable editor (Trigger Editor - Edit - Edit Variables)).

Hmph...now you have me openeing my World Editor.

Here's the exact triggers you can use.

First, create a timer. Do this by going to the Trigger Editor, going to Edit, and Variable Editor. Make a new Variable, named MoneyCountdown, and make the Type "Timer."

Now, make two triggers. The first ones action will be Unit - Unit Enters Region. Make a region where you want the building to recieve gold from being in. Make the condition a Boolean Comparison, ((Triggering Unit) is A structure) Equal to True. Make the Event, Countdown Timer - Start Timer. Set the fields to;

Start GoldCountdown as a One-shot timer that will expire in 180 seconds.

Also, make another trigger, and set the Event to Timer - Timer Expires. Fill in the neccesary fields. Make the action a Unit Group - Pick every unit...and set the fields to;

Pick every unit in (Units in (Region)) and do (Player - Add 1000 to (Owner of (Picked unit)) current Gold)

Set the region to whatever you want, and you basically done.

You might, however, have to make multiple Timers and triggers for different Regions. There's probably an easier way, but I'm pretty sure this would work.
01-07-2003, 08:18 PM#6
Seres
Okay....I just read your post, and I know there is a not-to-complicated way of fixing that. Just gimme a second to think about it.
01-07-2003, 08:26 PM#7
Seres
Hmm....I suppose we can fix this simply by using a condition.

Make a condition in the first trigger, a Real Comparison. Set the fields to;

(Life of (Triggering Unit)) Equal to...

...now, the next field must be set to a Unit - Property. The fields need to be set as;

(Max life of (Triggering Unit))

So, the whole thing will end up looking like...

(Life of (Triggering Unit)) Equal to (Max life of (Triggering Unit))

I don't know for sure if this will work, but it's possible. You should also put another trigger in that turns off the trigger that gives gold to a player if the building is destroyed.
01-07-2003, 09:55 PM#8
Loofy
The idea with max life is GREAT. Yet I tried it and it did not work. The beacon does not change to my color. I did like you suggested Life of triggering object = to MAX life of Triggering object.

I think because at the time the structure "enters" the region it is being just constructed and does not have full hit points. When it is actually finished building the trigger action is over with conditions not being met.

So when I build a structure in region, the trigger does not work because the building is not immediately complete but is only being built. The idea is great, perhaps we can do something with timer delay?
01-07-2003, 10:19 PM#9
MrDoomMaster
The solution you ask for is rather complicated, but flawless once it is done. Since it is so long and complicated, i wouldn't even bother typing the answer here; so i have made a map for you with the triggers so you can look at them. This map took me about 2 hours to figure out and organize. I hope it helps
01-07-2003, 10:26 PM#10
rwxr-xr-x
Try this on for size, three triggers is all you need. The following expects three variables, 1) beaconRegions of type Region Array (initialize this array with all of the regions in an orderly fashion), 2) numRegions of type Integer (set this to the number of regions with the beacons), 3) beacons of type Unit Array (initialize this array with all of the beacons. Be sure to match the beacon locations with the regions in your indexes)

[Change Beacon Ownership]
EVENTS
Unit - A unit owned by Player 1 finishes contstruction
Unit - A unit owned by Player 2 finishes construction
etc... for all players
CONDITIONS
Triggering Unit is a structure
ACTIONS
for each Integer A from 1 to numRegions do if beaconRegions[Integer A] contains (Constructred structure) Equal to True then do Unit - Change ownership of beacons[Integer A] to (Owner of Constructed structure) and Change color else Do Nothing

[Remove Beacon Ownership]
EVENTS
Unit - A unit owned by Player 1 Dies
Unit - A unit owned by Player 2 Dies
etc... for all players
CONDITIONS
Triggering Unit is a structure
ACTIONS
for each Integer A from 1 to numRegions do if beaconRegions[Integer A] contains (Dying structure) Equal to True then do Unit - Change ownership of beacons[Integer A] to Neutral Passive and Change color else Do Nothing

[Timer Expires]
EVENTS
Timer - countdownTimer expires
CONDITIONS
-none-
ACTIONS
for each (Integer A) from 1 to numRegions do if (Owner of beacons[Integer A]) Not equal to Neutral Passive then do (Player - Add 1000 to (Owner of beacons[Integer A] Current Gold) else Do Nothing
01-07-2003, 10:35 PM#11
rwxr-xr-x
Quote:
Originally posted by MrDoomMaster
The solution you ask for is rather complicated, but flawless once it is done. Since it is so long and complicated, i wouldn't even bother typing the answer here; so i have made a map for you with the triggers so you can look at them. This map took me about 2 hours to figure out and organize. I hope it helps


Nicely done, however, your setup doesn't give a player 1000 gold for every beacon owned, it only gives a player 1000 gold period just for having built at least 1. Check out my three triggers example, which does ensure 1000 gold for every beacon owned.
01-07-2003, 11:08 PM#12
MrDoomMaster
I wasn't clear on his full desires. When i started to type that post there were only like 3 replies lol. Now i'll go back and change it the way you want.
01-07-2003, 11:19 PM#13
MrDoomMaster
rwxr-xr-x:

Your method is most definitely the best way, i wasn't able to find any flaws except for just one:

When you change beacon ownership, you open it to attacks. I suggest that if the beacons are pre-placed on the map that you make them initially invulnerable. If you don't do this then you will most definitely have to change his triggers up a lot in order to get it to work without ownership.

Major congrats rwxr-xr-x, too bad i spent 2 hours making that map without knowing what he really wanted or else i would have thought of it first :P
01-07-2003, 11:29 PM#14
rwxr-xr-x
Ahh, yes, good point. Invulnerability is a must, and since my triggers rely on the fact that the beacons are preplaced, you only need to add Invulnerability as an ability for the beacon, and wallah. Thanks for bringing that up, as it is indeed an important detail. :)
01-07-2003, 11:33 PM#15
ph33rb0
To give the money to the player just run the action Pick Every Unit In Group (Units owned by whomever) and do If (Picked Unit) equals Beacon then do Player - Property Add 1000 gold to (Whomever) else do nothing.