• 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.

Are There Any Leaks With This Trigger, or Anything Wrong

Status
Not open for further replies.
Level 16
Joined
May 2, 2011
Messages
1,351
Here it is:
  • Captain Defend
    • Events
      • Unit - Captain 0034 <gen> Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(defend))
    • Actions
      • Unit Group - Order (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Footman) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))) to Human Footman - Defend
  • Captain Undefend
    • Events
      • Unit - Captain 0034 <gen> Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
    • Actions
      • Unit Group - Order (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Footman) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))) to Human Footman - Stop Defend
so can you catch any leaks in this trigger? do I have to do that weird script to destroy group or whatever? it is just let footmen imitate the captain, defending or undefending.
 
Level 16
Joined
May 2, 2011
Messages
1,351
  • Captain defend
    • Events
      • Unit - Captain 0034 <gen> Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(defend))
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Order (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Footman) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))) to Human Footman - Defend
  • Captain Undefend
    • Events
      • Unit - Captain 0034 <gen> Is issued an order with no target
    • Conditions
      • (Issued order) Equal to (Order(undefend))
    • Actions
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Order (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Footman) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit))))) to Human Footman - Stop Defend
So this one is OK and is with no leaks? or is it enough to do that custom thing once?
 
Level 16
Joined
May 2, 2011
Messages
1,351
Triggering player?!! lol, and its working, without the player apppearing in the event....

Anyway. I just found a problem with the trigger. when the Captain defends, footmen defend and stop. However, it should continue its order, if I order footman to defend, he does not stop moving to where I pointed. I want it like this with the captain.

well.. maybe I should just start new thread.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Short fix:
Set O = Current order of Unit
Order Unit to Defend
Order Unit to O.

Generic Unit Events works with the Owner of the Unit, so, Triggering Player = Owner of Triggering Unit.
 
Level 16
Joined
May 2, 2011
Messages
1,351
Short fix:
Set O = Current order of Unit
Order Unit to Defend
Order Unit to O.

Generic Unit Events works with the Owner of the Unit, so, Triggering Player = Owner of Triggering Unit.
I could set o = current order but I can not order units to do O.
there is only order to (preset orders): there is no order to do variable or function, as far as I could see.

Also, your order works for only 64max units maximum.

well, world editor claims that the maximum is 12. However, as my experiment have shown, you both underestimated the number. It had worked for 75 footmen. I am not really concerned how much it is, 50+ is sufficient to me.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
You can order units to "o" if you use Custom Scripts :p (God, i'm loving jass)

  • Actions
    • Set Order = (Current order of (Triggering unit))
    • Set String = (String((Current order of (Triggering unit))))
    • Set Integer = (Integer((String((Current order of (Triggering unit))))))
JASS:
    set udg_Order = GetUnitCurrentOrder(GetTriggerUnit())
    set udg_String = OrderId2String(GetUnitCurrentOrder(GetTriggerUnit()))
    set udg_Integer = S2I(OrderId2String(GetUnitCurrentOrder(GetTriggerUnit())))

As you can see.. An Order can be seen as an order, as a string, or as an integer.

The problem is you have to create some function to check the if the order requires a target, or a destructible, or it has no target, etc... because you can give orders with JASS, but each one has a different name and requires different arguments.
 
Level 16
Joined
May 2, 2011
Messages
1,351
You can order units to "o" if you use Custom Scripts :p (God, i'm loving jass)

  • Actions
    • Set Order = (Current order of (Triggering unit))
    • Set String = (String((Current order of (Triggering unit))))
    • Set Integer = (Integer((String((Current order of (Triggering unit))))))
JASS:
    set udg_Order = GetUnitCurrentOrder(GetTriggerUnit())
    set udg_String = OrderId2String(GetUnitCurrentOrder(GetTriggerUnit()))
    set udg_Integer = S2I(OrderId2String(GetUnitCurrentOrder(GetTriggerUnit())))

As you can see.. An Order can be seen as an order, as a string, or as an integer.

The problem is you have to create some function to check the if the order requires a target, or a destructible, or it has no target, etc... because you can give orders with JASS, but each one has a different name and requires different arguments.

I don't get how these triggers order units?? I could make an order variable but I yet could not.... wait let me try it with my test map.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
These triggers doesn't order anything, it just shows that orders are order/string/integer. To give custom orders to units you have to use JASS / Custom Scripts, but it requires knowing the type of order because the functions to give orders to units are different one from each other, depending on the order type (No target - TargetUnit - TargetDestructible - TargetItem, etc.)
 
Level 16
Joined
May 2, 2011
Messages
1,351
Yes. Also, replace Owner of Triggering unit by Triggering Player, it's a little optimisation.
this did not work
  • Naga
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Naga Sea Witch
    • Actions
      • -------- Buildings --------
      • Player - Make Altar of the Depths Available for training/construction by (Triggering player)
      • Player - Make Coral Bed Available for training/construction by (Triggering player)
      • Player - Make Shrine of Azshara Available for training/construction by (Triggering player)
      • Player - Make Spawning Grounds Available for training/construction by (Triggering player)
      • Player - Make Temple of Tides Available for training/construction by (Triggering player)
      • Player - Make Tidal Guardian Available for training/construction by (Triggering player)
      • -------- Units --------
      • Player - Limit training of Naga Myrmidon to 4 for (Owner of (Triggering unit))
      • -------- Upgrades --------
      • -------- Animations --------
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A structure) Equal to True)) and do (Actions)
        • Loop - Actions
this did
  • Naga
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Naga Sea Witch
    • Actions
      • -------- Buildings --------
      • Player - Make Altar of the Depths Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Coral Bed Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Shrine of Azshara Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Spawning Grounds Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Temple of Tides Available for training/construction by (Owner of (Triggering unit))
      • Player - Make Tidal Guardian Available for training/construction by (Owner of (Triggering unit))
      • -------- Units --------
      • Player - Limit training of Naga Myrmidon to 4 for (Owner of (Triggering unit))
      • -------- Upgrades --------
      • -------- Animations --------
      • Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching (((Matching unit) is A structure) Equal to True)) and do (Actions)
        • Loop - Actions
      • -------- Change base --------
      • Player - Set the current research level of Spawning Grounds (Upgrade) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Shrine of Azshara (Upgrade) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Coral Bed (Upgrade) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Tidal Guardian (Upgrade) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Temple of Tides (Upgrade)(Ages) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Temple of Tides (Upgrade)(Life) to 1 for (Owner of (Triggering unit))
      • Player - Set the current research level of Temple of Tides (Upgrade)(Eternity) to 1 for (Owner of (Triggering unit))
      • Wait 2.00 seconds
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Because "Triggering Player" works for GENERIC UNIT EVENTS, not for "Unit enters Region".

You have to reduce repetitive callings with variables because these reduce the quality, speed and efficiency of your map.

Create a Player variable and in the beginning of the trigger Set PlayerVar = (Owner of (Triggering Unit)). and replace all the other "(Owner of (Triggering Unit))" with the Player variable.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Every time you see a pair of these ()'s (parentheses) means the game looks in the data for that value. Repeating (Owner of (Triggering Unit)) means looking for the Triggering Unit, and then for the Owner of that unit.

The game needs 30 functions to get the (at least) 15 "Owner of Unit" you're using. That means the game invest more resources (memory, ram) to run this trigger, which means slower game response, lag spikes, delay, and not "smooth" triggering.

You could just use 1 action which does 2 functions: "Set P = (Owner of (Triggering Unit))" from there on, if you replace all the "(Owner of (Triggering Unit))" with the "p" variable, the game doesn't look over and over for the same data, but just gets the data stored in the variable.

Example:
- "Hey, dude, would you please look for a bag of rice in the storage room?"
- Sure, i'm on my way
... 15 minutes later
- Here it's
- "Thanks, now, would you please look for another one?"
- Ok, but I'll take some time again because I already forgot in which box it's stored
... This, 15 times, untill the guy has the 15 bags of rice he wants.

That's what happens when you repeat "(Owner of (Triggering Unit))" over and over.

The correct way would be:
- "Hey, dude, I need 15 bags of rice. These are stored in Box #8 in the Hall #2, in the blue box, in the storage room."
- Sure, i'm on my way
... 15 minutes later
- Here you have the rice you wanted.

It's not "needed" but it's really importart for triggering improvement. These GUI codes sometimes does stuff in a way that's really inneficient. What JASSers do is work in the script behind the graphic interface to improve the triggers even more to make the triggering as fast, smooth, clean, precise, and efficient as possible.
 
Status
Not open for further replies.
Top