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
612
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
  • Blackveiled Blackveiled:
    I wouldn't know, I'm in Joliet, Illinois right now working. I left Houston area about 2 weeks ago lol
  • Blackveiled Blackveiled:
    Not permanently of course, just a temporary job.
    +1
  • jonas jonas:
    Glad you're ok @tom_mai78101
  • jonas jonas:
    @Blackveiled you know another word for permanent? temporary
    +1
  • Varine Varine:
    Briefly, he'll only be there for the interim. Like a stopgap of sorts, he'll be back home in short time
  • O Old Mountain Shadow:
    Hurray! Tom has reappeared!
  • The Helper The Helper:
    Happy Thursday!
  • Blackveiled Blackveiled:
    Yep. Just another fun night at work.
  • Varine Varine:
    Broke the nozzle on my 3d printer and I don't have another heater block. So... I guess I'm fucked on that this weekend
  • The Helper The Helper:
    that sucks i bet they are expensive
  • Varine Varine:
    Not really
  • Varine Varine:
    The entire hot end is like 20 dollars, I just can't get anymore until next week
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site

      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