I Need help for my trigger concerning Militia units to work

Level 4
Joined
Aug 11, 2017
Messages
16
I am trying to make it so the Militia have damage dice and their size depending on their armors. For some reason, Militia don't count as ''Entering'' the battlefield when Call To Arms is being performed. What even are Militia? They also don't count as summons... What should I try to make it so Militia have Damage dice depending on their armors when they become Militia ?
 

Attachments

  • image_2024-11-17_162015265.png
    image_2024-11-17_162015265.png
    11.1 KB · Views: 10
Level 30
Joined
Aug 29, 2012
Messages
1,382
I've found that this works, even if it's a bit convoluted:

  • Militia
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(militia))
    • Actions
      • Wait until ((Unit-type of (Triggering unit)) Equal to Militia), checking every 1.00 seconds
      • -------- Your actions --------
Might be another more obvious way, but couldn't find any order event that fires
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
No morph abilities trigger enter region events, so this is ultimately consistent with everything else. I think more direct than Chaosium’s periodic is just to put all militia owned by the ordering player into a unit group and then check their unit types repeatedly over time; if you find a militia unit in group 1 give it damage and move it to group 2; if you find a peasant in group 2 remove damage and remove it from both groups.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I did this for both Militia and peasant and it works like a charm !!! Thank you for helping me
That's not what you want to do and leaks a whole lot.

I'd say just stick with this setup:
  • Militia ON
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(militia))
      • (Unit-type of (Triggering unit)) Equal to Peasant
    • Actions
      • Wait 0.20 seconds
      • -------- Your actions --------
Then assuming that Militia issue the Order when returning back to Peasants:
  • Militia OFF
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(militia))
      • (Unit-type of (Triggering unit)) Equal to Militia
    • Actions
      • Wait 0.20 seconds
      • -------- Your actions --------
Otherwise, you can add the "Wait until Peasant" action to the first trigger after you've adjusted their damage.

I'm pretty sure it's just 1 frame later that the morphing occurs, so your Wait literally just needs to cause a frame of time to pass.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
That's not what you want to do and leaks a whole lot.
I disagree, though it is inefficient and wasteful. The group destroy is in the wrong spot but doesn't leak any objects. What doesn't it achieve that Gaudette wants? Actually a very good use case for UnitsOfType which is normally not the way. Your solution won't update their damage dice if they gain or lose armor while they're militia (Devotion Aura says hello).
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I disagree, though it is inefficient and wasteful. The group destroy is in the wrong spot but doesn't leak any objects. What doesn't it achieve that Gaudette wants? Actually a very good use case for UnitsOfType which is normally not the way.
I meant to say that it's not the correct way of doing it, your way would work fine as long as it's handled properly.

He's destroying the Unit Group inside of the Loop - Actions and if there are no militia then won't MI leak since it'll never be destroyed? Or does it just return null?

Anyway, I think I'd rather have some Waits running for a few units once in a while then a Loop running the entire game that's often unneeded. Although, he could turn the Loop on/off to help with this.
Your solution won't update their damage dice if they gain or lose armor while they're militia (Devotion Aura says hello).
I think I glossed over that, I just assumed he wanted to snapshot the damage.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
Hm, you’re correct that it won’t destroy the group if it’s empty. Missed that, thanks.

If militia dying don’t get issued the order automatically, then your method also fails to remove the bonus damage from any militia that die and are then reanimated/resurrected as normal peasants. Mine might as well if their unit type is not changed back to peasant post-death.

That’s quite a niche special case, though.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Hm, you’re correct that it won’t destroy the group if it’s empty. Missed that, thanks.

If militia dying don’t get issued the order automatically, then your method also fails to remove the bonus damage from any militia that die and are then reanimated/resurrected as normal peasants. Mine might as well if their unit type is not changed back to peasant post-death.

That’s quite a niche special case, though.
I think resurrection/reanimation creates a brand new unit. I doubt it would carry over these changes.

Anyway, it's all nitpicky at this point, lol.
 
  • Like
Reactions: KPC
Top