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: 144

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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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