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

Help with this spell (SOLVED by Jampion)

Status
Not open for further replies.
Level 21
Joined
Apr 8, 2017
Messages
1,530
Hello all im making a non-mana cost buff, buff = spells mana cost turned off.

But i think this can be upgraded with hashtables (I THINK, cuz my hashtables knowledge are only rumons)

Here are the triggers
Set mana
  • Drae diff set
    • Events
      • Unit - A unit Issues an order with an object as a target
      • Unit - A unit Issues an order with a point as target
      • Unit - A unit Issues an order without target
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If: Condiciones
          • ((Triggering unit) has buff Dra diff ) Equal a True
        • So: Actions
          • Unit - Set the custom value of (Triggering unit) to (Integer((Mana of (Triggering unit))))
        • Otros: Acciones
Effect
  • Drae diff cast
    • Events
      • Unit - A unit ends the effect of a spell
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If: Condiciones
          • ((Triggering unit) has buff Dra diff ) Equal a True
        • So: Actions
          • Unit - Set mana of (Triggering unit) to (Real((Custom value of (Triggering unit))))
        • Otros: Acciones
PD: i use spanish WE version so sorry if some words are bad translated.
PD 2: if you can add it an effect when he casts a spell it could be better.



-
 
Last edited:
Level 15
Joined
Mar 25, 2016
Messages
1,327
I used some jass, a timer and a hashtable, I hope it's ok.

The idea is, that when "unit starts the effect of a spell" runs, the mana of the spell was not spent yet. After 0 seconds the mana is spent though.
This means we store the mana of the unit, when "unit starts the effect of a spell" runs and restore it 0 seconds after that.
To correctly use the 0 second delay we need a timer, because waits are inaccurate.
To effectively use timers we need jass, otherwise it just makes it overly complicated.
 

Attachments

  • NoManaCost.w3x
    18.2 KB · Views: 32
Level 21
Joined
Apr 8, 2017
Messages
1,530
  • Cast
    • Acontecimientos
      • Unidad - A unit Inicia el efecto de una habilidad
    • Condiciones
    • Acciones
      • -------- in this example, inner fire is the buff --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si: Condiciones
          • ((Triggering unit) has buff Dra diff ) Igual a True
        • Entonces: Acciones
          • -------- this action makes the spell cost no mana: --------
          • Custom script: call ExecuteFunc("StoreMana")
        • Otros: Acciones
      • Custom script: endfunction
      • -------- this function restores the mana --------
      • Custom script: function RestoreMana takes nothing returns nothing
      • Custom script: local timer t = GetExpiredTimer()
      • Custom script: set udg_Key = GetHandleId(t)
      • Custom script: call PauseTimer(t)
      • Custom script: call DestroyTimer(t)
      • Custom script: set t = null
      • -------- if mana after cast is different from before, an effect is displayed --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si: Condiciones
          • (Maná of (Triggering unit)) No igual a (Load 0 of Key from Table)
        • Entonces: Acciones
          • Efecto especial - Create a special effect attached to the chest of (Load 1 of Key in Table) using war3mapImported\Drain.mdx
          • Efecto especial - Destroy (Last created special effect)
          • Unidad - Set mana of (Load 1 of Key in Table) to (Load 0 of Key from Table)
        • Otros: Acciones
      • Tabla hash - Clear all child hashtables of child Key in Table
      • Custom script: endfunction
      • -------- this function stores the mana of the casting unit --------
      • -------- it starts another function to restore mana in 0 seconds --------
      • Custom script: function StoreMana takes nothing returns nothing
      • Custom script: local timer t = CreateTimer()
      • Custom script: set udg_Key = GetHandleId(t)
      • Tabla hash - Save (Maná of (Triggering unit)) as 0 of Key in Table
      • Tabla hash - Save Handle Of(Triggering unit) as 1 of Key in Table
      • Custom script: call TimerStart(t, 0, false, function RestoreMana)
Your works fine but my does not :(.

EDIT: Solved, i didnt see this.

  • Actions
    • Tabla hash - Create a hashtable
    • Set Table = (Last created hashtable)
THANKS
 
Last edited:
Status
Not open for further replies.
Top