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

Button Click Attack with Animations

Status
Not open for further replies.
Level 31
Joined
Apr 17, 2009
Messages
3,571
Hello Hive,
I'm working on my Zelda Campaign and decided to improve it by making an atack system. There shall be an ability called "Sword Atack" per Hotkey "A".
Every time you use this spell the unit plays his atack animation and all units in front of the unit will get damage.

This is the theory.
But how can I do it?
On which ability shall I base this?
How can I pick only the units in front of the casting unit?

Tell me what you think

chilla_killa
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
EVENT-unit starts casting an ability
CONDITIONS-ability being cast equal to Sword Attack
ACTIONS
play casting unit attack animation
set UNITGROUP = <unit that you want to pick>
picke every unit in unitgroup and do actions
cause casting unit to deal <X> damage to picked unit
call DestroyGroup8udg_UNITGROUP)
 
Level 5
Joined
Sep 21, 2005
Messages
119
I agree with ALiEN95, also, add some effects to every picked unit, and remember to do Special Effect- Destroy (Last Created Effect) so they don't leak.

Oh and remember that A is also the default hotkey for Attack in general, so you can actually try and do Combat - Show UI = False in your hero, that'll take away the buttons; good because he's only going to be using A anyway, no need to have the annoying attack and hold position buttons in there.

~Gloom
 
Level 31
Joined
Apr 17, 2009
Messages
3,571
I tried the way like DarkAngel said, but somehow it doesn't work.
Maybe I just understood it false.
Heres the trigger. What's wrong?
  • Sword Atack
    • Ereignisse
      • Einheit - A unit Beginnt, eine Fähigkeit zu wirken
    • Bedingungen
      • (Ability being cast) Gleich Sword Atack
    • Aktionen
      • Einheit - Order (Casting unit) to Stoppen
      • Animation - Play (Casting unit)'s attack - 3 animation
      • Einheitengruppe - Pick every unit in (Units within 256.00 of (Position of (Casting unit))) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • And - All (Conditions) are true
                • Bedingungen
                  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Kleiner als ((Integer((Facing of (Casting unit)))) + 30)
                  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Größer als ((Integer((Facing of (Casting unit)))) - 30)
            • 'THEN'-Aktionen
              • Einheit - Cause (Casting unit) to damage (Picked unit), dealing 5.00 damage of attack type Normal and damage type Normal
            • 'ELSE'-Aktionen
              • Do nothing
 
Level 10
Joined
Jan 28, 2009
Messages
442
I can't see what's wrong with that trigger. Though, I can think of an easier sollution, which I might had used:
Set BlastCenter to position of Casting Unit offset by ... towards facing angle of Casting Unit.
Pick every unit in: Units within range ... of BlastCenter, and do actions.
Cause Casting Unit to damage Picked Unit, dealing Q damage bla bla

Your trigger should work as well, only, I think it would make Casting Unit damage itself, because casting unit is within range 256 of its position, and its facing angle is less than its facing angle + 30 and greater than its angle - 30.
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
if the event is -unit begins casting an ability you must use wait 0.01 seconds and than you can play animation Animation - Play (Casting unit)'s attack - 3 animation

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • 'IF'-Bedingungen
  • And - All (Conditions) are true
  • Bedingungen
  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Kleiner als ((Integer((Facing of (Casting unit)))) + 30)
  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Größer als ((Integer((Facing of (Casting unit)))) - 30

can this conditions ever be true?

its like you want something to be no and yes in the same time 0_0
 
Level 31
Joined
Apr 17, 2009
Messages
3,571
Button Click Atack with Animations

Hello Hive,
I wanted to create a triggered "spell", if you use this ability "Sword Atack",
the atack animation is played and units in front of the casting units are damaged.
DarkAngel told me a possibilty, but somehow it doesn't work.
Maybe I just understood it false.
Heres the trigger. What's wrong with it?
No units are picked.

  • Sword Atack
    • Ereignisse
      • Einheit - A unit Beginnt, eine Fähigkeit zu wirken
    • Bedingungen
      • (Ability being cast) Gleich Sword Atack
    • Aktionen
      • Einheit - Order (Casting unit) to Stoppen
      • Animation - Play (Casting unit)'s attack - 3 animation
      • Einheitengruppe - Pick every unit in (Units within 256.00 of (Position of (Casting unit))) and do (Actions)
        • Schleifen - Aktionen
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Bedingungen
              • And - All (Conditions) are true
                • Bedingungen
                  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Kleiner als ((Integer((Facing of (Casting unit)))) + 30)
                  • (Integer((Angle from (Position of (Picked unit)) to (Position of (Casting unit))))) Größer als ((Integer((Facing of (Casting unit)))) - 30)
            • 'THEN'-Aktionen
              • Einheit - Cause (Casting unit) to damage (Picked unit), dealing 5.00 damage of attack type Normal and damage type Normal
            • 'ELSE'-Aktionen
              • Do nothing
chilla_killa
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
remove the "do nothing" action.

And your trigger leaks, in the unit groups and positions. You are converting the angles into Intergers, dont do it, keep them as reals.

Oh, and you are using wierd angles.

Try to do this:

  • Sword attack
    • Events
      • Unit - A unit starts the effect of an abillity
    • Conditions
      • Abillity bieng cast equal to (Sword attack)
    • Actions
      • Unit - Order (casting unit) to stop
      • Animation - Play (Triggering unit)s attack - 3 animation
      • Pick every unit in (units within 250 range of posistion of triggering unit) and do actions
        • If all conditions are true, then do (then) actions else do (else actions)
          • Real - Angle between (position of (triggering unit)) and (position of (picked unit) is (less than or equal to) (Facing angle of (triggering unit) + 30)
          • Real - Angle between (position of (triggering unit)) and (position of (picked unit) is (greater than or equal to) (Facing angle of (triggering unit) - 30)
        • Then - actions
          • Unit - Cause (triggering unit) to damage (picked unit) dealing 5 damage of damage type normal
        • Else - actions
This should work, but it will leak. Im too lazy to fix the leaks myself, so you can do it...
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
2 leaks (he said there would be though).

Leakless:
  • Events
    • Unit - A unit starts the effect of an abillity
  • Conditions
    • Abillity bieng cast equal to (Sword attack)
  • Actions
    • Set TempLoc = position of triggering unit
    • Set TempGroup = units within 250 range of TempLoc
    • Unit - Order (casting unit) to stop
    • Animation - Play (Triggering unit)s attack - 3 animation
    • Pick every unit in (TempGroup) and do actions
      • If all conditions are true, then do (then) actions else do (else actions)
        • Real - Angle between (position of (triggering unit)) and (position of (picked unit) is (less than or equal to) (Facing angle of (triggering unit) + 30)
        • Real - Angle between (position of (triggering unit)) and (position of (picked unit) is (greater than or equal to) (Facing angle of (triggering unit) - 30)
      • Then - actions
        • Unit - Cause (triggering unit) to damage (picked unit) dealing 5 damage of damage type normal
      • Else - actions
    • Custom script: call RemoveLocation(udg_TempLoc)
    • Custom script: call DestroyGroup(udg_TempGroup)
 
Status
Not open for further replies.
Top