• 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 that increases attack based on allies attacking with you? Also two additional questions below.

Level 5
Joined
Nov 17, 2022
Messages
84
1. Trigger that increases attack based on allies attacking with you

I'm thinking up abilities to give the worg cubs for my game and had a thought about something like this to encourage further player unity since idea is you are playing as a wolf pack. What would be the specifics to creating a trigger like this?

2. Getting a unit to go attack another unit

I have a system drafted for predator units [there's four currently being Terrorbirds, Hellpigs, Deathcats and Owlbears], to lose mana, aka, hunger points and once they hit 0 they will need to kill a unit to replenish their mana. However I can't figure out a way to simulate these critters to go on a hunt. I tried something like "Picked unit to attack random unit in region owned by x player" but issue is it'll cross the whole map on a mission to find one specific unit and get wrecked/killed by the prey units before it can do much.

3. Hero named after username of player


I know how this one is supposed to go but for some reason the worg cub never gets the name of the player. Any ideas what I am doing wrong?
1722298330396.png
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
1. are you thinking of an active ability or passive?
2. here you could make a periodic trigger that keeps checking the mana levels of these units. when it gets low enough, you start issuing attack orders to all of them together as a group to the unit you want them to be attacking (you need to make sure it is the same unit consistently throughout the periodic ticks, or they will keep starting to move in different directions, and never get anywhere). if their mana is still low after the kill - they will keep hunting just like the starting point, and if their mana is high enough they will go back home. something like that.
3.
in hero -actions - set name of triggering unit... - there is no triggering unit here. nothing has been selected about any unit at this point.

also - How To Post Your Trigger

posting your trigger correctly instead of a screenshot is easier and makes it more readable
 
Last edited:
Level 5
Joined
Nov 17, 2022
Messages
84
in hero -actions - set name of triggering unit... - there is no triggering unit here. nothing has been selected about any unit at this point.

also - How To Post Your Trigger

posting your trigger correctly instead of a screenshot is easier and makes it more readable
Thing is I don't know if I can select a unit since the worg cub is created and spawned in, so it doesn't have a unit on the map to click on in the trigger. Unless I'm misunderstanding 🤔
 
Level 5
Joined
Nov 17, 2022
Messages
84
1. are you thinking of an active ability or passive?
2. here you could make a periodic trigger that keeps checking the mana levels of these units. when it gets low enough, you start issuing attack orders to all of them together as a group to the unit you want them to be attacking (you need to make sure it is the same unit consistently throughout the periodic ticks, or they will keep starting to move in different directions, and never get anywhere). if their mana is still low after the kill - they will keep hunting just like the starting point, and if their mana is high enough they will go back home. something like that.
3.
in hero -actions - set name of triggering unit... - there is no triggering unit here. nothing has been selected about any unit at this point.

also - How To Post Your Trigger

posting your trigger correctly instead of a screenshot is easier and makes it more readable
Also apologies it's like 3 am rn so my reading compression missed the entire two parts of your comment :"D

1. Passive has been my current thought but tbh I'd be willing to even bend with whatever would be easier for a trigger noob like me to make.

2. That could be doable yeah 🤔 is there any way you could provide a screenshot example on the editor itself? Just because it'd help me set it up/learn it better.

3. Also ignore my last reply, I fixed it. Realized Last Created Unit seems to be what I needed in this scenario 👍
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
most of the things you want to do with triggers should not require selecting preplaced units. unit groups are especially useful. here is a partial example.
(you should try to learn the basics about memory leaks too which I didn't deal with in this short example)

  • wolfhunt
    • Events
    • Conditions
    • Actions
      • Set VariableSet wolfgroup = (Units of type Frost Wolf)
      • Unit Group - Pick every unit in wolfgroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack No unit
 
Level 5
Joined
Nov 17, 2022
Messages
84
most of the things you want to do with triggers should not require selecting preplaced units. unit groups are especially useful. here is a partial example.
(you should try to learn the basics about memory leaks too which I didn't deal with in this short example)

  • wolfhunt
    • Events
    • Conditions
    • Actions
      • Set VariableSet wolfgroup = (Units of type Frost Wolf)
      • Unit Group - Pick every unit in wolfgroup and do (Actions)
        • Loop - Actions
          • Unit - Order (Picked unit) to Attack No unit
Ooo I see. I'll have to experiment with that.
I never heard of memory leaking until this very moment so definitely something I'll research about to better optimize my map.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
Also apologies it's like 3 am rn so my reading compression missed the entire two parts of your comment :"D

1. Passive has been my current thought but tbh I'd be willing to even bend with whatever would be easier for a trigger noob like me to make.

2. That could be doable yeah 🤔 is there any way you could provide a screenshot example on the editor itself? Just because it'd help me set it up/learn it better.

3. Also ignore my last reply, I fixed it. Realized Last Created Unit seems to be what I needed in this scenario 👍

1. if you want a passive, you could just use command aura without any triggers. just an aura that increases ally damage. I think you can probably edit it to exclude self if you want (in the object editor).

2. maybe later...

Ooo I see. I'll have to experiment with that.
I never heard of memory leaking until this very moment so definitely something I'll research about to better optimize my map.

 
Level 15
Joined
Jul 12, 2018
Messages
560
For question 1, count units in unit group (set UnitGrp = all allied units within 250 range), add a bonus based on the # of units, then set a removal for the effect.
Personally i would create an invisible dummy unit with locust and no unitmodel that expires after a duration determined by the # of nearby allies in the counted group (add expiration timer : arithmetic duration), and trigger the removal of the bonus in a separate trigger that runs when the locust dummy unit dies.

For question 2, consider adding the ability "Cargo Hold (Ship)" to your units when they are full, this disables attacking and acquiring targets. Then remove it when they're hungry. Edit the ability to have 0 cargo capacity and they wont be trying to pick up units as transports.
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
2. That could be doable yeah 🤔 is there any way you could provide a screenshot example on the editor itself? Just because it'd help me set it up/learn it better.

I would do something like this
(I didn't deal with leaks bc I'm lazy... )


basically, the main loop checks if they are hungry or not. if not, it sends them home. if yes it picks a target and switches to the hunt loop.
the hunt loop keeps going till they kills the target, and then it swaps back to the main loop.
  • WolfpackMainLoop
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Set VariableSet wolfgroup = (Units of type Timber Wolf)
      • Unit Group - Pick every unit in wolfgroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Mana of (Picked unit)) Less than 30.00
            • Then - Actions
              • Set VariableSet HuntTargetGroup = (Units of type Chicken)
              • Set VariableSet huntTarget = (Random unit from HuntTargetGroup)
              • Trigger - Turn off (This trigger)
              • Trigger - Turn on WolfPackHuntLoop <gen>
              • Skip remaining actions
            • Else - Actions
              • Unit - Order (Picked unit) to Move To WolfHome
  • WolfPackHuntLoop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (huntTarget is alive) Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in wolfgroup and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack huntTarget
        • Else - Actions
          • Trigger - Turn off (This trigger)
          • Trigger - Turn on WolfpackMainLoop <gen>
 
Top