• 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] Unit Identification Problem

Status
Not open for further replies.
Level 10
Joined
May 20, 2008
Messages
433
I'm currently working on a survival map that uses an award system. When you get an award, your unit gains an item. Problem is that I have no idea on how to make it so that your unit gains an item, and nothing else.
Currently, the trigger looks like this:
  • HKA R
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
      • Kills_Red Greater than or equal to 300
    • Actions
      • Trigger - Turn off (This trigger)
      • Game - Display to Player Group - Player 1 (Red) the text: |cffFE890DAchieveme...
      • Hero - Create Marine Armour V and give it to (Random unit from (Units owned by Player 1 (Red) of type Field Intel Marine))
      • Hero - Create Marine Armour V and give it to (Random unit from (Units owned by Player 1 (Red) of type Special Ops Marine))
      • Hero - Create Marine Armour V and give it to (Random unit from (Units owned by Player 1 (Red) of type Tactical Marine))
Yes I do know this trigger will create 2 extra items, and thats basically the problem. I need an If/Then/Else part to do this (I've tried to figure it out, but it didn't work):
Pick every unit owned by red of type A, B or C (in response to the trigger).
Give an item to that unit.
If a new trigger is needed, so be it. If this trigger needs to be replaced, so be it. Help will be rewarded.
 
Level 4
Joined
Mar 19, 2008
Messages
89
I think what you want is to create an item for every unit that is a certain type when you have 300 kills. if not sorry! Well here is how I would do this!

I would create two triggers. the first one has the following... stuff:
  • When kills 300
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Kills_red Greater than or equal to 300
        • Then - Actions
          • Game - Display to Player Group - Player 1 (Red) the text: You have just made ...
          • Unit Group - Pick every unit in (Units owned by Player 1 (Red) of type Rifleman) and do (Actions)
            • Loop - Actions
              • Item - Create Claws of Attack +15 at (Random point in (Playable map area))
              • Hero - Give (Last created item) to (Picked unit)
              • Trigger - Turn on When kills 300 2 <gen>
              • Trigger - Turn off (This trigger)
        • Else - Actions
          • Do nothing
the second one is not enabled initially! And the... stuff is:
  • When kills 300 2
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • Kills_red Greater than or equal to 300
    • Actions
      • Item - Create Claws of Attack +15 at (Random point in (Playable map area))
      • Hero - Give (Last created item) to (Entering unit)
The first trigger will give any unit of a certain type a unit, then turn on the second trigger, which will give any unit of that type that is just created an item!

If this is not what you wanted to do, please tell me and I will help. I will check this forum periodically.

Also, a little note: Make sure the unit you want to give the item to is a hero, otherwise I don't think it will work!
 
Level 10
Joined
May 20, 2008
Messages
433
I want a system to pick every unit owned by Red, but of type A, B or C. In the game, you choose the unit to use, so I need a system to choose that unit picked, but there are 3 different types to choose from.
 
Level 9
Joined
Jun 7, 2008
Messages
440
Make a trigger that when you reach 300 kills enable selection event.
  • Events
    • Time - Every .50 seconds of game time
  • Conditions
    • Kills_red Greater than or equal to 300
  • Actions
    • Trigger - enable SelectUnit // A new trigger
    • Game - Display to Player 1 (red) the message Please select a unit to give the upgrade.
This next trigger will not be Initially enabled.Im sorry, due to my in ability to not get on WE, im kinda spit balling in the dark.

There is an event where you can select a unit
Just pick every unit of the same type you selected and give them the item you want. If there is no such action, create a variable.

when you select a unit, set the variable to the unit you selected. Then just pick every unit of the variable type, and do "give <item> to (picked unit)"

Sorry i can't show you what i mean. As well, i just figured out that this would leak if you ended up picking a different players units. Hope this limited response helps :sad:
 
Status
Not open for further replies.
Top