Merging Buildings

santicpp

New Member
I'm creating a td where you can merge a tower when you have at least two of the same kind.

I have this trigger:
Trigger:
  • UpgradeWhiteT1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Equal to [Tier 1] White Tower).)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup) Greater than or equal to 2
        • Then - Actions
          • Unit Group - Remove (Triggering unit) from TempGroup.
          • Unit - Remove (Random unit from TempGroup) from the game
          • Unit - Replace (Triggering unit) with a [Tier 1] White Tower using The old unit's relative life and mana
        • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)


The trigger is working almost perfect, but: when i have more than 1 tower in my selection it doesnt work properly.
For example:
If i have 7 towers in my selection, the trigger replaces 4 of them instead of 3.
I tried to add a for each selected unit but its not working.
 

Squeekems

TH.net Regular
Immediate issue:
There is no Triggering player associated with the event you are using.
There is a Triggering Unit and you can refer to the Owner of Triggering Unit.

As for you problem:
Maybe you can find a way to label 2 towers as a pair. Do something when a Tower is finished being constructed to label it. Maybe set a custom value to all but 1 tower when there is an uneven number.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    wizard and ghan i hope you guys are ready because i am taking you bitches along for the ried
  • The Helper The Helper:
    buckle up
  • Wizard Wizard:
    xD
  • Wizard Wizard:
    Sounds good lol
  • Wizard Wizard:
    I did reply with more info just now about what we did in the past and what we are doing now.
  • The Helper The Helper:
    it is all good
  • The Helper The Helper:
    it is all percolating man
  • The Helper The Helper:
    TheHelper.net #1!
  • Wizard Wizard:
    #1
  • The Helper The Helper:
    LOL I love this place
  • Wizard Wizard:
    ;D
  • Wizard Wizard:
    We all do.
  • O Old Mountain Shadow:
    So what is next for thehelper.net? Is there a new set goals yet?
  • The Helper The Helper:
    yes we are going to be expanding
    +1
  • The Helper The Helper:
    help more people
  • The Helper The Helper:
    thank you for asking Old Mountain Shadow hell ya@
  • The Helper The Helper:
    Look at Mountain Shadow in the chat!
  • The Helper The Helper:
    welcome to thehelper.net
  • O Old Mountain Shadow:
    thanks although I'm really kind of regretting this name lol ... is there a way to change it out or will I need to make a new account?
  • Wizard Wizard:
    One of us can change it for you, I believe. Just send me a PM on what you want.
  • Ghan Ghan:
    Some day we should get the feature where you can change your own name.
  • Wizard Wizard:
    Soon!
  • The Helper The Helper:
    did the mountain shadow get his name changed? personally I think Old Mountain Shadow is a kickass name
  • The Helper The Helper:
    but what do i know lol

    Staff online

    • Ghan
      Administrator - Servers are fun

    Members online

    Affiliates

    Hive Workshop NUON Dome
    Top