• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Detecting Current Training of a Unit

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
  • Reset Queue
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
      • (Issued order) Not equal to (Order(stop))
      • ((Owner of (Triggering unit)) Food cap) Less than or equal to (((Owner of (Triggering unit)) Food used) + ((Point-value of (Unit-type((String((Issued order)))))) x (Supply used by (Unit-type((String((Issued order))))))))
    • Actions
      • Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The old unit's relative life and mana
      • Set GPlayerGroup = (Player group((Triggering player)))
      • Game - Display to GPlayerGroup the text: You have reached yo...
      • Custom script: call DestroyForce(udg_GPlayerGroup)
This is designed to only detect unit production, problem is order with no target detects a lot of stuff it doesn't need too.

So I added the "Issued order not equal to stop" to narrow it down.

But how can I only run this functions when a unit is being made? Because in its current state it crashes my game when an AI player is giving orders with no target.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Use this to cancel training:
  • Custom script: call IssueImmediateOrderById( GetTriggerUnit(), 851976 )
(851976 is the order id for cancel)

What exactly are you trying to do with this trigger?

That's really useful thanks.

And the design of the trigger is so you can't abuse a population cap with a squad system.

Ex. Unit 1 costs 1 pop, but have 6 members, so you can make it if you only have 1 pop available, but when it finishes it will use 6 pop because it has six members.

This is designed to stop you from building units past your pop cap.
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
That's really useful thanks.

And the design of the trigger is so you can't abuse a population cap with a squad system.

Ex. Unit 1 costs 1 pop, but have 6 members, so you can make it if you only have 1 pop available, but when it finishes it will use 6 pop because it has six members.

This is designed to stop you from building units past your pop cap.

Is it something similar to AoE 3 training units in batches ?
 
Status
Not open for further replies.
Top