• 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] Selection Event + Selection Action combine don't work?

Status
Not open for further replies.
Level 5
Joined
Nov 14, 2004
Messages
159
I'm trying make AI in my map, but this Selection Event + Selection action never work at least for me. Anyone know proper way to do this?

  • picking neutral tower
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • ((Triggering player) Current gold) Greater than or equal to 100
      • (Owner of (Triggering unit)) Equal to Neutral Passive
      • (Unit-type of (Triggering unit)) Equal to Tower
    • Actions
      • Set ExistTowerB = False
      • Set regpos = (Position of (Triggering unit))
      • Region - Center towercheck h <gen> on regpos
      • Region - Center towercheck v <gen> on regpos
      • Unit Group - Pick every unit in (Units in towercheck h <gen>) and do (If ((Owner of (Picked unit)) Equal to (Triggering player)) then do (Set ExistTowerB = True) else do (Do nothing))
      • Unit Group - Pick every unit in (Units in towercheck v <gen>) and do (If ((Owner of (Picked unit)) Equal to (Triggering player)) then do (Set ExistTowerB = True) else do (Do nothing))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ExistTowerB Equal to True
        • Then - Actions
          • Player - Add -100 to (Triggering player) Current gold
          • Unit - Change ownership of (Triggering unit) to (Triggering player) and Change color
          • Player - Add 1 to (Triggering player) Current lumber
        • Else - Actions
and

  • Decision
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set someNum = (Random integer number between 1 and 100)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) controller) Equal to Computer
              • someNum Less than or equal to 50
            • Then - Actions
              • Selection - Select (Random unit from (Units of type Tower)) for (Player((Integer A)))
            • Else - Actions
              • If (((Player((Integer A))) controller) Equal to Computer) then do (Unit - Order (Random unit from (Units owned by (Player((Integer A))) of type Tower)) to train/upgrade to a Footman) else do (Do nothing)
What's wrong with it is that it's ALWAYS "ELSE" action, never "THEN" action. Btw, regions are big enough to catch another Tower.

Or it might be condition doesn't work.
 
Level 3
Joined
Jul 31, 2005
Messages
21
Your unit group check is confusing, the condition for the the trigger is that the unit being selected is owned by neutral passive so why do you have an action checking if the unit being selected is owned by the player? This way the trigger will never set "ExistTowerB" to true which mean the "then"-actions will never trigger.
 
Level 11
Joined
Jul 12, 2005
Messages
764
No, it would work Beelzebub. That's not the problem here.

As i remember, in a trigger with the event 'Player selects a unit', you cannot refer to the selected unit with Triggering unit. Only if you use the event 'Unit is selected' will it work, but there's the problem: it's a specific unit event.

If you have those towers in the map already, you can use the created variables.
But if they are built in-game, you have to create a trigger where you register when a "Tower" is built/created, and add an event to the 'Selecion trigger'.
  • RegTowerBuild
    • Events
      • Unit enters playable map area
    • Conditions
      • Unit-type of Triggering unit is equal to Tower
    • Actions
      • Trigger - Add an event to Selection-trigger like (Triggering unit is selected)
      • -- I don't know the proper function, it might be under 'Trigger', you will find it
 
Last edited by a moderator:
Level 5
Joined
Nov 14, 2004
Messages
159
As i remember, in a trigger with the event 'Player selects a unit', you cannot refer to the selected unit with Triggering unit.

No, you can refer selected unit with triggering unit. It was stated in WE (read in the "Player - Selection Event")

But I came to conclusion, selection action don't work for computer player. I came up with work-around solution anyway.
 
Status
Not open for further replies.
Top