• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigger Help Needed for Diplomacy-Type of map

Status
Not open for further replies.
Level 2
Joined
Aug 22, 2006
Messages
8
I have two triggers that are supposed to check how many mines (beacons) a user has under control. But I cannot get them to work as I want.

The idea for this trigger was supposed to be: If player has atleast 1 structure next to the beacon, and no other player has any structures next to the beacon, set variable value to itself plus 1. But I can't quite figure it out.

This is what I currently have (as a test for player 1, note Player1Mines is an integer var):


Mine 1e001 Copy
Events
Unit - A unit enters resource 1e001 <gen>
Conditions
((Triggering unit) is A structure) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in (Units within 200.00 of ((Position of Resource (Ore) 0005 <gen>) offset by (0.00, 0.00)) matching (((Triggering unit) is A structure) Equal to True))) Greater than or equal to 1
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Then - Actions
Multiboard - Set the text for (Last created multiboard) item in column 4, row 2 to ((String(Player1Mines)) + 1)
Set Player1Mines = (Player1Mines + 1)
Else - Actions
Do nothing


I cannot figure out how to have the conditions check to see if enemy structures are within the same location as the beacon.

The same problem is on the second trigger. I am just wondering if anyone would help me with this problem. I thought I understood triggers pretty well but this one just stumps me. Please somebody help.
 
Level 6
Joined
Apr 4, 2005
Messages
299
If - Conditions
(Number of units in (Units within 200.00 of ((Position of Resource (Ore) 0005 <gen>) offset by (0.00, 0.00)) matching (((Triggering unit) is A structure) Equal to True))) Greater than or equal to 1
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Then - Actions


- if you are checking matching unit it is MATCHING UNIT (not triggering unit) this is main problem.

You shouldnt also make region on each mine and test entering units. Better simple solution is to each period of time (not less than 1 sec) pick every unit of type of mine and check count of "miner" units in range from picked unit.
So, you may not create lot of triggers and you have no need to create new region or triger if you create new mine.

Just make one dynamic triger insted tousands of statics:]
 
Level 2
Joined
Aug 22, 2006
Messages
8
Well Alvatar your idea made me happy for a second but I tried it out and I don't understand how to proceed. I made a trigger that doesn't do what I want still. :cry:

I am wondering if there is any way to do this other than the way I first thought up. I'm not sure if I made myself clear on the request of the trigger. I am trying to make it so the trigger counts that you have atleast one within range of the mine and that your enemies/allies/neutral players don't have any buildings next to it. Once that condition is successful I want to have a variable that counts how many individual mines you have.

So the way you were trying to tell me how to do it (if I understand what you said), is more on the idea of have so many miners next to the mine, give player that much more ore... I don't want that. Can't believe I'm asking for more help but I am. Anyway this is what I came up with (I know it doesn't work, but can't figure out how to fix it):

Unit Group - Pick every unit in (Units of type Resource (Ore)) and do (Unit Group - Pick every unit in (Units within 200.00 of (Position of (Picked unit))) and do (Unit Group - Pick every unit in (Units within 200.00 of (Position of (Picked unit)) matching ((((Matching unit) is A structure) Equal to True) and

(couldn't copy the rest it's so long, here's what it basically is:)

is equal to player 1
and matching unit not equal to Mine (unit)

Set integer variable Player1Mine to (and yeah thats where I'm stuck too, I don't know how to make it know that I want the editor to count only that the player have at least 1 Structure by the beacon to control it)

I'll keep working on it, but I'd appreciate any help.
 
Level 2
Joined
Aug 22, 2006
Messages
8
Ok I figured out a way to do it. Thanks for your help Alvatar.


In the end I made a trigger looking like this:

Unit Group - Pick every unit in (Units of type Resource (Ore)) and do (If ((Number of units in (Units within 300.00 of (Position of (Picked unit)) matching ((((Matching unit) is A structure) Equal to True) and ((Owner of (Matching unit)) Equal to Player 1 (Red))))) Greater than or equal to 1) then do (Unit - Change ownership of unit to Player 1 and change color)

After this I made another trigger that set the variable to the number of units owned. A bit less complicated than I wanted, but I didn't want to make 114 similar triggers.
 
Status
Not open for further replies.
Top