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

[Trigger] Periodic Infernal Spell on Unit Group

Status
Not open for further replies.
Level 5
Joined
Jan 19, 2018
Messages
126
Hello again Hive,
I am currently working on a 3v3 map that also has mini instance dungeons that reward
the player with a powerful item to help turn the tides in their favor. In one of the instances,
when the player teleports to the instance I made a trigger that causes an infernal to spawn
on a random unit in the instance every 25 seconds. The problem is that it only works onces
and sometimes not at all. I'm not sure what the problem is.
Here is the simple trigger:
  • Spawn Infernals
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 99999, do (Actions)
        • Loop - Actions
          • Wait 25.00 game-time seconds
          • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at (Position of (Random unit from ThroneOfKiljaedenGroup)) facing Default building facing degrees
          • Set InfernalDummy = (Last created unit)
          • Unit - Order InfernalDummy to Undead Dreadlord - Inferno (Position of (Random unit from ThroneOfKiljaedenGroup))
          • Wait 2.00 game-time seconds
          • Unit - Remove InfernalDummy from the game
Note that the trigger is run via another trigger. The trigger is running for sure, but not as intended.
As always,
thanks in advance.
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
Do not use loop and wait for that intention. Use periodic timer instead.
  • Spawn Infernals
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at (Position of (Random unit from ThroneOfKiljaedenGroup)) facing Default building facing degrees
      • Set InfernalDummy = (Last created unit)
      • Unit - Add a 2.00 second Generic expiration timer to InfernalDummy
      • Unit - Order InfernalDummy to Undead Dreadlord - Inferno (Position of (Random unit from ThroneOfKiljaedenGroup))
I'd also like to suggest to store location into variable and remove it afteruse to prevent memory leak.
Basic Memory Leaks
Memory Leaks
 
Level 5
Joined
Jan 19, 2018
Messages
126
Do not use loop and wait for that intention. Use periodic timer instead.
  • Spawn Infernals
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at (Position of (Random unit from ThroneOfKiljaedenGroup)) facing Default building facing degrees
      • Set InfernalDummy = (Last created unit)
      • Unit - Add a 2.00 second Generic expiration timer to InfernalDummy
      • Unit - Order InfernalDummy to Undead Dreadlord - Inferno (Position of (Random unit from ThroneOfKiljaedenGroup))
I'd also like to suggest to store location into variable and remove it afteruse to prevent memory leak.
Basic Memory Leaks
Memory Leaks
  • Spawn Infernals
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Set InfernoLocation = (Position of (Random unit from ThroneOfKiljaedenGroup))
      • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at InfernoLocation facing Default building facing degrees
      • Set InfernalDummy = (Last created unit)
      • Unit - Order InfernalDummy to Undead Dreadlord - Inferno (Position of (Random unit from ThroneOfKiljaedenGroup))
      • Unit - Remove InfernalDummy from the game
      • Custom script: call RemoveLocation(udg_InfernoLocation)
Hello and thank you for responding to my thread!
Doesn't seem to be working for me. Not sure what the problem is...
P.S. Thanks for the memory leak tip.
 
Last edited:
Level 13
Joined
Nov 4, 2006
Messages
1,239
use the expiration timer as @Rheiko suggested instead of "remove unit from game", if you remove it directly after it might not have enough time to cast the spell, also did you make sure your dummy unit has the correct ability? and also the ability has no cooldown, enough range, no manacost etc.
 
Level 5
Joined
Jan 19, 2018
Messages
126
use the expiration timer as @Rheiko suggested instead of "remove unit from game", if you remove it directly after it might not have enough time to cast the spell, also did you make sure your dummy unit has the correct ability? and also the ability has no cooldown, enough range, no manacost etc.
Hello and thanks for responding to my thread,
what do you mean expiration timer? the event? I am using that. Also, in terms of the spell yes the dummy has the spell
and required mana and what not.
 
Level 22
Joined
Aug 27, 2013
Messages
3,973
replace your "Remove InfernalDummy from the game" with this function
  • Unit - Add a 2.00 second Generic expiration timer to InfernalDummy
It doesn't work most likely because your dummy doesn't have enough time to cast the spell.
Your workflow based on your trigger:
Create a dummy -> order it to cast the spell -> remove it immediately
It won't have enough time. it needs time to cast the spell, at least a second or so.
that's why I give the dummy 2 seconds expiration timer. It'll be dead and removed in 2 seconds.
 
Level 5
Joined
Jan 19, 2018
Messages
126
replace your "Remove InfernalDummy from the game" with this function
  • Unit - Add a 2.00 second Generic expiration timer to InfernalDummy
It doesn't work most likely because your dummy doesn't have enough time to cast the spell.
Your workflow based on your trigger:
Create a dummy -> order it to cast the spell -> remove it immediately
It won't have enough time. it needs time to cast the spell, at least a second or so.
that's why I give the dummy 2 seconds expiration timer. It'll be dead and removed in 2 seconds.
Thank you very much for showing that, I didn't know that feature existed. (sorry I R nub)
But there is still a problem, its only firing once!
I know the trigger only fires once since my game text that I'm using as an echo only fires once.
The trigger is initially off, when the player enters the instance its turned on.
Maybe that bit of information can help?
Here is the updated trigger:
  • Spawn Infernals
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Set InfernoLocation = (Position of (Random unit from ThroneOfKiljaedenGroup))
      • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at InfernoLocation facing Default building facing degrees
      • Set InfernalDummy = (Last created unit)
      • Unit - Order InfernalDummy to Undead Dreadlord - Inferno (Position of (Random unit from ThroneOfKiljaedenGroup))
      • Unit - Add a 2.00 second Generic expiration timer to InfernalDummy
      • Custom script: call RemoveLocation(udg_InfernoLocation)
      • Game - Display to (All players) the text: trigger fired
Thanks again!
 
Level 5
Joined
Jan 19, 2018
Messages
126
If the trigger is turned on from the start it will be running even when there is no one in the instance.
Also the InfernoLocation will be null because there will be no units in the ThroneofKiljaedenGroup.
That is the unit group that is filled when the units enter the instance which is what the inferno location is using.

The plot thickens...
Still you helped me improve the trigger and I will be using those improvements on the rest of my map
as I am sure I have plenty of memory leaks in some of my other triggers.
Thanks again + Rep
 
Level 5
Joined
Jan 19, 2018
Messages
126
Bump*
Not sure why this thread was changed to solved lol
Now the infernals only spawn maybe twice. Sometimes the dummy casts the spell more than once.
Not sure what is going on,
thanks in advance.
 
Level 5
Joined
Jan 19, 2018
Messages
126
Well u are not casting the spell at the location of the dummy instead u are using position of random unit from group again witch may become a different unit so change it to the variable u set "InfernoLocation"
Hello and thank you for responding to my thread!
I made the changes but I am noticing the dummy does not cast the spell if the units in the unit group are moving.
I'm not sure how to fix this, here is my updated trigger:
  • Spawn Infernals
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Set InfernoLocation = (Position of (Random unit from ThroneOfKiljaedenGroup))
      • Unit - Create 1 Inferno Dummy for Player 10 (Light Blue) at InfernoLocation facing Default building facing degrees
      • Set InfernalDummy = (Last created unit)
      • Set InfernoLocation = (Position of InfernalDummy)
      • Unit - Order InfernalDummy to Undead Dreadlord - Inferno InfernoLocation
      • Unit - Add a 3.00 second Generic expiration timer to InfernalDummy
      • Custom script: call RemoveLocation(udg_InfernoLocation)
      • Game - Display to (All players) the text: trigger fired
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
you dont have to set the location twice specially since they are both at the same location. tho this wont fix your problem maybe somthing else is happening. maybe somthing with the inferno spell. have u tryed giving it to a unit and casting it ingame for manual test. cause i cant see anything in that trigger to cause issues.
 
Level 5
Joined
Jan 19, 2018
Messages
126
you dont have to set the location twice specially since they are both at the same location...
Technically they're not the same location. The first location is on a random unit from the unit group in the instance but
the second location sets it to the position of the dummy so he casts infernal on himself. I did this because the units in the unit group move
and that causes the dummy not to cast sometimes so I made him cast it on himself to avoid that but the problem still persists.
I will show you the trigger that fires the trigger displayed above, maybe it is doing something that is causing the issue.
  • Player Enters Throne of Kiljaeden
    • Events
      • Dialog - A dialog button is clicked for EnterInstance[1]
    • Conditions
      • (Clicked dialog button) Equal to EnterInstanceChoices[2]
    • Actions
      • Unit Group - Remove all units from DuskwoodGroup
      • Set PowerGeneratorsRemaining = 2
      • Set PlayerUnitsInThroneOfKiljaeden = (Number of units in ThroneOfKiljaedenGroup)
      • Destructible - Close ForceWall (Diagonal No Pathing) 3767 <gen>
      • Unit Group - Pick every unit in (Units within 1000.00 of (Position of |cffffcc00The Throne of Kil'Jaeden|r 0032 <gen>) matching ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is A peon-type unit) Equal to Fal and do (Actions)
        • Loop - Actions
          • If ((Number of units in ThroneOfKiljaedenGroup) Less than 12) then do (Unit Group - Add (Picked unit) to ThroneOfKiljaedenGroup) else do (Do nothing)
      • Wait 0.10 seconds
      • Unit Group - Pick every unit in ThroneOfKiljaedenGroup and do (Actions)
        • Loop - Actions
          • Special Effect - Create a special effect at (Position of (Picked unit)) using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Human\MassTeleport\MassTeleportTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Move (Picked unit) instantly to (Center of Throne of Kiljaeden Starting Area <gen>), facing 90.00 degrees
      • Wait 0.10 seconds
      • Camera - Pan camera for ThroneOfKiljaedenPlayer to (Center of Throne of Kiljaeden Starting Area <gen>) over 0.00 seconds
      • Destructible - Kill Foot Switch 2202 <gen>
      • Set PlayerUnitsInThroneOfKiljaeden = (Number of units in ThroneOfKiljaedenGroup)
      • Set InstanceOccupied[1] = True
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • GetLocalPlayer Equal to ThroneOfKiljaedenPlayer
        • Then - Actions
          • Sound - Play QuestNew <gen>
          • Game - Display to (All players matching ((Matching player) Equal to ThroneOfKiljaedenPlayer)) for 10.00 seconds the text: |cffffcc00INSTANCE ...
        • Else - Actions
      • Trigger - Turn on Spawn Infernals <gen>
      • Trigger - Run Spawn Generators <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Mob 1 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Mob 2 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Mob 3 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Mob 4 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Mob 5 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Patrol 1 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Patrol 2 <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Boss Entrance <gen> (checking conditions)
      • Trigger - Run Throne of Kiljaeden Boss <gen> (checking conditions)
Here's what its doing:
When a unit selects a dialogue button to enter the instance, him and 11 other nearby units
are teleported to the instance. Then this trigger runs all the triggers for the instances that generate
mobs, and the periodic infernal spawns and what not.
 
Last edited:
Level 15
Joined
Jul 9, 2008
Messages
1,552
setting the point to where a unit is creating a dummy at the point and then casting the spell on the point of the dummy is the exact same as the position of the unit. also setting the point to pos of unit will not move if the unit moves so the unit moving is not ur issue. other then the leaks the trigger should work. try maxxing out the cast range of your inferno spell.
 
Level 5
Joined
Jan 19, 2018
Messages
126
setting the point to where a unit is creating a dummy at the point and then casting the spell on the point of the dummy is the exact same as the position of the unit...
Interesting, I thought that the position updates with unit movement.
Also I set the cast range to 99999 and he ended up not casting at all.
I made the dummy visible so I could see if hes spawning. He always spawns but sometimes he just sits there and dies when the timer expires.
Its still the same problem, if my instance group is moving he spawns but doesn't cast infernal. If they are all stationary he will cast it.
Just doesn't seem to make any sense.
 
Level 13
Joined
Jul 15, 2007
Messages
763
If Player 10 is a Computer Player then its possibly because its AI is only letting Infernal cast when it deems it appropriate (important: most Wc3 spells have hard-coded AI of some sort).

My guess is that Inferno's AI is similar to Blizzard or Rain of Fire and will only activate in multiple-target scenarios. The problem is usually fixed by doing this on your dummy unit:

[Trigger=]
AI - Ignore (Last created unit)'s guard position
[/Trigger]

Personally i dedicate a neutral slot (i use Neutral Extra) for harmful environmental effects as these players come with no AI and will always cast spells when ordered to.
 
Level 5
Joined
Jan 19, 2018
Messages
126
If Player 10 is a Computer Player then its possibly because its AI is only letting Infernal cast when it deems it appropriate (important: most Wc3 spells have hard-coded AI of some sort).

My guess is that Inferno's AI is similar to Blizzard or Rain of Fire and will only activate in multiple-target scenarios. The problem is usually fixed by doing this on your dummy unit:

[Trigger=]
AI - Ignore (Last created unit)'s guard position
[/Trigger]

Personally i dedicate a neutral slot (i use Neutral Extra) for harmful environmental effects as these players come with no AI and will always cast spells when ordered to.
Hello and thank you for responding to my thread!
I set these dungeon mobs to a player rather than neutral because I read on a forum here that neutral units have very wonky AI, for example they sometimes ignore orders issued like patrol (which I witness personally) amongst other things. I will give that AI action a try.
Thanks again.
 
Level 13
Joined
Jul 15, 2007
Messages
763
Hello and thank you for responding to my thread!
I set these dungeon mobs to a player rather than neutral because I read on a forum here that neutral units have very wonky AI, for example they sometimes ignore orders issued like patrol (which I witness personally) amongst other things. I will give that AI action a try.
Thanks again.

That "Wonky AI" is working how you set it, creeps have this thing called a "guard distance" that needs to be set in gameplay constants (or disabled via the trigger function i linked), neutral Extra is pretty pure as far as AI goes, if it doesn't do something you tell it to, it's a good indication the fault isn't in the AI.

Nope didn't work, I even tried switching the dummy to neutral victim.

Beats me then, something is preventing your dummy unit from casting. InfernoLocation and InfernalDummy seem sound to me. You say the dummy unit successfully spawns and casts sometimes which proves this. The only thing i can think of is if you have triggers that could adversely interact with your dummy unit the moment it is spawned which prevents it from casting (namely "Unit Enters Region" triggers).

Make sure your Dummy's cast point is 0.000 as this will ensure the spell is cast as soon as you order it.
 
Level 5
Joined
Jan 19, 2018
Messages
126
That's the thing, I don't know what Trigger could possibly be causing a problem considering as the dummy is not part of any unit groups
other than perhaps the owned by player default group nor is being controlled by any other trigger.
 
Status
Not open for further replies.
Top