• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

[Trigger] The logic in these two triggers appears sound, but I'm not getting the result I want

Status
Not open for further replies.
Level 3
Joined
Oct 27, 2016
Messages
34
  • Howlfang Spawn
    • Events
      • Time - Elapsed game time is 5.00 seconds
      • Time - Every 60.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Remove all units from HowlfangWarparty
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units owned by Player 12 (Brown))) Less than 40
        • Then - Actions
          • Quest - Display to (All players) the Quest Update message: The Howlfang's are ...
          • Unit - Create 3 HowlfangTypes[1] for Player 12 (Brown) at (Position of Howlfang Den 0001 <gen>) facing Default building facing degrees
          • Unit - Create 2 HowlfangTypes[2] for Player 12 (Brown) at (Position of Howlfang Den 0001 <gen>) facing Default building facing degrees
          • Unit - Create 2 HowlfangTypes[3] for Player 12 (Brown) at (Position of Howlfang Den 0001 <gen>) facing Default building facing degrees
          • Unit - Create 1 HowlfangTypes[4] for Player 12 (Brown) at (Position of Howlfang Den 0001 <gen>) facing Default building facing degrees
          • Unit Group - Order HowlfangWarparty to Patrol To (Position of (Random unit from HowlfangAttackTargets))
        • Else - Actions
          • Quest - Display to (All players) the Quest Update message: The Howlfangs are s...
          • Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
            • Loop - Actions
              • Unit - Order (Picked unit) to Attack-Move To (Position of Ruffclaw Den 0000 <gen>)
And I'm using the following to place the units in the group

  • Howlfang Warparty
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Howlfang Poacher
          • (Unit-type of (Triggering unit)) Equal to Howlfang Gnoll
          • (Unit-type of (Triggering unit)) Equal to Howlfang Warden
          • (Unit-type of (Triggering unit)) Equal to Howlfang Overseer
    • Actions
      • Unit Group - Add (Triggering unit) to HowlfangWarparty
Once spawned, the units just...sit there. I've used similar basic triggers dozens of times before and never had a problem, I really have no idea what is going on. I also tried removing the "clear units" action at the beginning of the spawn trigger. The units still just stood around uselessly.

I'm also manually placing units in the "HowlfangAttackTargets" group in another trigger. I tried switching out the target to a specific unit, and still nothing!
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
Add debug messages to the Howlfang Warparty trigger to see if it is firing when intended. Also try ordering the units individually while printing a debug message to see if the group has the desired content. Since the group is being recycled make sure that it is not destroyed unintentionally.

The triggers also have quite a few memory leaks you might want to fix once the logic is working.
 
Level 3
Joined
Oct 27, 2016
Messages
34
Add debug messages to the Howlfang Warparty trigger to see if it is firing when intended. Also try ordering the units individually while printing a debug message to see if the group has the desired content. Since the group is being recycled make sure that it is not destroyed unintentionally.

The triggers also have quite a few memory leaks you might want to fix once the logic is working.

I did add a debug, and the trigger is clearly recognizing that the units are being spawned and they fit the criteria (just a simple quest message every time the trigger should be..well, triggering), the only real issue seems to be adding them to the unit group!

I also tried another (much less efficient) method of adding the units to the group and giving the order and it worked perfectly well. The only issue here seems to be that these two triggers simply....aren't communicating. Just these two, when written like this.

As for memory leaks, yep :) this is just to get the basics working while I do the rest of the map (it's for my friends and I for LAN parties, though I might upload it here for other people to muck about with once it's a little more...complete).
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
Use messages to print out the order they are firing in. Specifically place a message before you create the units and a message every time a unit is added to the group. It is possible that units only trigger the enters region event after the creating trigger finishes execution.

It would be a lot easier to add the units to the group inside the Howlfang Spawn trigger instead of a separate trigger. You can get a unit group of the last created units and then use the action to add all units from unit group to another unit group.
 
Level 3
Joined
Oct 27, 2016
Messages
34
It would be a lot easier to add the units to the group inside the Howlfang Spawn trigger instead of a separate trigger. You can get a unit group of the last created units and then use the action to add all units from unit group to another unit group.

Yeah, I was just being stubborn and wanted to create the units two or three at a time. I think I'll just do it the sensible way and create/add one unit at a time!

Thanks for the help!
 
Level 7
Joined
Mar 10, 2013
Messages
366
Events does not run concurrently, so your party would not be populated once you ordered then to do something. And since clear the group every time you spawn new units, the group would never be filled with any units.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,239
Yeah, I was just being stubborn and wanted to create the units two or three at a time. I think I'll just do it the sensible way and create/add one unit at a time!
Or add them "two or three at a time"?
  • Gathering Unit Group Test Trigger
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 5 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to GatheringGroup
      • Unit - Create 10 Rifleman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Unit Group - Add all units of (Last created unit group) to GatheringGroup
      • Unit Group - Pick every unit in GatheringGroup and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to 1.00%
The action is "Unit Group - Add Unit Group". Above trigger does what is expected and creates 5 footman and 10 rifleman at the centre of the map and adds sets all their life to 1%.
 
Status
Not open for further replies.
Top