Tower stops attacking after an upgrade, help fix that

Exoudar

New Member
Reaction score
2
Hello there,

sometimes after I upgrade the tower it stops attacking and I need to right click creeps to make it auto attack again.

I made a trigger to fix that but its annoying and requires me to do that trigger for every singler tower upgrade I made :(

here is the trigger

Trigger:
  • setting target
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Sniper Tower
          • (Unit-type of (Attacking unit)) Equal to Sniper Tower (Upgrade level 1)
          • (Unit-type of (Attacking unit)) Equal to Sniper Tower (Upgrade level 2)
          • (Unit-type of (Attacking unit)) Equal to Sniper Tower (Upgrade level 3)
    • Actions
      • Hashtable - Save Handle Of(Attacked unit) as (Key (Attacking unit)) of 0 in Carful_Aim_Hashtable



Trigger:
  • Fixing sniper tower auto attack
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Sniper Tower (Upgrade level 1)
          • (Unit-type of (Triggering unit)) Equal to Sniper Tower (Upgrade level 2)
          • (Unit-type of (Triggering unit)) Equal to Sniper Tower (Upgrade level 3)
    • Actions
      • Unit - Order (Triggering unit) to Attack (Load (Key (Attacked unit)) of 0 in Carful_Aim_Hashtable)



is there any other way?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
Convert Unit type to string and compare the first 12 digits in a substring like so:
Trigger:
  • Conditions
    • Substring(1, 12, String(Unit type of (Triggering unit))) is equal to Sniper Tower

(string comparison)

Basically it compares the first 12 digits of the unit type converted into a string thats the: Substring(1, 12, string) part, substring refers to a piece of a string beginning at digit a ending at digit b, so 1 to 12 (including a and b)
 

Exoudar

New Member
Reaction score
2
Convert Unit type to string and compare the first 12 digits in a substring like so:
Trigger:
  • Conditions
    • Substring(1, 12, String(Unit type of (Triggering unit))) is equal to Sniper Tower

(string comparison)

Basically it compares the first 12 digits of the unit type converted into a string thats the: Substring(1, 12, string) part, substring refers to a piece of a string beginning at digit a ending at digit b, so 1 to 12 (indluding a and b)

thanks for the fast replay,

I only have 3 snipers towers, but thats not the case.

I have to do this for every other towers with different names i have?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
if there is an issue with every tower than yes, idk what would cause a glitch like that, unless you based them off a passive type tower and need to base them off an auto-attacking type tower
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Try to just issue the towers the order "stop" right after the upgrade did finish.
The tower wont attack the same target as before this way but its auto attack will resume and it will save alot of performance and memory.
 

Exoudar

New Member
Reaction score
2
Try to just issue the towers the order "stop" right after the upgrade did finish.
The tower wont attack the same target as before this way but its auto attack will resume and it will save alot of performance and memory.

actually I dont want it to attack the same target, I'll try the "stop" order, thanks
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top