Detect units base damage/tower Level

Raizn

New Member
Reaction score
2
Hi Helpers,

im on a special tower for my td. the basic idea of the tower is to make him use a custom impale (basic damage 1-1) dealing xtradamage for the summary of all players towers base damage. So i dont think there is a way to detect how much base damage a unit has so i decided to set an integer array by myself and count the damage. But i dont know how to detect if a tower got an upgrade and now has level x.

so my basic idea was:

a unit enters playable map area.

if entering unit is tower X lvl 1
then set damage[] = damage [] + basedamage1

else
if entering unit is tower X lvl 2
then set set damage[] = damage [] + basedamage1 + Y

but that will only work for towers level 1. anybody a smart idea how to solve this lagless/leakless and short ?

bye
raizn
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
Create another trigger, event should be like this

Use this event for your tower 2.

Trigger:
  • Events
    • Unit - A unit Finishes an upgrade


And the action is your
if TRIGGERING unit is tower X lvl 2
then set set damage[] = damage [] + basedamage1 + Y
 

Raizn

New Member
Reaction score
2
Ok that works fine now. but i got another problem with my impale. how do i get that impales towards the attacked units ?

Trigger:
  • Custom Impale
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Impale Tower
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 dummy for (Owner of (Attacking unit)) at ((Position of (Attacking unit)) offset by ((Real((Integer A))) x 150.00) towards ((That fucked up)) degrees) facing (Position of (Attacked unit))
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Wait 0.50 seconds
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
Ok that works fine now. but i got another problem with my impale. how do i get that impales towards the attacked units ?

Trigger:
  • Custom Impale
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Impale Tower
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Unit - Create 1 dummy for (Owner of (Attacking unit)) at ((Position of (Attacking unit)) offset by ((Real((Integer A))) x 150.00) towards ((That fucked up)) degrees) facing (Position of (Attacked unit))
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Wait 0.50 seconds

Your impale may cause bugs if your tower's attack speed is fast and there is mass of impale towers.

Try this

Trigger:
  • Unit - Create 1 Mr. Boom Baby for (Owner of (Attacking unit)) at ((Position of (Triggering unit)) offset by ((Real((Integer A))) x 150.00) towards (Angle From (Position of (Attacking unit)) To (Position of (Attacked unit))) degrees) facing (Facing of (Attacking unit)) degrees
 

Raizn

New Member
Reaction score
2
Your impale may cause bugs if your tower's attack speed is fast and there is mass of impale towers.

Try this

Trigger:
  • Unit - Create 1 Mr. Boom Baby for (Owner of (Attacking unit)) at ((Position of (Triggering unit)) offset by ((Real((Integer A))) x 150.00) towards (Angel From (Position of (Attacking unit)) To (Position of (Attacked unit))) degrees) facing (Facing of (Attacking unit)) degrees

that tower will be unique for each player with a 4 sek cd. that should be fine right ?
 

Bogrim

y hello thar
Reaction score
154
The problem with your second trigger is it bugs and leaks a lot. You have made the mistake of putting a wait in a loop using a global variable. Now the thing about global variables such as Integer A - which is a preset variable in the World Editor - is that any other trigger may change its value during the wait and break your loop. That's what breaks the MUI ability.

My suggestion is to create a small system using a large array to account for all the towers that could be attacking at the same time. You should also be using local variables.
Trigger:
  • Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Impale Tower
          • (Unit-type of (Attacking unit)) Equal to Advanced Impale Tower
    • Actions
      • If ((Unit-type of (Attacking unit)) Equal to Advanced Impale Tower) then do (Set Temp_Boolean = True) else do (Set Temp_Boolean = False)
      • If (Temp_Boolean Equal to True) then do (Game - Display to (All players) the text: upgraded attack) else do (Do nothing)
      • Set Temp_Location[0] = (Position of (Attacked unit))
      • Set Temp_Location[1] = (Position of (Attacking unit))
      • Set Temp_Player = (Owner of (Attacking unit))
      • Set Temp_Real = 1000.00
      • If (Array Equal to 100) then do (Set Array = 1) else do (Set Array = (Array + 1))
      • Trigger - Run Loop <gen> (ignoring conditions)

Trigger:
  • Loop
    • Events
    • Conditions
    • Actions
      • Custom script: local boolean b = udg_Temp_Boolean
      • Custom script: local integer i = udg_Array
      • Custom script: local location l0 = udg_Temp_Location[0]
      • Custom script: local location l1 = udg_Temp_Location[1]
      • Custom script: local player p = udg_Temp_Player
      • Custom script: local real r = udg_Temp_Real
      • Set Temp_Integer = Array
      • For each (Integer C[Temp_Integer]) from 1 to 10, do (Actions)
        • Loop - Actions
          • Custom script: set udg_Temp_Boolean = b
          • Custom script: set udg_Temp_Location[0] = l0
          • Custom script: set udg_Temp_Location[1] = l1
          • Custom script: set udg_Temp_Player = p
          • Custom script: set udg_Temp_Real = r
          • Set Temp_Location[2] = (Temp_Location[1] offset by ((Temp_Real / 10.00) x (Real(C[Temp_Integer]))) towards (Angle from Temp_Location[1] to Temp_Location[0]) degrees)
          • Unit - Create 1 Impale Unit for Temp_Player at Temp_Location[2] facing Default building facing degrees
          • If (Temp_Boolean Equal to True) then do (Unit - Set level of Kaboom! (Clockwerk Goblin-Level 3) for (Last created unit) to 2) else do (Do nothing)
          • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Add a 0.54 second Generic expiration timer to (Last created unit)
          • Custom script: call RemoveLocation( udg_Temp_Location[2] )
          • Wait 0.27 seconds
          • Custom script: set udg_Temp_Integer = i
      • Custom script: call RemoveLocation( l0 )
      • Custom script: call RemoveLocation( l1 )
      • Custom script: set l0 = null
      • Custom script: set l1 = null
      • Custom script: set p = null

Trigger:
  • Dust
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Impale Unit
    • Actions
      • Set Temp_Location[0] = (Position of (Triggering unit))
      • Special Effect - Create a special effect at Temp_Location[0] using Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation( udg_Temp_Location[0] )

Here's an image of the trigger in work and the test map below:
ImpalingTower.jpg


Edit: In the trigger map example I used the Kaboom ability to cause the damage. But you can just cause the damage in the death trigger using variables to detect the total amount of towers rather than Kaboom.
 

Attachments

  • Impale Tower.w3x
    20.5 KB · Views: 143

Raizn

New Member
Reaction score
2
ty Bogrim i will test that tomorrow.

if you dont mind ill ask you upcoming questions via PM.

bye
raizn
 
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