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

[Trigger] Ability Dummy Not Casting Skill

Status
Not open for further replies.
So I have made 3 spells, which are all based on 1 "system - basically when they get cast, a dummy has to get created and has to cast a missile (storm bolt) at a nearby, random enemy target.

The first ability is Dance of Death:

  • Dance of Death Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Dance of Death (Artesia)
    • Actions
      • Set DanceOfDeath_Caster = (Triggering unit)
      • Countdown Timer - Start DanceOfDeath_Timer as a Repeating timer that will expire in 10.00 seconds
      • Wait 12.00 seconds
      • Countdown Timer - Pause DanceOfDeath_Timer
  • Dance of Death Cast
    • Events
      • Time - DanceOfDeath_Timer expires
    • Conditions
    • Actions
      • Unit - Set life of DanceOfDeath_Caster to ((Life of DanceOfDeath_Caster) + (200.00 x (Real((Level of Dance of Death (Artesia) for DanceOfDeath_Caster)))))
      • Set DanceOfDeath_Point = (Position of DanceOfDeath_Caster)
      • Unit - Create 1 Arcane Bolt Dummy for (Owner of DanceOfDeath_Caster) at DanceOfDeath_Point facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Set DanceOfDeath_Dummy = (Last created unit)
      • Unit - Set level of Arcane Bolt (Artesia) for DanceOfDeath_Dummy to (Level of Dance of Death (Artesia) for DanceOfDeath_Caster)
      • Unit Group - Pick every unit in (Random 1 units from (Units within 1200.00 of DanceOfDeath_Point matching (((Matching unit) belongs to an enemy of (Owner of DanceOfDeath_Caster)) Equal to True))) and do (Actions)
        • Loop - Actions
          • Unit - Order DanceOfDeath_Dummy to Human Mountain King - Storm Bolt (Picked unit)
      • Custom script: call RemoveLocation(udg_DanceOfDeath_Point)
It's a channeled spell based on Big Bad Voodoo, which has to summon a dummy per second which casts the missile at a nearby enemy unit. And it's based on a repeatable timer which expires every 1s. The problem is that the unit starts casting and only sometimes, only when done casting Dance of Death the dummy gets created and you can see it for 2 seconds, but the dummy doesn't cast his spell at an enemy target.

The 2 other ones are also in the map, they basically use the same actions, just not a timer and they're not channeling.
(Arcane Missile does work, but only randomly and not always)
 

Attachments

  • The Destructor.w3x
    297.2 KB · Views: 94
^Yes! That's correct.
You aren't filtering out dead units and magic immune units.

The wait is perfectly fine if you don't need the spell to be MUI and you don't need the timer interval to be less than 0.25 (Waits add +0.25, +0.125, or +0.1 seconds to the given wait time)
If the map is multiplayer, remove the wait.

You could create two timers.
One will execute the trigger (the repeating timer) and the other will expire after xx seconds to pause the first.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
You should also check if the enemy unit is visible to the caster.

A bit random, but I couldn't resist:
  • Unit Group - Pick every unit in (Random 1 units from (Units within 1200.00 of DanceOfDeath_Point matching (((Matching unit) belongs to an enemy of (Owner of DanceOfDeath_Caster)) Equal to True)))
This is a pretty terrible way to do this since you're only doing it for one random unit from the group. This is how you should do it:
  • Set TargetUnit= (Random unit from Group)
For Arcane Missile, you should be changing the number "N" (Random N units from etc..) to be based on the level instead of repeating the code.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Unfortunately, GUI is idiotic.
JASS:
function GroupPickRandomUnit takes group whichGroup returns unit
    // If the user wants the group destroyed, remember that fact and clear
    // the flag, in case it is used again in the callback.
    local boolean wantDestroy = bj_wantDestroyGroup
    set bj_wantDestroyGroup = false

    set bj_groupRandomConsidered = 0
    set bj_groupRandomCurrentPick = null
    call ForGroup(whichGroup, function GroupPickRandomUnitEnum)

    // If the user wants the group destroyed, do so now.
    if (wantDestroy) then
        call DestroyGroup(whichGroup)
    endif
    return bj_groupRandomCurrentPick
endfunction
That would screw up with the enumeration. You have to use a global group variable to get rid of the leak.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
well, MUI spell makers should not make non-MUI even how simple a spell can be...
anway instead of random 1, you could use a global integer to filter the randomness...
  • Set randomINT = 0
  • Set DanceOfDeath_Point = (Position of DanceOfDeath_Caster)
  • Unit Group - Pick every unit in units from (Units within 1200.00 of DanceOfDeath_Point matching (((Matching unit blahhhhh) and randomINT less than 1
    • Set randomINT = Set randomINT + 1
    • Unit - Set life of DanceOfDeath_Caster to ((Life of DanceOfDeath_Caster) + (200.00 x (Real((Level of Dance of Death (Artesia) for DanceOfDeath_Caster)))))
    • Unit - Create 1 Arcane Bolt Dummy for (Owner of DanceOfDeath_Caster) at DanceOfDeath_Point facing Default building facing degrees
    • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
    • Set DanceOfDeath_Dummy = (Last created unit)
    • Unit - Set level of Arcane Bolt (Artesia) for DanceOfDeath_Dummy to (Level of Dance of Death (Artesia) for DanceOfDeath_Caster)
    • Unit - Order DanceOfDeath_Dummy to Human Mountain King - Storm Bolt (Picked unit)
 
Shit- didn't notice that "Set randomINT = 0" line in your trigger.
Well, I guess it's natural for me, I haven't slept all night.

edit
And about the "setting to 1", it's an optimization for a special case >:D
I always do these kinds of optimizations. It's much easier to maintain the code AND do optimizations like this in vJass though ;p
 
You should also check if the enemy unit is visible to the caster.

A bit random, but I couldn't resist:
  • Unit Group - Pick every unit in (Random 1 units from (Units within 1200.00 of DanceOfDeath_Point matching (((Matching unit) belongs to an enemy of (Owner of DanceOfDeath_Caster)) Equal to True)))
This is a pretty terrible way to do this since you're only doing it for one random unit from the group. This is how you should do it:
  • Set TargetUnit= (Random unit from Group)
For Arcane Missile, you should be changing the number "N" (Random N units from etc..) to be based on the level instead of repeating the code.
Yeah but will the process be repeated by the same dummy after having cast the ability on 1? :eek:¨

edit: Yay solved! =) Thanks guys.
 
Last edited:
Status
Not open for further replies.
Top