Hi! Help me with making this trigger ability...

Status
Not open for further replies.
Level 2
Joined
Oct 18, 2022
Messages
5
Hi! I`ve spent too much time of trying to make it work. I just dont know what`s exactly wrong. The point of this ability is a trap - unit A casting an ability (placing a trap), then, when unit B falls into that trap, unit A can attack him from double of its normal attack range and deal a bonus damage (aka Caitlyn yordle traps xd). Here what i made, please, tell, where is (are) a mistake(s)... T.T
  • Snipe
    • СобытиÑ
      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - A unit Приводит ÑпоÑобноÑÑ‚ÑŒ в дейÑтвие
    • УÑловиÑ
      • (Unit-type of (Triggering unit)) равно Следователь
      • (Ability being cast) равно Ловушка "Ðрбитр"
    • ДейÑтвиÑ
      • ОтрÑд - Add (Triggering unit) to GroupX[1]
      • Set Point[1] = (Target point of ability being cast)
      • Set Region[1] = (Region centered at Point[1] with size (50.00, 50.00))
      • Триггер - Add to (This trigger) the event (Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - A unit enters Region[1])
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • ЕÑли - УÑловиÑ
          • (Owner of (Entering unit)) не равно Игрок 1 (краÑный)
        • То - ДейÑтвиÑ
          • ОтрÑд - Pick every unit in GroupX[1] and do (Actions)
            • Цикл - ДейÑтвиÑ
              • Ð¥Ñш-таблица - Save Handle Of(Entering unit) as (Key target) of (Key (Picked unit)) in (Last created hashtable)
              • СпецÑффект - Create a special effect attached to the left.hand of (Picked unit) using Abilities\Spells\Other\Incinerate\IncinerateBuff.mdl
          • Триггер - Add to (This trigger) the event (Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - A unit Отдал приказ (цель - объект))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • ЕÑли - УÑловиÑ
              • (Unit-type of (Triggering unit)) не равно Следователь
              • ((Issued order) не равно (Order(attack))) or ((Issued order) не равно (Order(smart)))
            • То - ДейÑтвиÑ
              • Do nothing
            • Иначе - ДейÑтвиÑ
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • ЕÑли - УÑловиÑ
                  • (Target unit of issued order) не равно (Load (Key target) of (Key (Picked unit)) in (Last created hashtable))
                • То - ДейÑтвиÑ
                  • Do nothing
                • Иначе - ДейÑтвиÑ
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • ЕÑли - УÑловиÑ
                      • (Region[1] contains (Load (Key target) of (Key (Picked unit)) in (Last created hashtable))) равно Да
                      • ((Load (Key target) of (Key (Picked unit)) in (Last created hashtable)) is alive) равно Да
                    • То - ДейÑтвиÑ
                      • Wait until ((Distance between (Position of (Triggering unit)) and (Position of (Target unit of issued order))) меньше или равно 1300.00), checking every 0.10 seconds
                      • СпецÑффект - Destroy (Last created special effect)
                      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - Turn collision for (Triggering unit) Откл.
                      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - Set (Triggering unit) acquisition range to 1300.00
                      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - Cause (Triggering unit) to damage (Target unit of issued order), dealing 60.00 damage of attack type Дальний бой and damage type Обычный
                      • ÐÐ½Ð¸Ð¼Ð°Ñ†Ð¸Ñ - Play (Triggering unit)'s attack 1 animation
                      • СпецÑффект - Create a special effect attached to the overhead of (Target unit of issued order) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodFootman.mdl
                      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - Set (Triggering unit) acquisition range to 650.00
                      • Ð‘Ð¾ÐµÐ²Ð°Ñ ÐµÐ´Ð¸Ð½Ð¸Ñ†Ð° - Turn collision for (Triggering unit) Вкл.
                      • ОтрÑд - Remove (Triggering unit) from GroupX[1]
                      • Ð¥Ñш-таблица - Clear all child hashtables of child (Key (Picked unit)) in (Last created hashtable)
                      • Custom script: call RemoveLocation(udg_Point[1])
                      • Custom script: call RemoveRect(udg_Region[1])
                    • Иначе - ДейÑтвиÑ
                      • СпецÑффект - Destroy (Last created special effect)
                      • ОтрÑд - Remove (Picked unit) from GroupX[1]
                      • Ð¥Ñш-таблица - Clear all child hashtables of child (Key (Picked unit)) in (Last created hashtable)
                      • Custom script: call RemoveLocation(udg_Point[1])
                      • Custom script: call RemoveRect(udg_Region[1])
        • Иначе - ДейÑтвиÑ
          • Do nothing
P.S. I did create a trigger with a variable hashtable. I tried many things but i still dont understand what`s wrong.
 
Last edited:
Level 2
Joined
Oct 18, 2022
Messages
5
i dont exactly understand how to put trigger in thread so im sorry for this amount of strange symbols. if u know how to do it properly, please, let me know and i will fix it.
 

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,195

It looks like you're making a lot of mistakes by trying to contain everything in a single trigger. It's pretty hard to understand the trigger though.

This type of spell would probably use at least 4 triggers, one for creating the trap, one for activating the trap, one for tracking the state of enemies that stepped on the traps, and one to increase Caitlyn's attack range/damage when Attacking a trapped enemy.
 
Level 2
Joined
Oct 18, 2022
Messages
5

It looks like you're making a lot of mistakes by trying to contain everything in a single trigger. It's pretty hard to understand the trigger though.

This type of spell would probably use at least 4 triggers, one for creating the trap, one for activating the trap, one for tracking the state of enemies that stepped on the traps, and one to increase Caitlyn's attack range/damage when Attacking a trapped enemy.

Thank you for sending me that topic! Anyways, i just realised, that s because of my editor language and i can`t change it just now.

Yeah, i tried to do this with more then a single trigger, but then I cant set a custom value of new triggers` event///

So if i want to set a point value in one trigger i cant use it in event of next one... (exaple: i set a variable "Region [1]" as a trap placement, so i can make a new event for this trigger: "when unit enters Region [1]'' but i cant do the same with more then one trigger).
 

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,195
Here's a somewhat working example of the spell. The Attack Range stuff is rather buggy and I left out the bonus damage but that could be added via an Ability or using a Damage Engine. It uses Bribe's Unit Indexer instead of a Hashtable in order to store data to the units. Also, the map was created on the latest patch so keep that in mind if you're on an older version.
  • YT Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Yordle Trap
    • Actions
      • Set VariableSet YT_Point = (Target point of ability being cast)
      • Unit - Create 1 Yordle Trap for (Owner of (Triggering unit)) at YT_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_YT_Point)
      • Set VariableSet YT_Unit = (Last created unit)
      • Set VariableSet YT_Hero[(Custom value of YT_Unit)] = (Triggering unit)
      • Unit Group - Add YT_Unit to YT_TrapGroup
      • Trigger - Turn on YT Trap Loop <gen>
  • YT Trap Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in YT_TrapGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet YT_Unit = (Picked unit)
          • Set VariableSet YT_Point = (Position of YT_Unit)
          • Set VariableSet YT_TempGroup = (Units within 100.00 of YT_Point.)
          • Custom script: call RemoveLocation(udg_YT_Point)
          • Unit Group - Pick every unit in YT_TempGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of YT_Unit).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set VariableSet YT_CV = (Custom value of (Picked unit))
                  • Set VariableSet YT_Hero[YT_CV] = YT_Hero[(Custom value of YT_Unit)]
                  • Set VariableSet YT_Duration[YT_CV] = 3.00
                  • Unit Group - Add (Picked unit) to YT_TrappedGroup
                  • Trigger - Turn on YT Trapped Loop <gen>
                  • Unit - Order YT_Unit to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
                  • Unit - Kill YT_Unit
                  • Custom script: call DestroyGroup(udg_YT_TempGroup)
                  • Custom script: return
                • Else - Actions
          • Custom script: call DestroyGroup(udg_YT_TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in YT_TrapGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • YT Trapped Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in YT_TrappedGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet YT_Unit = (Picked unit)
          • Set VariableSet YT_CV = (Custom value of YT_Unit)
          • Set VariableSet YT_Duration[YT_CV] = (YT_Duration[YT_CV] - 0.05)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • YT_Duration[YT_CV] Less than or equal to 0.01
            • Then - Actions
              • Set VariableSet YT_Hero[YT_CV] = No unit
              • Unit Group - Remove YT_Unit from YT_TrappedGroup.
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in YT_TrappedGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • YT Attack Order
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Level of Yordle Trap for (Ordered unit)) Greater than 0
    • Actions
      • Set VariableSet YT_Unit = (Ordered unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • YT_Unit Equal to YT_Hero[(Custom value of (Target unit of issued order))]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Less than 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 2000.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 1500.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: 1500.00
              • Game - Display to (All players) for 1.00 seconds the text: Add Range
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Greater than or equal to 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 600.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: -500.00
              • Game - Display to (All players) for 1.00 seconds the text: !
            • Else - Actions
  • YT Attack Auto
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Yordle Trap for (Attacking unit)) Greater than 0
    • Actions
      • Set VariableSet YT_Unit = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • YT_Unit Equal to YT_Hero[(Custom value of (Attacked unit))]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Less than 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 2000.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 1500.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: 1500.00
              • Game - Display to (All players) for 1.00 seconds the text: Add Range
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Greater than or equal to 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 600.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: -500.00
              • Game - Display to (All players) for 1.00 seconds the text: !
            • Else - Actions
Some other notes:
It uses Unit Groups to track the Trap and the Trapped units.
It uses a Unit Indexer to link the Trap to Caitlyn which is then referenced in order to link the Trapped enemy to Caitlyn.
It uses Orders/Autoattacks to add/remove the bonus Attack Range.
It's completely MUI so you can give this ability to as many units as you want and it will still work without issues.
I left out the true sight component and made the traps last forever with no limit. But those additions could be added somewhat easily.
 

Attachments

  • Yordle Trap 1.w3m
    26.6 KB · Views: 2
Last edited:
Level 2
Joined
Oct 18, 2022
Messages
5
Here's a somewhat working example of the spell. The Attack Range stuff is rather buggy and I left out the bonus damage but that could be added via an Ability or using a Damage Engine. It uses Bribe's Unit Indexer instead of a Hashtable in order to store data to the units. Also, the map was created on the latest patch so keep that in mind if you're on an older version.
  • YT Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Yordle Trap
    • Actions
      • Set VariableSet YT_Point = (Target point of ability being cast)
      • Unit - Create 1 Yordle Trap for (Owner of (Triggering unit)) at YT_Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_YT_Point)
      • Set VariableSet YT_Unit = (Last created unit)
      • Set VariableSet YT_Hero[(Custom value of YT_Unit)] = (Triggering unit)
      • Unit Group - Add YT_Unit to YT_TrapGroup
      • Trigger - Turn on YT Trap Loop <gen>
  • YT Trap Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in YT_TrapGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet YT_Unit = (Picked unit)
          • Set VariableSet YT_Point = (Position of YT_Unit)
          • Set VariableSet YT_TempGroup = (Units within 100.00 of YT_Point.)
          • Custom script: call RemoveLocation(udg_YT_Point)
          • Unit Group - Pick every unit in YT_TempGroup and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) belongs to an enemy of (Owner of YT_Unit).) Equal to True
                  • ((Picked unit) is alive) Equal to True
                • Then - Actions
                  • Set VariableSet YT_CV = (Custom value of (Picked unit))
                  • Set VariableSet YT_Hero[YT_CV] = YT_Hero[(Custom value of YT_Unit)]
                  • Set VariableSet YT_Duration[YT_CV] = 3.00
                  • Unit Group - Add (Picked unit) to YT_TrappedGroup
                  • Trigger - Turn on YT Trapped Loop <gen>
                  • Unit - Order YT_Unit to Night Elf Keeper Of The Grove - Entangling Roots (Picked unit)
                  • Unit - Kill YT_Unit
                  • Custom script: call DestroyGroup(udg_YT_TempGroup)
                  • Custom script: return
                • Else - Actions
          • Custom script: call DestroyGroup(udg_YT_TempGroup)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in YT_TrapGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • YT Trapped Loop
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in YT_TrappedGroup and do (Actions)
        • Loop - Actions
          • Set VariableSet YT_Unit = (Picked unit)
          • Set VariableSet YT_CV = (Custom value of YT_Unit)
          • Set VariableSet YT_Duration[YT_CV] = (YT_Duration[YT_CV] - 0.05)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • YT_Duration[YT_CV] Less than or equal to 0.01
            • Then - Actions
              • Set VariableSet YT_Hero[YT_CV] = No unit
              • Unit Group - Remove YT_Unit from YT_TrappedGroup.
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in YT_TrappedGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
  • YT Attack Order
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Level of Yordle Trap for (Ordered unit)) Greater than 0
    • Actions
      • Set VariableSet YT_Unit = (Ordered unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • YT_Unit Equal to YT_Hero[(Custom value of (Target unit of issued order))]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Less than 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 2000.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 1500.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: 1500.00
              • Game - Display to (All players) for 1.00 seconds the text: Add Range
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Greater than or equal to 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 600.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: -500.00
              • Game - Display to (All players) for 1.00 seconds the text: !
            • Else - Actions
  • YT Attack Auto
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Yordle Trap for (Attacking unit)) Greater than 0
    • Actions
      • Set VariableSet YT_Unit = (Attacking unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • YT_Unit Equal to YT_Hero[(Custom value of (Attacked unit))]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Less than 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 2000.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:0 to Value: 1500.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: 1500.00
              • Game - Display to (All players) for 1.00 seconds the text: Add Range
            • Else - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current acquisition range of YT_Unit) Greater than or equal to 1999.00
            • Then - Actions
              • Unit - Set YT_Unit acquisition range to 600.00
              • Unit - Set Unit: YT_Unit's Weapon Real Field: Attack Range ('ua1m')at Index:1 to Value: -500.00
              • Game - Display to (All players) for 1.00 seconds the text: !
            • Else - Actions
Some other notes:
It uses Unit Groups to track the Trap and the Trapped units.
It uses a Unit Indexer to link the Trap to Caitlyn which is then referenced in order to link the Trapped enemy to Caitlyn.
It uses Orders/Autoattacks to add/remove the bonus Attack Range.
It's completely MUI so you can give this ability to as many units as you want and it will still work without issues.
I left out the true sight component and made the traps last forever with no limit. But those additions could be added somewhat easily.

OMG!!!!!! TY so much, u did even more than i can imagine lol! i ll check it a litlle bit later cuz now i feel sick, but anyways you are my hero fr!!!
Much love <3
 
Status
Not open for further replies.
Top