• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

After Changing Ownership

With this Ability I've been working on, after my unit is changed its ownership, nothing else happens even though I set Generic expiration timer, Order to move, Play Animation and Unit Remove. How do I fix it, guys?

Config:

  • RetirementConfig
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Retire_Ability = Retirement

Action:​

  • Retirement
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Retire_Ability
    • Actions
      • Set VariableSet Retire_Caster = (Triggering unit)
      • Set VariableSet Retire_Caster_Loc = (Position of Retire_Caster)
      • Set VariableSet Retire_CastTarget = (Target unit of ability being cast)
      • Unit - Change ownership of Retire_CastTarget to Neutral Passive and Change color
      • Set VariableSet Retire_Retired = (Ownership-changed unit)
      • Set VariableSet Retire_Retired_Loc = (Position of Retire_Retired)
      • Unit - Add a 3.00 second Generic expiration timer to Retire_Retired
      • Animation - Play Retire_Retired's walk animation
      • Unit - Order Retire_Retired to Move To Retire_Caster_Loc
      • Unit - Remove Retire_Retired from the game
      • Set VariableSet Retire_Retired = No unit
      • Set VariableSet Retire_Caster = No unit
 
Last edited:
This can't work, because the event does not attribute an ownership-changed unit.
Retire_Retired should be target unit of ability being cast instead, or Retire_CastTarget.
 
This can't work, because the event does not attribute an ownership-changed unit.
Retire_Retired should be target unit of ability being cast instead, or Retire_CastTarget.
You are right, I changed it and it works.
But is there any alternative way for "Wait"? I read somewhere on this HIVE that using "Wait" is not safe.

  • Retirement
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Retire_Ability
    • Actions
      • -------- Var - Original --------
      • Set VariableSet Retire_Caster = (Triggering unit)
      • Set VariableSet Retire_Caster_Loc = (Position of Retire_Caster)
      • Set VariableSet Retire_CastTarget = (Target unit of ability being cast)
      • -------- - --------
      • -------- VFX --------
      • Special Effect - Create a special effect attached to the origin of Retire_CastTarget using war3mapImported\Teleport.mdx
      • Special Effect - Destroy (Last created special effect)
      • -------- - --------
      • -------- Heal --------
      • Unit - Set life of Retire_CastTarget to ((Life of Retire_CastTarget) + 9999.00)
      • -------- - --------
      • -------- Changing Ownership --------
      • Unit - Change ownership of Retire_CastTarget to Neutral Passive and Change color
      • -------- - --------
      • -------- Var - Ownership Changed Unit --------
      • Set VariableSet Retire_Retired = (Target unit of ability being cast)
      • Set VariableSet Retire_Retired_Loc = (Position of Retire_Retired)
      • -------- - --------
      • -------- Animation --------
      • Unit - Order Retire_Retired to Move To Retire_Caster_Loc
      • -------- - --------
      • -------- Wait --------
      • Wait 1.50 game-time seconds
      • -------- - --------
      • -------- Remove --------
      • Unit - Remove Retire_CastTarget from the game
      • Unit - Remove Retire_Retired from the game
      • Set VariableSet Retire_Retired = No unit
      • Set VariableSet Retire_Caster = No unit
      • Set VariableSet Retire_CastTarget = No unit
      • -------- - --------
 
You should be able to get away with an expiration timer here.
No need to clear the variables, as everything happens in an instant - it seems to me.
Just Retire_Caster_Loc leaks, thus needs to be cleared with custom script: "call RemoveLocation(udg_Retire_Caster_Loc)" after use.

You could get into indexing for more-precise and more-in-control systems - it's more work, but you have a lot of control.
Or local udg_ to get away with locals and waits for relatively simple stuff.
 
You should be able to get away with an expiration timer here.
No need to clear the variables, as everything happens in an instant - it seems to me.
Just Retire_Caster_Loc leaks, thus needs to be cleared with custom script: "call RemoveLocation(udg_Retire_Caster_Loc)" after use.

You could get into indexing for more-precise and more-in-control systems - it's more work, but you have a lot of control.
Or local udg_ to get away with locals and waits for relatively simple stuff.
Thanks bro,

But I tried Expiration Timer before, it makes units DIE before being disappeared and leave behind blood splashes + sound!

About the leaks, I'll try your custom script ASAP.

Is there any post in the HIVE where I can learn about "indexing for more-precise and more-in-control systems"? - I'm very amateur in building triggers.
 
Dynamic Indexing would work, and is often the best solution, but it could be problematic for non-stacking effects like these. This type of trigger is meant to only ever have 1 instance per unit, meaning an additional cast on the same target should overwrite any previous casts on that unit. This is how most Warcraft 3 abilities work, ie: You cast Bloodlust on a unit and it gains the buff for 30 seconds. You cast Bloodlust on that unit again and it replaces the previous buff, "refreshing" the effects of the ability. Dynamic Indexing may not be an ideal solution here since it would stack the effects, allowing 2+ instances running on the same unit at the same time.

Unit Indexing would be better in this specific case since it enforces this non-stacking behavior by default. This is because it utilizes Array variables where each Index can only hold one value at a time. Then each Index would represent a single Unit.

But if you want to keep it as simple as possible...
You can detect whenever a "retired" unit dies and remove it from the game in response. This will override most death related effects:
  • Events
    • Unit - A unit Dies
  • Conditions
    • Level of Retired (Classification) for (Triggering unit) Greater than 0
  • Actions
    • Unit - Remove (Triggering unit) from the game
  • Unit - Add Retired (Classification) to Retire_CastTarget
Retired (Classification) is a hidden ability that you would Add to the Retire_CastTarget. Storm Hammers comes to mind.
This is how you can mark and find the unit later on.

I would also add a Condition to prevent multiple retirings on the same unit:
  • Conditions
    • (Ability being cast) Equal to Retire_Ability
    • Level of Retired (Classification) for (Target unit of ability being cast) Equal to 0
This could actually solve the Dynamic Indexing problem as well since it'd prevent multiple casts on the same target. Keep in mind that the ability would still cast and spend mana, go on cooldown, etc..

Notes:
1. You could use an Ability that has Art to visualize the effect. So instead of Storm Hammers you could use something that supports the Art - Target field.
2. You could use a Unit Indexer instead of an Ability and contain everything within the Trigger Editor.
3. You could use a Hashtable instead of an Ability/Unit Indexer. A bit overkill in my opinion and they're more awkward to work with.
 
Last edited:
Back
Top