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

Make unit ignore orders

Status
Not open for further replies.
Level 5
Joined
Feb 8, 2015
Messages
93
Hello Hive!

I'm trying to make an ability somewhat reminiscent of Sea Witch's Tornado - but slightly changed...

The ability spawns a Firelord which launches projectiles at random like a volcano (I use temporary catapult units for that). As long as the caster channels

The catapult bit works fairly well, although somewhat awkwardly, but my true problems are these:

1. Is there a smart way to detect when a unit is channeling the ability? So that I can stop the trigger in case of stuns/etc. (The ability is based off of "Channel" btw)
2. I want the Firelord to be moveable through simple move/attack orders, so when the caster is "issused order targeting point/unit" that order is ignored, and the Firelord moves instead

I already have the Firelord moving alright, but the caster still follows orders, can I make him ignore all these while channeling?
The trigger is 4-fold, though it could be done in less, I think it looks more manageable like this...

  • World Breaker Initiate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Firelord Assault Dummy
    • Actions
      • -------- Init setup --------
      • Set WB_Caster = (Triggering unit)
      • Set WB_CasterLoc = (Position of WB_Caster)
      • Unit - Set WB_Caster movement speed to 0.00
      • Set WB_MovP = (Target point of ability being cast)
      • Set WB_Tempi1 = (Level of Firelord Assault Dummy for WB_Caster)
      • -------- Creating the Dummy --------
      • Set WB_Tempp1 = (Target point of ability being cast)
      • Unit - Create 1 Firelord Dummy for (Owner of WB_Caster) at WB_Tempp1 facing Default building facing degrees
      • Set WB_Dummy = (Last created unit)
      • -------- Lightning Effect --------
      • Lightning - Create a Finger of Death lightning effect from source WB_CasterLoc to target WB_Tempp1
      • -------- Turns on the Loop Triggers --------
      • Trigger - Turn on World Breaker FireLoop <gen>
      • Trigger - Turn on World Breaker MoveLoop <gen>
  • World Breaker FireLoop
    • Events
      • Time - Every 0.33 seconds of game time
    • Conditions
    • Actions
      • -------- Init setup --------
      • Set WB_ang1 = (Random angle)
      • Set WB_Tempr1 = (Random real number between 25.00 and (325.00 + (25.00 x (Real(WB_Tempi1)))))
      • Set WB_Aimp = (WB_Tempp1 offset by WB_Tempr1 towards WB_ang1 degrees)
      • -------- Runs the catapults --------
      • Unit - Create 1 Catapult Fire (Dummy) for (Owner of WB_Caster) at WB_Tempp1 facing WB_ang1 degrees
      • Set WB_Tempu = (Last created unit)
      • Unit - Order WB_Tempu to Attack Ground WB_Aimp
      • Unit - Add a 0.34 second Generic expiration timer to WB_Tempu
      • -------- Dummy aesthetics --------
      • Unit - Make WB_Dummy face WB_ang1 over 0.15 seconds
      • Animation - Play WB_Dummy's cast animation
  • World Breaker MoveLoop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Set WB_Tempp1 = (Position of WB_Dummy)
      • Set WB_ang2 = (Angle from WB_Tempp1 to WB_MovP)
      • Set WB_Tempp2 = (WB_Tempp1 offset by 5.00 towards WB_ang2 degrees)
      • -------- Moves dummy --------
      • Custom script: call SetUnitX((udg_WB_Dummy), GetLocationX(udg_WB_Tempp2))
      • Custom script: call SetUnitY((udg_WB_Dummy), GetLocationY(udg_WB_Tempp2))
      • -------- Moves the Lightning effect --------
      • Lightning - Move WB_Lightning to source WB_CasterLoc and target WB_Tempp1
      • -------- Cleanup --------
      • Custom script: call RemoveLocation(udg_WB_Tempp2)
  • World Breaker Reposition
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Triggering unit) Equal to WB_Caster
    • Actions
      • -------- Prevents the caster from interrupting himself --------
      • Trigger - Turn off (This trigger)
      • Unit - Order WB_Caster to Neutral Fire Lord - Volcano WB_Tempp1
      • Trigger - Turn on (This trigger)
      • -------- See "MoveLoop" for repositioning --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Equal to (Order(patrol))
              • (Issued order) Equal to (Order(attack))
        • Then - Actions
          • Set WB_MovP = (Position of (Target unit of issued order))
          • Game - Display to (All players) the text: Target unit
        • Else - Actions
          • Set WB_MovP = (Target point of issued order)
          • Game - Display to (All players) the text: Target point


Spell name is World Breaker

Init trigger = initial settings for the cast. The spell does NOT have to be MUI
FireLoop = the loop responsible for firing the projectiles
MoveLoop = the trigger supposed to let the Firelord Slide when the Caster/Channeler is being issued an order
Reposition = the trigger supposed to make the caster ignore orders, while allowing the Firelord to be redirected instead.

The reason why I don't just let the Firelord be controlled through being a clickable-unit is because it's a rather large, scary model, and I want to use Locust on it to prevent it from being the only thing people can click (it's a player vs. player strategy map)
 
Level 12
Joined
Jan 2, 2016
Messages
973
Well, you could make a dummy channel the spell, and just pause the lord (make him play "spell" animation).
But this way - if the lord is stunned - the dummy will keep chanelling the ability.
I guess you could do a periodic check (each 0.25 seconds) if the lord has buff "stunned", and if he has - remove the dummy.
Or even better (if you have a DDS), when the lord takes damage, check if he has buff "stunned".
 
Level 18
Joined
Nov 21, 2012
Messages
835
Is there a smart way to detect when a unit is channeling the ability?
1. install UnitIndexer by Bribe
2. create 2 global variables boolean array named for example IsChanneling
3. create trigger with event 'unit begins channeling an ability' add in actions
set IsChanneling[CustomValueof (SpellAbilityUnit())] = true
4. create trigger with event 'unit stops casting an ability' add in actions
set IsChanneling[CustomValueof (SpellAbilityUnit())] = false

now if you want to check if any unit is channeling just check this boolean IsChanneling[custom value of given unit]

I want the Firelord to be moveable through simple move/attack orders, so when the caster is "issused order targeting point/unit" that order is ignored, and the Firelord moves instead

maybe use this:
in object editor/Abilities Data-disable other abilities set to true, so caster cant move while channeling and not recieving orders. (Unfortunately player wont be able to stop casting the spell if he wants.)
You can create Firelord unit , select him to player, add invunerable, Firelord will be moveable. You can add expiration timer also and kill firelord and select Hero for player when spell ends/interrupted. Detect this by using 'unit stops casting an ability' , condition: ability-->your ability. It's fires when spell ends normally and when caster is stunned for example.

zibi
 
Status
Not open for further replies.
Top