A tower that summon element every 12 second

Exoudar

New Member
Reaction score
2
Hello there,

In my TD I am trying to make a tower that will summon water element every 12 sec.

I tried :


Summoner Tower
Events
Unit - A unit Finishes construction
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of (Constructed structure)) Equal to Summoner Tower
Then - Actions
Set Summoner_Tower_1 = (Constructed structure)
Unit - Order Summoner_Tower_1 to Human Archmage - Summon Water Elemental
Trigger - Turn on Summoning <gen>
Else - Actions




And then :

Summoning
Events
Time - Every 12.00 seconds of game time
Conditions
Actions
Unit - Order Summoner_Tower_1 to Human Archmage - Summon Water Elemental


(Summoning trigger is turned off initially)
 

Necrach

You can change this now in User CP.
Reaction score
62
Instead of having an actual skill on the tower, just have one single trigger that is a periodic similar to your Summoning one, but that picks every tower and summons a water elemental by it;

Code:
summoning
    Events
        Time - Every 12.00 seconds of game time
    Conditions
    Actions
        Set temp_group = (Units of type YOUR TOWER)
        Unit Group - Pick every unit in temp_group and do (Actions)
            Loop - Actions
                Set temp_point = (Position of (Picked unit))
                Unit - Create 1 Water Elemental (Level 1) for (Owner of (Picked unit)) at temp_point facing Default building facing degrees
                Unit - Add a 30.00 second Water Elemental expiration timer to (Last created unit)
                Custom script:   call RemoveLocation (udg_temp_point)
        Custom script:   call DestroyGroup (udg_temp_group)
and you can of course add a casting animation or effect to the picked unit or the summoned one

of course you could have it initially disabled and enable it when the first tower is built, but I don't see any purpose to it; a non-leaking periodic trigger that checks for something and finds nothing will not cause lag, I think..
 

Inflicted

Currently inactive
Reaction score
63
What was said above is probably the easiest route of doing it. Just trigger the spawn, however if you want it to look nice and show the cooldown on how long till the next spawn. Merely add a periodic trigger that will cast it every 12 seconds and the ability should have a cooldown of 12 seconds.

Note that initially the ability will be active which might be an issue with the timing, however triggering with a spellbook and a dummy ability could be done to set the cooldown to an appropriate starting time. However this could be complex and unneccessary.

Refering more to the code above, perhaps just have a passive ability (eg attribute bonus or crit with 0% chance) to alert the player than the spawn will happen every 12 seconds and that it is actually triggered by creating the unit and setting expiration time, such as the above trigger has done. This is quite common in games nowdays, if you need any help with creating any of these triggers. Either comment below or send me a p.m
 

Necrach

You can change this now in User CP.
Reaction score
62
What was said above is probably the easiest route of doing it. Just trigger the spawn, however if you want it to look nice and show the cooldown on how long till the next spawn. Merely add a periodic trigger that will cast it every 12 seconds and the ability should have a cooldown of 12 seconds.

Note that initially the ability will be active which might be an issue with the timing, however triggering with a spellbook and a dummy ability could be done to set the cooldown to an appropriate starting time. However this could be complex and unneccessary.

Refering more to the code above, perhaps just have a passive ability (eg attribute bonus or crit with 0% chance) to alert the player than the spawn will happen every 12 seconds and that it is actually triggered by creating the unit and setting expiration time, such as the above trigger has done. This is quite common in games nowdays, if you need any help with creating any of these triggers. Either comment below or send me a p.m

True. The main problem with the trigger above is that if it even works, it can only work for one tower at a time (the last one built, that is). Then a better way should be to use something similar my trigger but replace the Create Unit and Expiration Timer actions with an Order Picked Unit - Summon etc :eek:

BUT the problem with a periodic trigger is that it runs at the same time for all towers (which does not look nice, and can cause lag if you have an extreme amount of towers). Another way could be to create a dummy unit in the position of the tower when its built, adding a 12 second expiration timer. Then have a trigger that checks every time that kind of dummy units dies, pick units of type (YOUR TOWER) within 0.1 range of (Position of Dying Unit), and order picked unit to summon the elemental by order or by Create Unit action. Also create a new dummy with a 12 seconds timer at the same position, that will trigger the summoning again when it dies etc. See the pattern? ;) This way the towers will summon a water elemental individually every 12 seconds from the moment they are constructed.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
Trigger:
  • Summoner Tower
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Summoning Tower
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Water Elemental Timer for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Add a 12.00 second Generic expiration timer to (Last created unit)
      • Hashtable - Save Handle Of(Triggering unit) as (Key (Last created unit)) of (Key DummyOwner) in (Last created hashtable)
      • Custom script: call RemoveLocation(udg_TempPoint)


Trigger:
  • Summon Water Elemental
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Water Elemental Timer
    • Actions
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 Water Elemental (Level 1) for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Create 1 Water Elemental Timer for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Unit - Add a 12.00 second Generic expiration timer to (Last created unit)
      • Hashtable - Save Handle Of(Load (Key (Triggering unit)) of (Key DummyOwner) in (Last created hashtable)) as (Key (Last created unit)) of (Key DummyOwner) in (Last created hashtable)
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in (Last created hashtable)
      • Custom script: call RemoveLocation(udg_TempPoint)


To use this, you need to create a hashtable in your initialisation trigger. The first trigger creates a Water Elemental Timer (a dummy unit) and gives it a 12 second life. After that 12 second period is over, the Water Elemental Timer dies. The tower then "summons" a Water Elemental, and creates a new Water Elemental Timer for the tower,
 
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
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top