• 🏆 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] Trying to make a mass Inner Fire spell

Status
Not open for further replies.
Level 7
Joined
Feb 9, 2010
Messages
298
I am trying to make few mass spells for my project and decided to start with the inner fire first - to learn how to make a spell a mass spell first :)

I used this trigger but it doesn't seem to work...
  • Mass Inner Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Inner Fire
    • Actions
      • Set Caster = (Triggering unit)
      • Set Group = (Units within 500.00 of (Position of (Triggering unit)))
      • Set TargetPoint = (Target point of ability being cast)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
      • Unit - Add Mass Inner Fire (Dummy) to (Last created unit)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Order Dummy to Human Priest - Inner Fire (Picked unit)
      • Wait 1.00 seconds
      • Unit - Remove (Last created unit) from the game
      • Custom script: call RemoveLocation(udg_Point)
I used also another trigger before by creating the dummy and casting the spell on random unit in unit group but then it really was only at random units not all of them.

Any suggestions on how to make this trigger work?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You have tons of leaks
1- You're not destroying the group. You need
JASS:
call DestroyGroup(udg_Group)
set udg_Group = null

2- If you set the Point variable inside the loop, you have to destroy it inside the loop.

3- You're leaking "Position of (Triggering Unit)". You can use the same Point variable for that, destroy it, then set it again inside the loop destroying it inside the loop.

4- Replace the "wait" action with "unit - Add expiration timer" to the Dummy.

5- You have to set the Dummy Mass Inner Fire ability level to the level of the ability being cast (if it has more than 1 level)
 
Level 7
Joined
Feb 9, 2010
Messages
298
Hm now it is working in a way but not as a mass spell :/
Here's what I did:
  • Mass Inner Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Inner Fire
    • Actions
      • Set Group = (Units within 500.00 of (Position of (Triggering unit)))
      • Set TargetPoint = (Target point of ability being cast)
      • Set Point = (Position of (Triggering unit))
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at Point facing Default building facing degrees
      • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
      • Unit - Add Mass Inner Fire (Dummy) to (Last created unit)
      • Custom script: call RemoveLocation(udg_Point)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Picked unit))
          • Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
          • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyGroup (udg_Group)
:D yeah I was just thinking about that myself why I don't remove the Caster=TriggeringUnit if I don't use it...

Bean what is the "custom script" you have written for, I don't get it?!
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- Replace "Owner of Triggering Unit" for "Triggering Player"
2- You're creating a single dummy to cast the ability to all the units in the group. If you configure the ability correctly (0 cast time / 0 mana / 0 cooldown) and the Dummy correctly (0 cast backswing) you can manage to have a single dummy to cast the ability on everyone, else, you need to create a Dummy with expiration time inside the unit group loop.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Okay I made some more changes, now it works as a mass spell already. Following Spartipilo's advice on putting the 'Create Dummy' inside the loop.
  • Mass Inner Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Inner Fire
    • Actions
      • Set TargetPoint = (Target point of ability being cast)
      • Unit Group - Pick every unit in (Units within 500.00 of TargetPoint) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Triggering player) at TargetPoint facing Default building facing degrees
          • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
          • Unit - Add Mass Inner Fire (Dummy) to (Last created unit)
          • Custom script: call RemoveLocation(udg_TargetPoint)
          • Set TargetPoint = (Position of (Picked unit))
          • Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
          • Custom script: call RemoveLocation(udg_Point)
Still don't know how to change the 'Position of Picked unit' so it doesn't leak or it is okay that I remove it shortly after?!
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
1- If you use "Position of (anything)" you leak, just like you're doing in the Group Declaration

2- You should create the dummy at the TargetPoint, not a Triggering Unit's Position
3- You have to destroy TargetPoint at the end of the trigger, else you leak.
4- You have to configure the dummy to make it cast instantly:
Art - Animation cast backswing: 0.00
Art - Animation cast point: 0.00
Stats - Mana Initial amount: 9999
Stats - Mana Maximum: 9999
Stats - Mana Regeneration: 9999
Movement - Type: Flying

5- You have to configure teh Mass Inner Fire (Dummy) to make it instant-castable
Art - Animation names: --- (none)
Stats - Cast Range: 9999
Stats - Casting time: 0.00
Stats - Cooldown: 0.00
Stats - Mana Cost: 0
Stats - Targets Allowed: Air, Ground.

If you don't like 4 and 5, you have to :

6- Create the dummy INSIDE the loop and add Expiration timer INSIDE the loop, and add the Mass Inner Fire (Dummy) ability INSIDE the loop.

Right now you're not using the "Point" inside the loop for anything.

7- Learn basic jass. This is a peace of cake with locals ;) Create a trigger with the Event "A unit starts the effect of an ability" and the condition "Ability Being Cast equal to Mass Inner Fire" and in the actions create several "Do Nothing" actions. Then turn that trigger into Custom Script. There you'll see your "Do Nothing" Actions, replace them with this:
JASS:
// To see the ID of elements in the Object Editor press CTRL+D.
    local unit u = GetTriggerUnit()
    local real x = GetSpellTargetX()
    local real y = GetSpellTargetY()
    local unit dummy = CreateUnit(GetTriggerPlayer(), 'xxxx', x, y, 0) // Replace 'xxxx' with the Id of your Dummy unit
    local unit fog
    
    call UnitApplyTimedLife(dummy, 'BTLF', 1)
    
    call GroupEnumUnitsInRange(bj_lastCreatedGroup, 500, 0, 0 null)
    
    loop
        set fog = FirstOfGroup(bj_lastCreatedGroup)
        exitwhen fog == null
        if IsUnitEnemy(fog, GetTriggerPlayer()) == true then
            call IssueTargetOrderById(dummy, 'zzzz' , fog) // Replace 'zzzz' with the Id of your Mass Inner Fire (Dummy) Id
        endif
        call GroupRemoveUnit(bj_lastCreatedGroup, fog)
    endloop
    
    set u = null
    set dummy = null

That JASS script is an optimized form (easier, faster, lighter, smoother) of the GUI trigger you're trying to create:

  • Melee Initialization
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set tempPoint1 = (Target point of ability being cast)
      • Set tempPlayer = (Triggering player)
      • Set tempGroup = (Units within 500.00 of tempPoint1 matching (((Matching unit) belongs to an enemy of tempPlayer) Equal to False))
      • Unit Group - Pick every unit in tempGroup and do (Actions)
        • Loop - Actions
          • Set tempUnit = (Picked unit)
          • Set tempPoint2 = (Position of tempUnit)
          • Unit - Create 1 Footman for tempPlayer at tempPoint2 facing Default building facing degrees
          • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
          • Unit - Order (Last created unit) to Human Priest - Inner Fire tempUnit
          • Custom script: call RemoveLocation(udg_tempPoint2)
      • Custom script: call RemoveLocation(udg_tempPoint1)
      • Custom script: call DestroyGroup(udg_tempGroup)
 
Last edited:
Level 7
Joined
Feb 9, 2010
Messages
298
I am not even a beginner with Jass so I am not sure I understood what you mean but isn't my version above not better?! (I just updated it, see my previous post)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Check my last post. I added more precise description and suggestions and the GUI trigger + the same GUI trigger optimized with JASS.

Are you sure about your Dummy and Ability configuration? If you configure it correctly (as i already described) you can have the same dummy cast the same really fast to all the units in the group, instead of having to create one dummy for each unit.
 
Level 17
Joined
Feb 11, 2011
Messages
1,860
5- You have to configure teh Mass Inner Fire (Dummy) to make it instant-castable
Art - Animation names: --- (none)
Stats - Cast Range: 9999
Stats - Casting time: 9999
Stats - Cooldown: 0.00
Stats - Mana Cost: 0
Stats - Targets Allowed: Air, Ground.

Casting time should also be 0.0.
You can also leave the Targets Allowed field blank, so the dummy ability can target anything. You would want to filter out units in the triggers, though.
 
Level 7
Joined
Feb 9, 2010
Messages
298
Guys I have two problems and I need to solve at least one of them:
1. Problem - this trigger as you can see is the one that creates the dummy in the loop but every time the spell is cast the dummies multiply first 6, then 12, then 18, 24... and after 5-6 casts you can imagine how much the map starts to lag:
  • Mass Inner Fire
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Inner Fire
    • Actions
      • Set TargetPoint = (Position of (Triggering unit))
      • Unit Group - Pick every unit in (Units within 500.00 of (Position of (Triggering unit))) and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Triggering player) at TargetPoint facing Default building facing degrees
          • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
          • Unit - Add Mass Inner Fire (Dummy) to (Last created unit)
          • Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
      • Custom script: call RemoveLocation(udg_TargetPoint)
2. Problem - I did everything that you guys told me about configuring the Dummy unit and the spell itself so it can be cast instantly but when the dummy is created outside of the loop it casts only at one unit(one and the same unit every time) although there are another 5 units right next to it:
  • Mass Inner Fire Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mass Inner Fire
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set Group = (Units within 500.00 of Point)
      • Unit - Create 1 Dummy for (Triggering player) at Point facing Default building facing degrees
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Unit - Add Mass Inner Fire (Dummy) to (Last created unit)
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call DestroyGroup(udg_Group)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Check my earlier posts and see the GUI example of what you have to do, just replacing the unit and the abilities.

If the dummies multiplies, maybe they are configured to not decay, so they remain there dead, so they're picked, and a dummy unit is created to cast on them.

1. You're not setting the group correctly. You should use the Point, not the position of the unit. That leaks.

2. Should work, i'll test in the night.
 
Status
Not open for further replies.
Top