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

Spell leak

Status
Not open for further replies.
Level 7
Joined
Oct 10, 2009
Messages
111
  • Unbreakable Shield INT
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Unbreakable Shield 1
    • Actions
      • Set US_Caster = (Casting unit)
      • Set US_Damage = (((Level of Unbreakable Shield 1 for US_Caster) + (Hero level of US_Caster)) + (Integer(80.00)))
      • Trigger - Turn on Unbreakable Shield Loop <gen>
  • Unbreakable Shield Loop
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Attacked unit) Equal to US_Caster
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Unbreakable Shield 1 for US_Caster) Greater than 0
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Damage taken) Less than or equal to (Real(US_Damage))
                • Then - Actions
                  • Unit - Set life of (Attacked unit) to (Life of (Attacked unit))
                • Else - Actions
                  • Trigger - Turn off (This trigger)
            • Else - Actions
              • Trigger - Turn off (This trigger)
Question : Where does spell leak ?!
Spell should block incoming damage equal to (US_Damage) but it blocks some minor damage (20-30 etc.)
 
Level 4
Joined
Mar 24, 2008
Messages
87
You should make your spell like this :

  • Casting
    • Events
      • Unit - A unit casts a spell
    • Conditions
      • (Ability being cast) Equal to Shield
    • Actions
      • Set ShieldBloc = XX + (Level of (Triggering unit))*X + (Level of Shield for (Triggering unit))*X
      • Trigger - Add to (Shield ON) the event (Unit - (Triggering unit) Takes damages)
      • Trigger - Turn on (Shield ON)
And next trigger :

  • Shield ON
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage taken) Less or equal to ShieldBloc
        • Then - Actions
          • Set ShieldBloc = (ShieldBloc - Damages Taken)
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + Damages Taken)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Damage taken) Greater than ShieldBloc
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + ShieldBloc)
          • Set ShieldBloc = 0
        • Else - Actions
At the end you add an If-Then-Else to Turn off this trigger when ShieldBloc = 0

I bet many things could be better in what i wrote but that's the idea.

And for leaks i don't found one, as reals and units don't leak. It could if you added a special effect to your spell.

Edit : You should make 2 firsts triggers, one to cast and same actions without "Add the event", and one when you learn the spell, which adds the event, and is turned off.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
The following is no good;

1. For each (Integer A) from 1 to 5, do (Actions)...use integer variable...
2. Unit - A unit Begins casting an ability...use starts the effect on ability
3. Set US_Caster = (Casting unit)...use triggering unit
4. Unit - Set life of (Attacked unit) to (Life of (Attacked unit))....DO "Unit - Set life of (Attacked unit) to (Life of (Attacked unit)) - US_Damage....
5. Unit - A unit Is attacked...use periodic time as the loop & use index system...

I see no leak, but as GArfield pointed out, the trigger is really bad...
 
Status
Not open for further replies.
Top