• 🏆 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] What's wrong with this simple trigger?

Status
Not open for further replies.
Level 21
Joined
May 29, 2013
Messages
1,567
I'm trying to make a Hero ability that creates 1/2/3 illusions of the targeted friendly unit.

The ability is based on the wand of illusion item ability, but since I want more that one illusion I have to use dummy casters for levels 2 and 3.

Can anyone tell me why this trigger creates only one additional illusion at level 3 instead of creating two additional illusion?

  • Replicate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Replicate
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Replicate for (Triggering unit)) Equal to 1
        • Then - Actions
          • -------- Do Nothing --------
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Replicate for (Triggering unit)) Equal to 2
            • Then - Actions
              • Set Replicate_Loc = (Position of (Target unit of ability being cast))
              • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Replicate_Loc facing Default building facing degrees
              • Unit - Add Replicate (Dummy) to (Last created unit)
              • Unit - Set level of Replicate (Dummy) for (Last created unit) to 2
              • Custom script: call IssueTargetOrderById( GetLastCreatedUnit(), 852274, GetSpellTargetUnit() )
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_Replicate_Loc)
            • Else - Actions
              • Set Replicate_Loc = (Position of (Target unit of ability being cast))
              • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Replicate_Loc facing Default building facing degrees
              • Unit - Add Replicate (Dummy) to (Last created unit)
              • Unit - Set level of Replicate (Dummy) for (Last created unit) to 3
              • Custom script: call IssueTargetOrderById( GetLastCreatedUnit(), 852274, GetSpellTargetUnit() )
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Replicate_Loc facing Default building facing degrees
              • Unit - Add Replicate (Dummy) to (Last created unit)
              • Unit - Set level of Replicate (Dummy) for (Last created unit) to 3
              • Custom script: call IssueTargetOrderById( GetLastCreatedUnit(), 852274, GetSpellTargetUnit() )
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Custom script: call RemoveLocation(udg_Replicate_Loc)
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
The issue is that you're referencing "GetSpellTargetUnit()". This is lost after the first cast, I guess because the Dummy casting the ability changes it. Use variables to track the Dummy/Target and it'll work fine.

Here's a working trigger that's a bit more optimized. I'm using an ability based on Channel as the Ability being cast:
  • Illusion Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Replicate (Hero)
    • Actions
      • Set VariableSet TempPoint = (Position of (Target unit of ability being cast))
      • Set VariableSet TempTarget = (Target unit of ability being cast)
      • Set VariableSet Level = (Level of (Ability being cast) for (Triggering unit))
      • -------- --------
      • Unit - Create 1 Dummy for (Triggering player) at TempPoint facing Default building facing degrees
      • Set VariableSet Dummy = (Last created unit)
      • Unit - Add Replicate (Illusions) to Dummy
      • Unit - Set level of Replicate (Illusions) for Dummy to Level
      • Unit - Add a 1.00 second Generic expiration timer to Dummy
      • -------- --------
      • For each (Integer A) from 1 to Level, do (Actions)
        • Loop - Actions
          • Custom script: call IssueTargetOrderById( udg_Dummy, 852274, udg_TempTarget )
      • -------- --------
      • Custom script: call RemoveLocation (udg_TempPoint)
You don't need to use more than 1 Dummy unit. A properly setup Dummy can cast a 0 second cd ability as many times as you want.
 

Attachments

  • Illusion Example.w3m
    18.2 KB · Views: 21
Last edited:
Level 21
Joined
May 29, 2013
Messages
1,567
The issue is that you're referencing "GetSpellTargetUnit()". This is lost after the first cast, I guess because the Dummy casting the ability changes it. Use variables to track the Dummy/Target and it'll work fine.

Here's a working trigger that's a bit more optimized.
Thank you; it works now. However, I got a "Level Info data missing or invalid" error when I tried to open your map.
I'm using an ability based on Channel as the Ability being cast:
I'll use Frost Armor or something else instead of Channel because I want the AI to know when to use it.
You don't need to use more than 1 Dummy unit. A properly setup Dummy can cast a 0 second cd ability as many times as you want.
I didn't know that; thanks for the info!
 
Status
Not open for further replies.
Top