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

[Spell] Omnislash problem *sigh*

Status
Not open for further replies.
Level 3
Joined
Jul 26, 2013
Messages
41
  • Omnislash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Omnislash
    • Actions
      • Set o = (Triggering unit)
      • Set t = (Target unit of ability being cast)
      • Set tl = (Position of t)
      • If ((Level of Omnislash for o) Equal to 1) then do (Set Omnislash_Loops = 2) else do (Do nothing)
      • If ((Level of Omnislash for o) Equal to 2) then do (Set Omnislash_Loops = 4) else do (Do nothing)
      • If ((Level of Omnislash for o) Equal to 3) then do (Set Omnislash_Loops = 7) else do (Do nothing)
      • Unit - Make o Invulnerable
      • Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
      • Selection - Remove o from selection for (Owner of o)
      • Unit - Move o instantly to (Random point in (Region centered at tl with size (100.00, 100.00)))
      • Unit - Make o face tl over 0.01 seconds
      • Custom script: call RemoveLocation(udg_tl)
      • Animation - Play o's attack animation
      • Unit - Cause o to damage t, dealing ((Random real number between 100.00 and 200.00) + ((Real((Strength of o (Include bonuses)))) + (Real((Agility of o (Include bonuses)))))) damage of attack type Hero and damage type Normal
      • Special Effect - Create a special effect attached to the chest of o using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • For each (Integer A) from 1 to Omnislash_Loops, do (Actions)
        • Loop - Actions
          • Wait 0.30 game-time seconds
          • Set o_current_loc = (Position of o)
          • Set EG[1] = (Units within 600.00 of o_current_loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True) and ((((Matching unit) is A flyin
          • Set EG[2] = (Random 1 units from EG[1])
          • Custom script: call RemoveLocation(udg_o_current_loc)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of units in EG[1]) Greater than 0
            • Then - Actions
              • Unit Group - Pick every unit in EG[2] and do (Actions)
                • Loop - Actions
                  • Set p = (Picked unit)
                  • Set pl = (Position of p)
                  • Selection - Remove o from selection for (Owner of o)
                  • Unit - Move o instantly to (Random point in (Region centered at pl with size (100.00, 100.00)))
                  • Unit - Make o face pl over 0.01 seconds
                  • Custom script: call RemoveLocation(udg_pl)
                  • Animation - Play o's attack animation
                  • Unit - Cause o to damage p, dealing ((Random real number between 100.00 and 200.00) + ((Real((Strength of o (Include bonuses)))) + (Real((Agility of o (Include bonuses)))))) damage of attack type Hero and damage type Normal
                  • Special Effect - Create a special effect attached to the chest of o using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call DestroyGroup(udg_EG[1])
                  • Custom script: call DestroyGroup(udg_EG[2])
            • Else - Actions
              • Custom script: call DestroyGroup(udg_EG[1])
              • Custom script: call DestroyGroup(udg_EG[2])
              • Selection - Add o to selection for (Owner of o)
              • Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
              • Unit - Make o Vulnerable
      • Selection - Add o to selection for (Owner of o)
      • Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
      • Unit - Make o Vulnerable
I have a problem on this trigger, I modified the original abit (original link -> http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=38947 ) because my caster would always teleport to the East side of my target so I tryed to make it more random but I'm not sure how that messed the trigger... anyways, the problem is that if I kill a unit with 1-2 slashes, my caster reverts to its vulnerable state, BUT if I walk to another enemy unit, he automatically starts slashing the remaining number of slashes (if my target died from 2 slashes, he would cast another 5 on the other unit when I aproach it)

One more thing I've noticed... the Base spell of Omnislash doesn't seem to activate it's cooldown... the mana cost still applyes though.
 
Last edited:
Level 26
Joined
Sep 26, 2009
Messages
2,420
Just for future ideas

instead of this:
  • If ((Level of Omnislash for o) Equal to 1) then do (Set Omnislash_Loops = 2) else do (Do nothing)
    • If ((Level of Omnislash for o) Equal to 2) then do (Set Omnislash_Loops = 4) else do (Do nothing)
    • If ((Level of Omnislash for o) Equal to 3) then do (Set Omnislash_Loops = 7) else do (Do nothing)
you can use this:
  • Set i = (Integer((2.40 x (Real(n)))))
where "i" is "Omnislash_Loops" and "n" is level of ability used.
What it does is that it converts "n" into real number, multiplies it by 2,4 => thus if level of ability used is 2, then you have 2.0*2.4 => 4.8 and you convert this number back to integer, which will delete everything behind period, thus 4.8 real is 4 integer.

The reason why this is better is also because in each ITE the "else" action is "do nothing" which actually calls an empty function. You should avoid the "Do nothing" action everywhere.


Also don't use waits. Waits are inaccurate and it gets prolonged by ping of a player (if your map is for multiplayer). Try to use either a timer or a periodic loop.

---
  • Unit - Move o instantly to (Random point in (Region centered at tl with size (100.00, 100.00)))
This leaks a location. If you want your unit to move to somewhere around the target, then you can use polar projection (point with polar offset).
  • Set loc1 = (Position of *Target*)
  • Set loc2 = (loc1 offset by 256.00 towards (Random angle) degrees)
Note, that just like I posted in the trigger above, you need 2 point variables for this to make this leakless - one that saves location of the target and the second that saves the offset location.


Tbh, to fix this spell you could try to add in the "Else" section of the big ITE, where you have this actions:
  • Custom script: call DestroyGroup(udg_EG[1])
    • Custom script: call DestroyGroup(udg_EG[2])
    • Selection - Add o to selection for (Owner of o)
    • Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
    • Unit - Make o Vulnerable
also this action:
  • Set Integer A = Omnislash_Loops
This way the trigger should end when it runs the next time, because currently if you make 2 slashes (out of 7) and then have noone nearby, the spell will still loop another 5 times (in other words until 7 loops have passed).

Also, instead of Integer A create your own integer variable which you will use in loops. It's more efficient that way.
 
Level 26
Joined
Sep 26, 2009
Messages
2,420
The problem is that you move the unit before the cooldown starts. That way the spell gets 'interrupted', so no cooldown starts. You either have to wait a little before you move the unit, or move the unit via "setUnitX and Y" commands.
 
Status
Not open for further replies.
Top