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

[Solved] Help with ability trigger

Status
Not open for further replies.
Level 4
Joined
Dec 3, 2012
Messages
51
Hi,

I want to make a spell that gives the target unit immolation for a set duration. Its basically lightning shield, but I cant use that because it harms friendly units. What I have so far adds the ability to the target unit, and then removes the ability after a timer expires. My problem is if I cast it on a unit, wait 10 secs and cast it on a second unit, when that first timer expires both units lose the ability. I want it to be an independent timer for each unit (MUI?). Here is what I have so far:

  • Phoenix Immolation
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Phoenix Immolation
    • Actions
      • Set TempReal = 20.00
      • Countdown Timer - Start Timers[(Player number of (Owner of (Dying unit)))] as a One-shot timer that will expire in TempReal seconds
      • Unit - Add Immolation to (Target unit of ability being cast)

  • Phoenix Immolation Timer
    • Events
      • Time - Timers[1] expires
      • Time - Timers[2] expires
      • Time - Timers[3] expires
      • Time - Timers[4] expires
      • Time - Timers[5] expires
      • Time - Timers[6] expires
      • Time - Timers[8] expires
      • Time - Timers[9] expires
      • Time - Timers[10] expires
      • Time - Timers[11] expires
      • Time - Timers[12] expires
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) has buff Permanent Immolation (Neutral Hostile 2)) Equal to True
            • Then - Actions
              • Unit - Remove Immolation from (Picked unit)
            • Else - Actions
              • Do nothing
Any help would be appreciated.

Thanks
 
Level 4
Joined
Dec 3, 2012
Messages
51
The Targets Allowed for lightning shield determines which units be targeted with the spell (for instance if you set to friendly only, then you cannot cast lightning shield on enemy units). However, the shield still damages friendly units. I need a spell that does not, so I am trying to make a trigger that actually gives immolation to a target unit for a limited duration.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Event
-Map initialization
Actions
-Create a hashtable
-set spellHash = last created hashtable

Event
-Unit starts the effect of an abil
Cond
-Ability == x
Actions
-start timer
-save handle of target unit as 0 of last started timer

Event
-timer expires
Actions
-Remove ability from load 0 of Key(expiring timer)
 
Level 4
Joined
Dec 3, 2012
Messages
51
Hi Maker,

I tried this approach, but unfortunately it only removes immolation (the ability that is added) from the unit that the dummy spell was last cast on. For instance, the Lightning Shield is the dummy (reduced damage to 0, different buff), it is then cast on a unit. The target unit receives the ability permanent immolation, when the timer expires (20 seconds), immolation is removed.

However, if I cast lightning shield on 10 units in a row, only the last unit has immolation removed.

Here are the triggers, hopefully the problem is something I did.


  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set spellhash = (Last created hashtable)
      • Set TempReal = 20.00
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield (Neutral Hostile)
    • Actions
      • Countdown Timer - Start Timers[(Player number of (Owner of (Target unit of ability being cast)))] as a One-shot timer that will expire in TempReal seconds
      • Hashtable - Save Handle Of(Target unit of ability being cast) as 0 of (Key (Last started timer)) in (Last created hashtable)
      • Unit - Add Permanent Immolation (Neutral Hostile 2) to (Target unit of ability being cast)
  • Untitled Trigger 003
    • Events
      • Time - Timers[1] expires
    • Conditions
    • Actions
      • Unit - Remove Permanent Immolation (Neutral Hostile 2) from (Load 0 of (Key (Expiring timer)) in spellhash)
Thanks
 
Level 4
Joined
Dec 3, 2012
Messages
51
Check my original trigger, it checked if a unit had the buff and then removed the ability. Actually, you can remove the ability, as Maker's system does not make use of buffs, and still removes the ability (but only last targeted unit, which is the problem). "Permanent" is misleading, I use that since use it since it cant be turned off and does not require mana. My original trigger was able to give the target unit immolation for a set amount of time (20 seconds), and then remove the ability. The problem was that if multiple units were targeted, then they all lose the ability at the same time, instead of in the the order they were targeted.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
The trouble with your trigger was that you used an array for the timers. Each cast would need it's own timer.

Here's a very simple and easy solution:

  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Shield (Neutral Hostile)
    • Actions
      • Custom script : local unit u = GetSpellTargetUnit()
      • Unit - Add Permanent Immolation (Neutral Hostile 2) to (Target unit of ability being cast)
      • Wait 20 seconds
      • Custom script : set udg_unitVariable = u
      • Unit - Remove ability from unitVariable
      • Custom script : set u = null
 
Level 4
Joined
Dec 3, 2012
Messages
51
I don't want to nit pick, but yes Wrda, you can remove permanent immolation from a unit (its permanent because it cant be turned off, but the ability can be removed), as my orignal trigger was able to do (problem was the timer didnt keep track of which unit). If you dont believe me try yourself.


Maker, your trigger works like a charm. I was afraid of using Wait because I heard its not MUI, but I assume the custom script alleviates that. Thanks for fixing this system. (I would give rep but I need to spread some around first).
 

Wrda

Spell Reviewer
Level 28
Joined
Nov 18, 2012
Messages
1,994
I don't want to nit pick, but yes Wrda, you can remove permanent immolation from a unit (its permanent because it cant be turned off, but the ability can be removed), as my orignal trigger was able to do (problem was the timer didnt keep track of which unit). If you dont believe me try yourself.
I don't know what original or standard spell is the "permanent immolation" on your map, but you can't remove it, it will still have effect. I know this because I tested it many years ago.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
I don't want to nit pick, but yes Wrda, you can remove permanent immolation from a unit (its permanent because it cant be turned off, but the ability can be removed), as my orignal trigger was able to do (problem was the timer didnt keep track of which unit). If you dont believe me try yourself.


Maker, your trigger works like a charm. I was afraid of using Wait because I heard its not MUI, but I assume the custom script alleviates that. Thanks for fixing this system. (I would give rep but I need to spread some around first).

Waits are actually MUI if used right. However, if you only use 1 global variable from something, then it can break.
Pseudocode to show why:
set unit = triggering unit
Unit 1 casts ability
Start wait
set unit = triggering unit
Unit 2 casts ability
Start wait
Wait1 ends - unit 2 loses immolation
Wait2 ends - unit 2 loses immolation
 
Level 4
Joined
Dec 3, 2012
Messages
51
Hey, I am trying a modification of the earlier trigger (leaks right now, just want to see if it can work), however, there are errors when I save. What is the proper custom script for this trigger?

Essentially, you target an acolyte, it is killed, and nearby allied units are picked and given the item immolation ability for a set amount of time, after which it is removed.

  • Demonic Flames Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Flames
    • Actions
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
      • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) is an ally of Player 5 (Yellow)) Equal to True
              • ((Picked unit) is A Hero) Equal to False
            • Then - Actions
              • Custom script: local unit u = GetEnumUnit()
              • Unit - Add Immolation to (Picked unit)
              • Wait 20.00 seconds
              • Custom script: set udg_unitVariable = u
              • Unit - Remove Immolation from unitVariable
              • Custom script: set u = null
            • Else - Actions
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Hey, I am trying a modification of the earlier trigger (leaks right now, just want to see if it can work), however, there are errors when I save. What is the proper custom script for this trigger?

Essentially, you target an acolyte, it is killed, and nearby allied units are picked and given the item immolation ability for a set amount of time, after which it is removed.

  • Demonic Flames Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Flames
    • Actions
      • Unit - Cause (Casting unit) to damage (Target unit of ability being cast), dealing 500.00 damage of attack type Spells and damage type Normal
      • Unit Group - Pick every unit in (Units within 512.00 of (Target point of ability being cast)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) is an ally of Player 5 (Yellow)) Equal to True
              • ((Picked unit) is A Hero) Equal to False
            • Then - Actions
              • Custom script: local unit u = GetEnumUnit()
              • Unit - Add Immolation to (Picked unit)
              • Wait 20.00 seconds
              • Custom script: set udg_unitVariable = u
              • Unit - Remove Immolation from unitVariable
              • Custom script: set u = null
            • Else - Actions

The idea is good. I guess the error is with local placement. Put the first custom script inside the loop, but outside the if.
This also requires you to move the last custom script after the if-cycle.
 
Level 4
Joined
Dec 3, 2012
Messages
51
I have tried to get this variation working, but the immolation is not removed. Any ideas?


  • Demonic Flames
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Demonic Flames
    • Actions
      • Set Point = (Target point of ability being cast)
      • Set UnitGroup = (Units within 512.00 of Point)
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Custom script: local unit u = GetEnumUnit()
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Owner of (Picked unit)) is an ally of Player 12 (Brown)) Equal to True
              • ((Picked unit) is A Hero) Equal to False
              • ((Picked unit) is A structure) Equal to False
            • Then - Actions
              • Unit - Add Immolation to (Picked unit)
              • Wait 20.00 seconds
              • Custom script: set udg_unitVariable = u
              • Unit - Remove Immolation from unitVariable
              • Custom script: call RemoveLocation(udg_Point)
              • Custom script: set udg_Point = null
              • Custom script: call DestroyGroup( udg_UnitGroup)
              • Custom script: set udg_UnitGroup = null
            • Else - Actions
          • Custom script: set u = null
 
Status
Not open for further replies.
Top