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.
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • 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 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