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

[Solved] How to stun a unit

Status
Not open for further replies.
Level 19
Joined
Apr 21, 2013
Messages
1,194
Alright, I tried using the storm bolt too, but somethings not working and my units not being stunned.

  • Every 4th Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Quick Attack
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • STUNCOUNTER Equal to 4
        • Then - Actions
          • Unit - Create 1 STUN DUMMY for Player 2 (Blue) at QcasterLoc facing Default building facing degrees
          • Set STUNDUMMY = (Last created unit)
          • Set STUNCOUNTER = 0
          • Unit - Order STUNDUMMY to Human Mountain King - Storm Bolt Qcaster
          • Unit - Pause Qcaster
          • Wait 2.00 seconds
          • Unit - Unpause Qcaster
        • Else - Actions
          • Set STUNCOUNTER = (STUNCOUNTER + 1)
Ignore those Pause, wait and unpause lines they are turned off in the editor.
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
It is from another trigger, there is only one unit on the map that can be QCaster so storing the unit there is no problem. The stun works with this current line now but it works in a weird way, it randomly counts up to 4 :S

QCaster is the stored unit that casts the spell "Quick Attack"

  • Every 4th Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Quick Attack
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • STUNCOUNTER Equal to 4
        • Then - Actions
          • Unit - Create 1 STUN DUMMY for Player 2 (Blue) at QcasterLoc facing Default building facing degrees
          • Set STUNDUMMY = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to STUNDUMMY
          • Unit - Add Storm Bolt ASD to STUNDUMMY
          • Set STUNCOUNTER = 0
          • Unit - Order STUNDUMMY to Human Mountain King - Storm Bolt Qcaster
        • Else - Actions
          • Set STUNCOUNTER = (STUNCOUNTER + 1)
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
Check it then :D I'd be glad to get your feedback as well. I'm trying to develop a combat system, where you can attack with Q or E and connecting them for combos. But as in modern games you should not be able to attack endlessly, you can get staggered by an enemy attack and lose your attacking chance. This is just the base.

I'm trying to add the staggering part right now. So there is only this stun trigger for only the Q attacks. The others are there to be changed. I only changed the "Q" trigger.
 

Attachments

  • CombatFromthe other campaign.w3x
    2.8 MB · Views: 32
Level 19
Joined
Apr 21, 2013
Messages
1,194
Ohhh right!! It starts from 0. Not 1. I always cant see these little details at first :D alright thanks for the help !!

If you dont mind would you answer another question? How can i start the cooldown of the other attack spell whenever i use the other one?

And additionally, would you suggest anything else to improve the efficiency of the coding?
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
It would logically make more sense to start at 0. You just need to move the counter up to the top like this:

  • Every 4th Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Quick Attack
    • Actions
      • Set STUNCOUNTER = (STUNCOUNTER + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • STUNCOUNTER Equal to 4
        • Then - Actions
          • Unit - Create 1 STUN DUMMY for Player 2 (Blue) at QcasterLoc facing Default building facing degrees
          • Set STUNDUMMY = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to STUNDUMMY
          • Unit - Add Storm Bolt ASD to STUNDUMMY
          • Unit - Order STUNDUMMY to Human Mountain King - Storm Bolt Qcaster
          • Set STUNCOUNTER = 0
        • Else - Actions
If you dont mind would you answer another question? How can i start the cooldown of the other attack spell whenever i use the other one?
I wouldn't know how to do that.

And additionally, would you suggest anything else to improve the efficiency of the coding?
Instead of creating one dummy unit everytime you reach the 4th counter, just have one that will always act as your STUNDUMMY and move it around to cast the spell when you have to.
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
It would logically make more sense to start at 0. You just need to move the counter up to the top like this:

  • Every 4th Attack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Quick Attack
    • Actions
      • Set STUNCOUNTER = (STUNCOUNTER + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • STUNCOUNTER Equal to 4
        • Then - Actions
          • Unit - Create 1 STUN DUMMY for Player 2 (Blue) at QcasterLoc facing Default building facing degrees
          • Set STUNDUMMY = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to STUNDUMMY
          • Unit - Add Storm Bolt ASD to STUNDUMMY
          • Unit - Order STUNDUMMY to Human Mountain King - Storm Bolt Qcaster
          • Set STUNCOUNTER = 0
        • Else - Actions

I wouldn't know how to do that.


Instead of creating one dummy unit everytime you reach the 4th counter, just have one that will always act as your STUNDUMMY and move it around to cast the spell when you have to.


Hmmm, that makes more sense ill change it when im on PC.

For the cooldown I can show the passive icon version of the other which cannot be activated when the other is active then.

Ohh, i can do that yeah, thanks for all the answers matey!! I'll +Rep when im on PC again ^^
 
Status
Not open for further replies.
Top