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

Defend - an ability overhaul v. 1.2b

  • Like
Reactions: EmoBrother
Well hi,

I was always intrigued by the Defend ability and I think it has a really neat mechanic to it - the deflection part. However there is one thing I dislike on the original ability and that is the toggle aspect of it. This is why I decided to remake this ability making it a regular spell cast with a duration and a cooldown. I am by no means a WE expert so please excuse the use of "wait" function, I found no way around it. Oh yes this ability also deflects attacks of magical type which is intended, this can be changed in the object editor.

The spell itself is fairly simple and is MUI, but if anyone needs an explanation for the triggers and my reasoning behind them feel free to ask. I dont ask for approval but I could use some directions regarding solving of my "wait" problem. So some constructive feedback appreciated =D.

PS: Please dont mind the map itself, it is something I do in the free time to entertain myself :D

PPS: For fellow spell testers - the trolls are meant to attack the guards, triggering their Defend, you can try the spell at the neutral camps. Dont expect the trolls to attack your units.

HUGE EDIT: Removed the waits completely, changed variable names, added a hero leveled version of the spell. Should hopefully work (it did for me). There should be no memory leaks as no unit groups, locations or other variables for that matter were created. Feel free to point out any mistakes, I couldnt find any anymore.

EDIT 2: Okay this is hopefully the last edit. I added import instructions for even bigger World Editor nubs than me x). Although this spell is really simple, it is meant to be used in a regular melee map - NO FANCY BZNS. I believe it is fairly well balanced as it has roughly 50% deflection uptime as opposed to 30% of the default ability, however it doesnt reduce incoming damage in the spare time. Thats about all I wanted to add and I hope at least someone finds this spell useful. PEACE!!

Triggers (only the spell related ones - only hero version, unit version is the same without levels):

  • Defend
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Defend Custom (hero)
    • Actions
      • Set Defend_MaxIndex = (Defend_MaxIndex + 1)
      • Set Defend_Caster[Defend_MaxIndex] = (Triggering unit)
      • Set Defend_Counter[Defend_MaxIndex] = (4.00 + (Real((Level of Defend Custom (hero) for Defend_Caster[Defend_MaxIndex]))))
      • Animation - Add the defend animation tag to Defend_Caster[Defend_MaxIndex]
      • Unit - Add Spell Book, Defend to Defend_Caster[Defend_MaxIndex]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Defend_MaxIndex Equal to 1
        • Then - Actions
          • Trigger - Turn on DefendLoop <gen>
        • Else - Actions
  • DefendLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer Defend_CurrentIndex) from 1 to Defend_MaxIndex, do (Actions)
        • Loop - Actions
          • Set Defend_Counter[Defend_CurrentIndex] = (Defend_Counter[Defend_CurrentIndex] - 0.03)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Defend_Counter[Defend_CurrentIndex] Less than or equal to 0.00
            • Then - Actions
              • Animation - Remove the defend animation tag to Defend_Caster[Defend_CurrentIndex]
              • Unit - Remove Spell Book, Defend from Defend_Caster[Defend_CurrentIndex]
              • Set Defend_Caster[Defend_CurrentIndex] = Defend_Caster[Defend_MaxIndex]
              • Set Defend_Counter[Defend_CurrentIndex] = Defend_Counter[Defend_MaxIndex]
              • Set Defend_MaxIndex = (Defend_MaxIndex - 1)
              • Set Defend_CurrentIndex = (Defend_CurrentIndex - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Defend_MaxIndex Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions


Keywords:
spell, ability, defend, deflection, self cast, GUI, MUI, melee map
Contents

Defend testing map v1.0 (Map)

Reviews
20:39, 22nd Nov 2013 Maker: The system is useful and it works

Moderator

M

Moderator

20:39, 22nd Nov 2013
Maker: The system is useful and it works
 
Level 3
Joined
Sep 1, 2009
Messages
37
Hello :3

hey, first advice. post the trigger...
if you have problem with "wait" action, I can make the custom one for you if you want it. :)

Well... Im a super nub so no idea how to post triggers. I remember in the past I attempted to replace waits with a "timer expires" event, however I wasnt able to add an array to the timer in the event so it completely defeated the purpose of it making it not MUI. I really want to get better at this now though, that is why I posted this simple spell here to get a feedback. =D

I will post the triggers here once I figure out how..
 
Last edited:
Level 3
Joined
Sep 1, 2009
Messages
37
hey fix your test map, the orcs wont attack my unit. so how can I test you spell then? :/

The trolls are too strong, they are there to demonstrate the deflection by the guards (they die in one deflect). You can walk up to the neutral camps and try it out yourself there. Thats how I intended it anyways, shoulda written it in the description :/.

congratulations :p

well, this is the first time I see an indexing like that. It's actually works 100% but I dont know mods will approve it or not (as far as I know mods never lets spell with polled wait approved) but anyway, good luck with it,..

I understand. Ive been lectured on the waits before... The thing is I have no idea how to replace them, Ive tried a lot of methods before but in the end they always create more problems than they solved. Maybe if I created a timer event for every index from 1-100 individually to replace the waits. This would be semi MUI as long as there arent over 100 units casting at the same time (I think???). However this would 1. take ages to create all the triggers 2. take up so much space itd look disgusting. Im too dumb for this v_v.

PS: I should really just edit my posts instead of clogging up the space here. GJ ME
 
Last edited:
Level 3
Joined
Sep 1, 2009
Messages
37
  • Get rid of the wait, use a timer or timers instead
  • The variable names are too generic
  • Abilities must support levels
  • The movement speed could be set at object editor, that way it is displayed in
    red in the tooltip like for the default Defend ability

To adress this:
As I said waits are my weakness.

I dont see any reason to change the variable names - doesnt seem very important. But I suppose it could be done if someone wants to copy this spell into his map where hes already using those variable names for something different.

As for the leves, wouldnt be too hard but Id first like to get rid of the wait somehow.

I tried setting the movement speed at object editor but it doesnt work for the passive ability only the toggle, so I had to set it in the trigger.
 

Kazeon

Hosted Project: EC
Level 34
Joined
Oct 12, 2011
Messages
3,449
it "just" looks hard. you are just too lazy to read it completely.. I have recently learn something. you can also use countdown timer to make this works. I bet your system fails because you use timer variable with array. you should initialize the variable first.
use custom script
  • Custom script: set udg_countdowntimer[index] = CreateTimer()
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
...if someone wants to copy this spell into his map where hes already using those variable names for something different.

Exactly. Those variables must not be used for anything else in the map than for this spell.

I tried setting the movement speed at object editor but it doesnt work for the passive ability only the toggle, so I had to set it in the trigger.

Set it for the spell that is based on Berserk.
 
Level 3
Joined
Sep 1, 2009
Messages
37
it "just" looks hard. you are just too lazy to read it completely.. I have recently learn something. you can also use countdown timer to make this works. I bet your system fails because you use timer variable with array. you should initialize the variable first.
use custom script
  • Custom script: set udg_countdowntimer[index] = CreateTimer()

Yeah Im starting to get a hold of it. I was using a countdown timer with an array action yes. In the second trigger Id use "the timer has expired" as an event however I wasnt able to put an index variable as an array in the second trigger determining which timer Im refering to, so there was no point to use it.

I dont understand the custom scripts too well. If I fail to understand the tutorial I might PM you later on and ask for some questions. If you dont mind of course.

Edit: Nvm, I think I understand the tutorial perfectly. I will try to correct my spell now and update it once I get it working. Maybe make it a hero ability with levels as well. =D

Exactly. Those variables must not be used for anything else in the map than for this spell.



Set it for the spell that is based on Berserk.

I understand. Didnt realize berserk has an option to limit movement speed as well. Sorry
 
Last edited by a moderator:
Level 3
Joined
Sep 1, 2009
Messages
37
Set the time to 4 + level of ability in the cast trigger, then subtract from it in the looping trigger. Then you only need to check <= 0.

Damn I shoudlve noticed that, too tired to think atm. Well it wouldnt work if I used more complex non linear durations (or maybe you would prove me wrong once again). Ill fix that right away.

As for the rest of the stuff, is it alright?

EDIT: Did as you told me to, the loop trigger looks overall more smooth now without "if" conditions for every level of the spell. Hopefully thats all.
 
Last edited:
Top