• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Refunding Mana, custom spell

Status
Not open for further replies.
Level 6
Joined
Jan 14, 2016
Messages
43
Issue is tentatively fixed - problem is 'Channel' ability implementing mana cost after effect started.

So, I've got a few spells based on Channel (ID'd to charm, earthquake, and summonphoenix), and triggers to implement the effects if they're cast where I want 'em, and refund mana if they're cast elsewhere. Event for all of them is 'Starts the effect of an ability'

BUT, all the triggers are refunding the mana BEFORE the spell has implemented the mana cost. Clearly I'm an idiot and I'm missing something obvious, but I've made dozens of similar dummy spell type abilities in the past without running into this issue, and I just cannot see where I'm going wrong.

Here's the shortest of the affected triggers. I know there appear to be some superfluous variables. The refund mana bit is at the very end - skip over the rest.

  • Cast Dominate
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dominate (chess)
    • Actions
      • Set ManaAllocated = False
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Equal to CurrentPlayer
          • ((Target unit of ability being cast) is in antigroup) Equal to True
        • Then - Actions
          • Set tempypoint = (Position of (Target unit of ability being cast))
          • -------- =========== --------
          • Unit - Create 1 dummy for Player 3 (Teal) at tempypoint facing Default building facing degrees
          • Unit - Add buffer Dominate to (Last created unit)
          • Unit - Order (Last created unit) to Orc Shaman - Lightning Shield (Target unit of ability being cast)
          • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
          • -------- =========== --------
          • Unit Group - Remove (Target unit of ability being cast) from antigroup
          • Unit Group - Add (Target unit of ability being cast) to currentgroup
          • Unit - Change ownership of (Target unit of ability being cast) to CurrentAllyPlayer and Retain color
          • Special Effect - Create a special effect at tempypoint using Abilities\Spells\Other\Charm\CharmTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Custom script: call RemoveLocation (udg_tempypoint)
          • If (MovePhase Equal to True) then do (Unit - Add Move (chess) to (Target unit of ability being cast)) else do (Unit - Add Target (chess alternative) to (Target unit of ability being cast))
          • Unit Group - Add (Target unit of ability being cast) to AbGruDominate
        • Else - Actions
          • Quest - Display to (Player group((Owner of (Triggering unit)))) the Warning message: |c00FF0000You can o...
          • Set CasterDominate = (Triggering unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ManaAllocated Equal to False
            • Then - Actions
              • Unit - Set mana of CasterDominate to ((Mana of CasterDominate) + 70.00)
              • Set ManaAllocated = True
            • Else - Actions

Does anyone know what I'm missing here? Thanks in advance!
 
Last edited:
Level 6
Joined
Jan 14, 2016
Messages
43
Thank you, IcemanBo and pick-a-chew for your advice. Unfortunately, neither of these methods worked, but after some fiddling, I WAS able to figure out what was wrong.

It's the 'Channel' spell. While every other spell implements the mana cost BEFORE it starts its effect, Channel does it immediately after (within .1 sec). I admit to not knowing what every field in the Channel spell is for - I had 'em all set to 0, but perhaps there's another way to set it up that would make Channel's mana cost work like other spells.

Anyways, best work around is to simply base my custom abilities off of different spells, but I'm not going to mark this as fixed just yet, in case someone happens by who knows a thing or two about the oddities of Channel.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,217
It likely does refund the mana, but only if {maximum mana - current mana > mana cost} holds true. One has the same problem with damage block systems using the on damage event as the damage is only taken by the unit after the event response trigger finishes execution.
 
Status
Not open for further replies.
Top