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

Making a unit attack incredibly fast

Status
Not open for further replies.

Oli

Oli

Level 4
Joined
Aug 9, 2015
Messages
42
I have a trigger that moves a unit by the "instantly move unit" function in a repetitive timer that expires per 0.05 seconds, however i want the same unit be able to attack in-between the timer expirations. Tried reducing the attack speed, combat animation backswing point and damage point of the unit to 0, furthermore i've made it so that everytime the timer expires the unit is forced to face an enemy and attack it. However, the unit is either attacking once or twice, and sometimes not at all.
The map is attached.
There are other bugs in the script i'm working on to fix.
I would be grateful for any help to fix that bug.
 

Attachments

  • RVM.w3m
    21.1 KB · Views: 38
The "instantly move unit" function also orders the unit to stop, which might explain the bug where the flying machine doesn't attack. For the flying machine, try using the following natives for changing the unit's position instead.

JASS:
native SetUnitX takes unit whichUnit, real x returns nothing
native SetUnitY takes unit whichUnit, real y returns nothing

The functions above can be invoked by selecting the custom script in the actions tab and pasting the following:

  • Custom script: call SetUnitX(gg_unit_hgyr_0005, udg_point2)
  • Custom script: call SetUnitY(gg_unit_hgyr_0005, udg_point1)

EDIT:

Changing the attack cooldown of the flying machine can be done as follows:
  • Modified Base Cooldown
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Flying Machine
        • Then - Actions
          • Unit - Set Attack Interval of (Triggering unit) to 0.05 for weapon index: 1
        • Else - Actions
 
  • Like
Reactions: Oli

Oli

Oli

Level 4
Joined
Aug 9, 2015
Messages
42
The "instantly move unit" function also orders the unit to stop, which might explain the bug where the flying machine doesn't attack. For the flying machine, try using the following natives for changing the unit's position instead.

JASS:
native SetUnitX takes unit whichUnit, real x returns nothing
native SetUnitY takes unit whichUnit, real y returns nothing

The functions above can be invoked by selecting the custom script in the actions tab and pasting the following:

  • Custom script: call SetUnitX(gg_unit_hgyr_0005, udg_point2)
  • Custom script: call SetUnitY(gg_unit_hgyr_0005, udg_point1)

EDIT:

Changing the attack cooldown of the flying machine can be done as follows:
  • Modified Base Cooldown
    • Events
      • Unit - A unit enters (Playable map area)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Flying Machine
        • Then - Actions
          • Unit - Set Attack Interval of (Triggering unit) to 0.05 for weapon index: 1
        • Else - Actions
Thanks a lot. It worked.
 
Status
Not open for further replies.
Top