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

Minor trigger problem - can anyone fix it? :)

Status
Not open for further replies.
I am experienced map maker, but this is an entirely new bug for me, so please help me with this :)

I am currently making a map called Witchunters, and I am very close to a beta stage... however, I have a slight problem:
I made a spell which knockbacks units around you and it works fine. I made it so you can cast it at any time, and its power depends on the casting time. But after you cast it for the first time, and you didn't finish casting it, casting any other ability afterwards will result in your game ignoring commands and exiting after a few seconds...

Can anyone try to fix this please? I uploaded the map :)

images


It consists of 3 triggers:
  • Kinn Cast Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Rune: Kinn
    • Actions
      • Set Rune_Point[0] = (Position of (Triggering unit))
      • Countdown Timer - Start Rune_Timer[(Custom value of (Triggering unit))] as a One-shot timer that will expire in 1.90 seconds
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using war3mapImported\KinnChannel.mdx
      • Set Rune_Sfx[(Custom value of (Triggering unit))] = (Last created special effect)
      • Unit - Create 1 progress_Kinn for (Owner of (Triggering unit)) at Rune_Point[0] facing Default building facing degrees
      • Animation - Change (Last created unit)'s animation speed to 85.00% of its original speed
      • Set Rune_Progress[(Custom value of (Triggering unit))] = (Last created unit)
      • Custom script: call RemoveLocation(udg_Rune_Point[0])
  • Kinn Cast End
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Rune: Kinn
    • Actions
      • Set Rune_Point[0] = (Position of (Triggering unit))
      • Set Rune_Percent[(Custom value of (Triggering unit))] = (((Remaining time for Rune_Timer[(Custom value of (Triggering unit))]) x 100.00) / 1.80)
      • Set Rune_Percent[(Custom value of (Triggering unit))] = (100.00 - Rune_Percent[(Custom value of (Triggering unit))])
      • Special Effect - Destroy Rune_Sfx[(Custom value of (Triggering unit))]
      • Special Effect - Create a special effect attached to the left hand of (Triggering unit) using Abilities\Weapons\PriestMissile\PriestMissile.mdl
      • Set Rune_Sfx[(Custom value of (Triggering unit))] = (Last created special effect)
      • Special Effect - Destroy Rune_Sfx[(Custom value of (Triggering unit))]
      • Animation - Change Rune_Progress[(Custom value of (Triggering unit))]'s animation speed to 0.00% of its original speed
      • Unit - Add a 0.30 second Generic expiration timer to Rune_Progress[(Custom value of (Triggering unit))]
      • Unit - Create 1 sfx_Kinn for (Owner of (Triggering unit)) at Rune_Point[0] facing Default building facing degrees
      • Animation - Change (Last created unit)'s size to ((100.00 + (Rune_Percent[(Custom value of (Triggering unit))] x 1.40))%, 100.00%, 100.00%) of its original size
      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
      • Set RuneKinn_Range = (80.00 + (Rune_Percent[(Custom value of (Triggering unit))] x 2.40))
      • Set RuneKinn_Group = (Units within RuneKinn_Range of Rune_Point[0] matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) is hidden) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (1.00 Equal to
      • Unit Group - Pick every unit in RuneKinn_Group and do (Actions)
        • Loop - Actions
          • Set Damage_Type = 3
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing RuneKinn_Damage[(Custom value of (Triggering unit))] damage of attack type Normal and damage type Normal
          • Set Damage_Type = 0
          • Set KBA_Caster = (Triggering unit)
          • Set KBA_TargetUnit = (Picked unit)
          • Set KBA_StartingPosition = Rune_Point[0]
          • Set KBA_Level = 1
          • Set KBA_Speed = 15.00
          • Set KBA_DistancePerLevel = 300.00
          • Set KBA_SpecialEffects[1] = Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
          • Set KBA_SpecialEffects[2] = Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
          • Set KBA_DestroyTrees = True
          • Trigger - Run Cast A Knockback <gen> (checking conditions)
      • Custom script: call RemoveLocation(udg_Rune_Point[0])
      • Custom script: call DestroyGroup(udg_RuneKinn_Group)
      • Set RuneKinn_IndexWrite = (RuneKinn_IndexWrite + 1)
      • Set RuneKinn_Caster[RuneKinn_IndexWrite] = (Triggering unit)
      • Unit - Pause (Triggering unit)
      • Animation - Play (Triggering unit)'s Spell Slam First animation
      • Wait 0.50 seconds
      • Set RuneKinn_IndexRead = (RuneKinn_IndexRead + 1)
      • Unit - Unpause RuneKinn_Caster[RuneKinn_IndexRead]
      • Set RuneKinn_Caster[RuneKinn_IndexRead] = No unit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RuneKinn_IndexRead Equal to RuneKinn_IndexWrite
        • Then - Actions
          • Set RuneKinn_IndexRead = 0
          • Set RuneKinn_IndexWrite = 0
        • Else - Actions
  • Kinn DummyDeath
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Dying unit)) Equal to progress_Kinn
    • Actions
      • Animation - Change (Dying unit)'s animation speed to 100.00% of its original speed
The problem is in the second trigger, in the final part after clearing the leaks (point and group). But I am not exactly sure what is the problem :/
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
It might be the wait action. If your trying to index with a wait you should just make a loop trigger and use indexed arrays.

also anything u use twice or more should be stored into a variable and the variable should be used. example: triggering unit / custom value of unit / and more.

dont use dying unit use triggering unit.
 
Level 5
Joined
May 6, 2013
Messages
125
I shed a tear while reading through this thread. It's these kind of fundamentalistic unfounded accusations for doing things incompliant to the paradigms etched into the minds of people, claiming everything else would be bad and could therefor not be correct, and worst of all, writing such things as an answer while ignoring the actual question. It's everything that is wrong with this community, gathered in a single thread, and while most average thinking beings are probably able to scan over this thread ignoring the wall of ignorance grasping for their sanity, i have hard times doing so. I would loose a few words about why waits are perfectly fitting for this purpose and how adorable of an solution i find the read and write heads to be, but i guess it would have as much impact as an atheist trying to explain his doubts about god to the pope himself, so i will save my breath (or, the fingermovements in this case).

Back to topic: it really is the pause action. If you didnt noticed, after aborting the spell, your unit is incapable of interrupting its current order; while you can usually click anywhere and he will run there, after this incident, he will always walk to his point of destination before fulfilling another command. It highly suggests that this can not be a trigger issue, but a bug in the warcraft engine itself. I personally believe that the move order that you queue up to interrupt the channeling order screws things up; its a special case of a usergiven moveorder, given before pausing the unit, but being processed after pausing it. Of course its all a mere theory and i don't have the skill to dissect how wc3 handles those orders, but fact is, removing the pause order or giving the game time to process the move order (e.g. putting a 0 second wait before pausing) will fix it. As a 0 second wait is too long and therefor not suitable for your case:

Possible solutions:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • 'IF'-Conditions
      • (Remaining time for Rune_Timer[(Custom value of (Triggering unit))]) <= 0.10
    • 'THEN'-Actions
      • Unit - Pause ein (Triggering unit)
    • 'ELSE'-Actions
      • Set Kinn_MoveBool = True
  • Kin move intercept
    • Events
      • Unit - A unit Gets an order targeting a point
    • Conditions
      • (Issued order) equals (Order(smart))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • Kinn_MoveBool Gleich True
        • 'THEN'-Actions
          • Spiel - Display to (All players) the text: lawl im here
          • Einheit - Pause ein (Triggering unit)
          • Set Kinn_MoveBool = False
        • 'ELSE'-Actions
(please ignore the bad / missing translation, im kinda lazy :D)
Instead of bluntly pausing, check whether the unit was interrupted by an order or by a timeout. This trigger assumes an interrupt using the "smart" order (right click anywhere) and lets it process first if the spell ends too early (remaining time is too high). You will need to adjust this trigger to work with other orders that might interrupt the spell and have to rely on the accuracy of the timer.
  • Countdown-Timer - Start Kinn_Timer as a Einmalig timer that will expire in 0.00 seconds
  • Kin move intercept
    • Events
      • Time - Kinn_Timer expires
    • Conditions
    • Actions
      • Unit - Pause ein RuneKinn_Caster[RuneKinn_IndexWrite]
Assuming that that interrupting order is right in the queue, the timer will let the order be processed and then pause the unit. This will fix the problem regardless of how the spell is interrupted, but might make problems when multiple units cast the spell at the same time (read: your second trigger is queued twice in a row)

Well, or you do what maker suggested and replace the animation by a hidden channel spell or smthn.
 
Status
Not open for further replies.
Top