• 🏆 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!

[Solved] rally point summon ability

Status
Not open for further replies.
Level 4
Joined
Feb 5, 2020
Messages
48
In one of my maps I have a building that summons temporary minions for the player. I've been requested to add a rally point for this building that automatically sends the summons in the rally points direction. Is this possible?
 
Level 4
Joined
Feb 5, 2020
Messages
48
  • Events
  • Unit - A unit spawns a summoned unit
  • Conditions
  • Actions
  • Unit - Order (Summoned unit) to Attack-Move to (Rally point of (Summoning unit))
This leaks a Point so you should take the appropriate steps if you care about memory leaks.
I tried that, didn't work. Here's my trigger:
  • Summon Rallypoint
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Summoning unit)) Equal to BuildingX
          • (Ability being cast) Equal to SummonX
        • Then - Actions
          • Unit - Order (Summoned unit) to Attack-Move To (Rally-Point of (Summoning unit) as a point)
        • Else - Actions
          • Do nothing
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
The Event Response (Ability being cast) does not exist in this situation which will cause problems:
  • (Ability being cast) Equal to SummonX
These are the Events that use (Ability being cast):
  • Unit - A unit starts the effect of an ability
  • Unit - A unit begins casting an ability
  • Unit - A unit stops casting an ability
  • Unit - A unit begins channeling an ability
You also never need to use this action, it's no different from a comment:
  • Do nothing
Finally, you don't need the If Then Else since you aren't taking advantage of the Else - Actions.
 
Last edited:
Level 4
Joined
Feb 5, 2020
Messages
48
It does exist, that the X is just the building, you can add the name for whatever your building is called, same for the summonX is just the name of the ability.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
Is it because I'm using the "rally" ability rather than adding a dummy unit to the building?
  • Summon Rallypoint
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to BuildingX
    • Actions
      • Set Variable RallyPoint = (Rally-Point of (Summoning unit) as a point)
      • Unit - Order (Summoned unit) to Attack-Move To RallyPoint
      • Custom script: call RemoveLocation(udg_RallyPoint)
This should work fine.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,557
It does exist, that the X is just the building, you can add the name for whatever your building is called, same for the summonX is just the name of the ability.
I don't think you fully understand how Event Responses work. They're set in RESPONSE to an Event, meaning that they will not be set to anything if your Event has no relation to them. So when I say that the (Ability being cast) doesn't exist, I mean that this Event Response isn't set to anything in this situation therefore your condition will always fail.

For example:
  • Unit - A unit dies
The only Event Responses you can use here are:
  • (Triggering unit) --- This is the dying unit as well
  • (Dying unit)
  • (Killing unit)
This is because these Event Responses belong to this Event. You can't reference (Ability being cast), (Entering unit), (Leveling hero), (Casting unit), etc. because none of those things are related to the Event "A unit dies".

However, it can get a little weird because Event Responses have mixed behavior. Some act like global variables which you can reference from any trigger, but that's extremely dangerous and just asking for bugs. Some act like local variables which can exist throughout your trigger even with Waits. Some get unassigned and can't be used after the trigger and after a Wait.
 
Last edited:
Level 4
Joined
Feb 5, 2020
Messages
48
  • Summon Rallypoint
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • (Unit-type of (Summoning unit)) Equal to BuildingX
    • Actions
      • Set Variable RallyPoint = (Rally-Point of (Summoning unit) as a point)
      • Unit - Order (Summoned unit) to Attack-Move To RallyPoint
      • Custom script: call RemoveLocation(udg_RallyPoint)
This should work fine.
Nice, it works! Thank you!
 
Level 39
Joined
Feb 27, 2007
Messages
5,019
To be pedantic: the ones that work like globals are still accessible after the event, it’s just very likely that something ELSE overwrote those.

Every time an ability starts being cast, starts effect, stops, or finishes casting the Ability Being Cast event response is updated. You absolutely would not want to rely on this info but in principle it would work too.
 
Status
Not open for further replies.
Top