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

Buggy Spell Trigger

Status
Not open for further replies.
Level 13
Joined
Nov 4, 2006
Messages
1,239
Hi guys,

i have some problem with the following trigger. it works in general, but even though i always have 4 lightning ghosts, sometimes it does nothing, sometimes it casts 4 times, sometimes 3, 2 or 1 time, even though it fires 4 times (text is displayed).
I can't really narrow down the problem. i also tried using only 1 caster with a zero cooldown ability and let him cast, but the result is exactly the same.
Anyone sees a problem with this?

Edit: the dummy unit is based of locust, with disabled attack and added invulnerability

  • Forked Lightning
    • Events
      • Unit - A unit Starts the Effect of an ability
    • Conditions
      • (Number of units in (Units owned by (Owner of (Triggering unit)) of type Lightning Ghost)) greater or equal to 1
      • (Ability being cast) equal to Forked Lightning (Elemental Mage)
    • Actions
      • Set dummyinteger = (Number of units in (Units owned by (Owner of (Triggering unit)) of type Lightning Ghost))
      • Set lightningtarget = (Position of (Target unit of ability being cast))
      • For each (Integer A) from 1 to dummyinteger, do (Actions)
        • Loop - Actions
          • Wait 0.70 game-time seconds
          • Unit - Create 1 Dummy Caster for (Owner of (Triggering unit)) at lightningtarget facing ...
          • Set lightningdummy = (Last created unit)
          • Unit - Add Forked lightning (Elemental Mage - dummy) to lightningdummy
          • Einheit - Set level of Forked lightning (Elemental Mage - dummy) for lightningdummy to (Level of Forked lightning (Elemental Mage) for (Triggering unit))
          • Unit - Add a 1.50 second Standard expiration timer to lightningdummy
          • Unit - Order lightningdummy to Neutral Naga-Seewitch - 'forked lightning' (Random unit from (Units in (Region centered at lightningtarget with size (700.00, 700.00))))
          • Game - Display to (All players) the text: test
 
Last edited:
Level 13
Joined
Oct 16, 2010
Messages
731
I haven't got access to editor atm, but my first guess is that you're using "Integer A". If you create your own variable for the loop that may fix your issue.

If the spell can be used by multiple units then the wait is likely to cause issues. If it's for 1 unit though it should be fine.
 

Jampion

Code Reviewer
Level 15
Joined
Mar 25, 2016
Messages
1,327
You have a wait and use values after the wait that may be overwritten by other triggers. I think triggering unit works even after waits, but Integer A can be overwritten by another trigger using a loop.
This spell is also not MUI, so it won't work if you cast it again before it is finished. The spell lasts "dummyinteger*0.7 seconds".
By the way the trigger contains leaks.
 
Level 13
Joined
Nov 4, 2006
Messages
1,239
@Jampion i know that, and i left the leak fix out to keep it simple for now. I'm currently just testing a few things for spells and there is nothing else interfering. the map literally contains nothing else then my caster and some enemies together with this trigger. guess i should have mentioned that before :grin:

Edit: somehow it's solved now, although all i did was increasing the wait to 1 second and using an own variable instead of integer A, still kinda strange though
 
Last edited:
Level 21
Joined
Dec 4, 2007
Messages
1,478
What i'm curious about right now is, does it work when using for the first time after starting the map?

I can see the global integer A being overwritten if fired multiple times, due to the wait, but it should work correctly the first time, right?
 
Level 7
Joined
Jan 23, 2011
Messages
350
Maybe i wasn't clear. Check this test map

  • look
    • Acontecimientos
      • Unidad - A unit Inicia el efecto de una habilidad
    • Condiciones
    • Acciones
      • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
        • Bucle: Acciones
          • Wait 0.50 game-time seconds
          • Unidad - Create 1 Soldado raso for Jugador 1 (rojo) at (Position of (Triggering unit)) facing Vista edificio predeterminada (270.0) degrees
  • at the test
    • Acontecimientos
      • Unidad - A unit Finaliza el lanzamiento de una habilidad
    • Condiciones
    • Acciones
      • Do Multiple ActionsFor each (Integer A) from 1 to 6, do (Actions)
        • Bucle: Acciones
          • Partida - Display to (All players) the text: THE BUGS
Now, the first trigger will run okey if you Cancel the ability with Stop or anything, if you let the ability finish effect normally, it will bug.

edit: yea, i have war3 in spanish
 

Attachments

  • IntegerABug.w3x
    16.4 KB · Views: 27
Status
Not open for further replies.
Top