• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

TD - Random builder option + Tower damage stacking trigger + Tesla tower trigger + Deal damage in AOE with an added effect

Level 4
Joined
Jul 22, 2023
Messages
36
Here are the current open topics in this post that i havent solved yet due to doing other things on this map or just lacking general skills for now:
1) Making a Tesla coil tower that deals damage to multiple enemies at once in a 600 range, like barrage but barrage doesnt work because the missile art has to be "lightning attack/lizard lightning" and even if i make it work to deal damage to multiple enemies, the barrage missile art is non existent. And it has to be an attack, not a spell due to spell immunity issues this would cause... Goal is to basically make an authentic-looking-like electricity arcs that would resemble a tesla coil.
I had several failed attempts at this one, none of the triggers worked or worked/properly.Even tried using Meat wagons plague ward to spawn for 1s and deal damage but i never got it to spawn, or it did and never dealt damage. I did get it to damage nearby enemies using the following action but got lost at adding lightning animation to that attack and it isnt really ideal.
2)Making a tower deal damage around the area to enemies of the target and playing a special effect. Sadly by overediting i deleted the original question, but i have yet to properly work on this..


Below are some of the questions i had that got answered and resolved:
1: Random builder option for TD
Was using an outdated Jass script to generate a random builder for a TD map, got better info and redid the entire trigger.
On chat command, builds a random builder out of every avaliable in the builder chooser building and adds +10g to the player triggering this.
  • RandomCommand
    • Events
      • Player - Player 1 (Red) types a chat message containing -random as An exact match
      • Player - Player 2 (Blue) types a chat message containing -random as An exact match
      • Player - Player 3 (Teal) types a chat message containing -random as An exact match
      • Player - Player 4 (Purple) types a chat message containing -random as An exact match
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of living Governor Chooser units owned by (Triggering player)) Equal to 1
        • Then - Actions
          • Set VariableSet TempGroup = (Units owned by (Triggering player) of type Governor Chooser)
          • Set VariableSet RandomUnit = (Random unit from TempGroup)
          • Set VariableSet RandomInteger = (Random integer number between 1 and 16)
          • Unit - Order RandomUnit to train/upgrade to a GovernorsNew[RandomInteger]
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering player) Current gold) Equal to 30
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Triggering player)) + has chosen Random!+10|cffffff00g|r )
              • Player - Add 10 to (Triggering player).Current gold
            • Else - Actions
              • Do nothing
        • Else - Actions
          • Do nothing
2: An ability that increases a certain TD builders ultimate tower damage depending on how many other towers of the same type have been built.
Uncle saved my buttocks again, here are the resulting triggers:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Energy Pulse Emitter (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Takes damage away after a tower has been sold:
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Energy Pulse Emitter (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
              • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
Takes away bonus damage after a tower is destroyed/killed
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Energy Pulse Emitter (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Adds damage to the Ultimate tower based on how many other towers are alive:
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
You can post your code by typing:
[*code=vJass]
[*/code]
Just remove the * and put your code in-between the two blocks.

But both look fine to me.

A good way to debug is to display text messages of the different variables and values in the trigger. Is the (Triggering player) the correct player? Are the variables getting set properly? Are the Governors setup properly? Is the trigger even running?

Answer those questions and you'll figure out where you went wrong.

Also, note that there's a Fixed Seed option in the World Editor that unless disabled will always generate the same randomness.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Thanks for the tips, after checking it out for like half an hour i'm guessing my variables got messed up somehow. Considering the code looks okay. Will be checking that out later, if nothing else im learning stuff.
 
Level 4
Joined
Jul 22, 2023
Messages
36
How did you define the variable udg_Governors?

As a unit type array with the size of 10-12 depending on how many builders are in game
 

Attachments

  • 1.JPG
    1.JPG
    78.6 KB · Views: 8
Level 4
Joined
Jul 22, 2023
Messages
36
Are you running that trigger? It has no Event
Had no event to begin with, does it need one if it just sets up variables? I will try adding game init or game time event see what happens thanks

edit: added game init. event to the trigger that sets up builders, no change :(
 
Level 4
Joined
Jul 22, 2023
Messages
36
You can post your code by typing:

Just remove the * and put your code in-between the two blocks.

But both look fine to me.

A good way to debug is to display text messages of the different variables and values in the trigger. Is the (Triggering player) the correct player? Are the variables getting set properly? Are the Governors setup properly? Is the trigger even running?

Answer those questions and you'll figure out where you went wrong.

Also, note that there's a Fixed Seed option in the World Editor that unless disabled will always generate the same randomness.

I'd like to add to this. My knowledge is limited, just editing the script to work with buttons took me a while to figure out what line in the code does what and what to replace so.
-No issue with triggering player as of yet (testing solo)
-Variables and governors look OK, i mean havent touched them... will check if i can add a text prompt in-game that displays if they are actually set up if i can't figure this out.

I will add aditional screenshots of how variables are set up and other triggers used for this in the OP.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Had no event to begin with, does it need one if it just sets up variables? I will try adding game init or game time event see what happens thanks

edit: added game init. event to the trigger that sets up builders, no change :(
Yes, a trigger won't run it's Actions without an Event. If the Actions don't run then the variables will never be set.

You can display text of just about anything. You simply convert your Integer/Real to a string inside of the text field or use one of the many other functions available.

Actually posting the triggers/code is better than pictures.
 
Level 4
Joined
Jul 22, 2023
Messages
36
Yes, a trigger won't run it's Actions without an Event. If the Actions don't run then the variables will never be set.

You can display text of just about anything. You simply convert your Integer/Real to a string inside of the text field or use one of the many other functions available.

Actually posting the triggers/code is better than pictures.
Added game init. event to the trigger that was missing it, no change.
Changed my OP to use less pictures, thanks.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Here's an example map with it working properly.

I had to make sure that:
1) The Player had the resources to train these units.
2) The Unit requirements were being met (I deleted these from the Rifleman/Knight).

You can convert my trigger to text to see it in Jass form. Remember to test your own triggers with text messages, I have a feeling that your Actions aren't even running in the first place.
 

Attachments

  • Example 1.w3m
    18.8 KB · Views: 1
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Here's an example map with it working properly.

I had to make sure that:
1) The Player had the resources to train these units.
2) The Unit requirements were being met (I deleted these from the Rifleman/Knight).

You can convert my trigger to text to see it in Jass form. Remember to test your own triggers with text messages, I have a feeling that your Actions aren't even running in the first place.
Will give it a try thanks!

One thing that's bothering me on my trigger is this part
" local integer Random"
Is this supposed to be a variable because i have none?

vJASS:
function Trig_NewRandom_Actions takes nothing returns nothing
    local integer Random
    local integer i = 1
    local integer iEnd = 11
    local group TempGroup
    set Random = GetRandomInt(1,11)
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Will give it a try thanks!

One thing that's bothering me on my trigger is this part
" local integer Random"
Is this supposed to be a variable because i have none?

vJASS:
function Trig_NewRandom_Actions takes nothing returns nothing
    local integer Random
    local integer i = 1
    local integer iEnd = 11
    local group TempGroup
    set Random = GetRandomInt(1,11)
No, it doesn't have to be a global variable, a local variable is fine and is the preferred way here. But i and iEnd aren't being used so you can delete those.
 
Level 4
Joined
Jul 22, 2023
Messages
36
No, it doesn't have to be a global variable, a local variable is fine and is the preferred way here. But i and iEnd aren't being used so you can delete those.
Okay thanks. I will try disabling my triggers and set up the one you provided see what happens. I find it odd because i havent touched the variables or any of the old triggers, just disabled the chat command one, copied it and edited so it works with a button. I'm stumped and the funny thing is it worked at first, not sure whap happened.
 
Level 4
Joined
Jul 22, 2023
Messages
36
Okay so i tried reconstructing from your example and here's what ive got, still results in 1. What i gather from this is that the triggers are just fine no matter their form, something else must have gotten broken/changed along the way. Next thing i'll try is re-creating the variables used from scratch.
At this point im at "what on earth did i change that i dont remember so this stoped working properly"...

edit2: Variable "RandomInt" was used for difficulty voting in a differenty way, created a new variable "RandomInteger" For this purpose and still the same result.
Edit3: Oi my dudes i opened up the original map that i didnt edit yet and it's the same thing, random function results in 1. What?.

chat messages:
1
arthas
custom_hc24


  • UpRandom
    • Events
      • Dialog - A dialog button is clicked for RandomVote
    • Conditions
    • Actions
      • Set VariableSet TempGroup = (Units owned by (Triggering player) of type Governor Chooser)
      • Set VariableSet RandomInteger = (Random integer number between 1 and 12)
      • Set VariableSet RandomUnit = (Random unit from TempGroup)
      • Unit - Order RandomUnit to train/upgrade to a Governors[RandomInteger]
      • Game - Display to (All players) for 30.00 seconds the text: (Random Integer: + (String(RandomInteger)))
      • Game - Display to (All players) for 30.00 seconds the text: (Random Barracks: + (Name of RandomUnit))
      • Game - Display to (All players) for 30.00 seconds the text: (Random Governor: + (String(Governors[RandomInteger])))



Is there something wrong with how the governors are set up?
  • Governors Array
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Set VariableSet Governors[1] = Arthas (Human)
      • Set VariableSet Governors[2] = Jaina (Magic)
      • Set VariableSet Governors[3] = Pyrus (Fire)
      • Set VariableSet Governors[4] = Coldreaver (Ice)
      • Set VariableSet Governors[5] = Thrall (Thunder)
      • Set VariableSet Governors[6] = Arachne (Poison)
      • Set VariableSet Governors[7] = Tichondrius (Death)
      • Set VariableSet Governors[8] = Joranda (Holy)
      • Set VariableSet Governors[9] = Furion (Earth)
      • Set VariableSet Governors[10] = Tyrande (Wind)
      • Set VariableSet Governors[11] = Lisk (Hybrid)
      • Set VariableSet Governors[12] = Uther (Hero)
      • Set VariableSet Builders[1] = Human Builder (Human)
      • Set VariableSet Builders[2] = Magic Builder (Magic)
      • Set VariableSet Builders[3] = Fire Builder (Fire)
      • Set VariableSet Builders[4] = Ice Builder (Ice)
      • Set VariableSet Builders[5] = Thunder Builder (Thunder)
      • Set VariableSet Builders[6] = Poison Builder (Poison)
      • Set VariableSet Builders[7] = Death Builder (Death)
      • Set VariableSet Builders[8] = Holy Builder (Holy)
      • Set VariableSet Builders[9] = Earth Builder (Earth)
      • Set VariableSet Builders[10] = Wind Builder (Wind)
      • Set VariableSet Builders[11] = Hybrid Builder (Hybrid)
      • Set VariableSet Builders[12] = Hero Builder (Hero)
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )

  • RandomVoteSetUp
    • Events
      • Time - Elapsed game time is 4.00 seconds
    • Conditions
    • Actions
      • Dialog - Clear RandomVote
      • Dialog - Change the title of RandomVote to Random builder?
      • Dialog - Create a dialog button for RandomVote labelled Random Builder
      • Set VariableSet RandomButton = (Last created dialog Button)
      • Dialog - Create a dialog button for RandomVote labelled Pick Builder
      • Set VariableSet NoVote = (Last created dialog Button)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is in OnlinePlayers.) Equal to True
              • ((Picked player) is in PlayersUser.) Equal to True
            • Then - Actions
              • Dialog - Show RandomVote for (Picked player)
            • Else - Actions
              • Do nothing
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Like I said, text messages will answer your questions. You'll know the Governors aren't the problem if you display text in-game telling you exactly what they're equal to. You can do this whenever you want, it's like your own in-game debugger.

Anyway, I would assume your mistake has to do with the building that trains the units if you've already tested and found that everything else is working.

There is also the very rare case that your variables bugged out and lost their variable type. When you view them in the Trigger Editor you'll see that their Variable Type is blank.

If all else fails, you can send me your map.
 
Level 4
Joined
Jul 22, 2023
Messages
36
Abort mission, i couldnt wrap my head around it so i went searching for Editor settings and it turned out SOMEHOW the option "Use Fixed Random Seed" was ticked in the Test Map section, how this got turned on is beyond me because i know the random trigger worked at some point and i never went changing anything in the actual Editor settings. What a dumb thing to waste so much time on.

Thanks for all the help, i learned alot! Have a great weekend!
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
My first post:

:p

At least we solved some other issues, lol.
You know i intentionally ignored that small detail at that point, checked everything else but that. I could hate myself but in stead i'll just have a beer, cheers and thanks again! :peasant-cheers-back:
 
Level 4
Joined
Jul 22, 2023
Messages
36
Hid the original post.
Could someone please help me translate this part of jass to gui, i'm trying to re-make a trigger but my knowledge is lacking, i got the rest of the trigger but i'm not sure which functions these represent in gui.

the code in question:

vJASS:
function UB4 takes nothing returns nothing
    call AddSpecialEffectLocBJ(GetUnitLoc(GetTriggerUnit()),"war3mapImported\\NewMassiveEX.mdx")
    call ForGroupBJ(TR(400.,GetUnitLoc(GetTriggerUnit()),Condition(function UZ4)),function UA4)
    call GroupAddUnit(udg_X7,GetAttacker())
    call IR(9.25)
    call DestroyEffect(bj_lastCreatedEffect)
    call GroupRemoveUnit(udg_X7,GetAttacker())
endfunction
I got this far:

  • Tower
    • Events
      • Unit - A unit owned by Player 12 (Brown) Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Mountain King
    • Actions
      • Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 650.00 and 1200.00) damage of attack type Chaos and damage type Normal
      • Special Effect - Create a special effect at (Position of (Triggering unit)) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
And this is the entire script (i hope) for the trigger in question:

vJASS:
function UY4 takes nothing returns boolean
    return(GetUnitTypeId(GetAttacker())=='h00Y')and(IsUnitInGroup(GetAttacker(),udg_X7)==false)
endfunction

function UZ4 takes nothing returns boolean
    return(GetOwningPlayer(GetFilterUnit())==Player($udg_B))
endfunction

function UA4 takes nothing returns nothing
    call UnitDamageTargetBJ(GetAttacker(),GetEnumUnit(),GetRandomReal(650.,1200.),ATTACK_TYPE_CHAOS,DAMAGE_TYPE_NORMAL)
endfunction

function UB4 takes nothing returns nothing
    call AddSpecialEffectLocBJ(GetUnitLoc(GetTriggerUnit()),"war3mapImported\\NewMassiveEX.mdx")
    call ForGroupBJ(TR(400.,GetUnitLoc(GetTriggerUnit()),Condition(function UZ4)),function UA4)
    call GroupAddUnit(udg_X7,GetAttacker())
    call IR(9.25)
    call DestroyEffect(bj_lastCreatedEffect)
    call GroupRemoveUnit(udg_X7,GetAttacker())
endfunction
Model files and Units are placeholders, i will import them after i get everything working as intended.
Thanks in advance!




Below here is the Original post, which was resolved.
Hello there.

I'm relatively new to map making but relatively old, my knowledge of Jass is quite limited so if anyone can pinpoint what i messed up with my edited trigger i'd be happy.

Trigger for random builder pick that uses a variable to choose from a pool of builders and everything seems to work fine except one small detail, it always picks the same builder out of 11.
I havent coded this myself, ive just edited it and am trying to make it work, i'm lost at this point and im pretty sure it's either a small erorr in the code or im gonna have to re-do the whole thing.


Edit after a good night slep, another test results in the following, i dont get it.
IF i use my buttoned trigger the resulting outcome is always builder set as 4 in the variable for builders
IF i disable it and enable the original trigger, the resulting outcome is always builder set as 1 in the variable.

Not sure what the variable RandomInt does at this point.

Edit added everything related to this issue:

  • RandomVoteSetUp
    • Events
      • Time - Elapsed game time is 4.00 seconds
    • Conditions
    • Actions
      • Dialog - Clear RandomVote
      • Dialog - Change the title of RandomVote to Random builder?
      • Dialog - Create a dialog button for RandomVote labelled Random Builder
      • Set VariableSet RandomButton = (Last created dialog Button)
      • Dialog - Create a dialog button for RandomVote labelled Pick Builder
      • Set VariableSet NoVote = (Last created dialog Button)
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is in OnlinePlayers.) Equal to True
              • ((Picked player) is in PlayersUser.) Equal to True
            • Then - Actions
              • Dialog - Show RandomVote for (Picked player)
            • Else - Actions
              • Do nothing

vJASS:
function Trig_NewRandom_Conditions takes nothing returns boolean
     if ( not ( GetClickedButtonBJ() == udg_RandomButton ) ) then
        return false
    endif
    return true
endfunction

function Trig_NewRandom_Actions takes nothing returns nothing
    local integer Random
    local integer i = 1
    local integer iEnd = 11
    local group TempGroup
    set Random = GetRandomInt(1,11)
    set TempGroup = GetUnitsOfPlayerAndTypeId(GetTriggerPlayer(), 'hhou')
    call IssueTrainOrderByIdBJ( GroupPickRandomUnit(TempGroup), udg_Governors[Random] )
    call DestroyGroup( TempGroup )
    set TempGroup = null
    call AdjustPlayerStateBJ( 10, GetTriggerPlayer(), PLAYER_STATE_RESOURCE_GOLD )
endfunction

//===========================================================================
function InitTrig_NewRandom takes nothing returns nothing
    set gg_trg_NewRandom = CreateTrigger(  )
    call TriggerRegisterDialogEventBJ( gg_trg_NewRandom, udg_RandomVote )
    call TriggerAddCondition( gg_trg_NewRandom, Condition( function Trig_NewRandom_Conditions ) )
    call TriggerAddAction( gg_trg_NewRandom, function Trig_NewRandom_Actions )
endfunction

  • Governors Array
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Governors[1] = Arthas (Human)
      • Set VariableSet Governors[2] = Jaina (Magic)
      • Set VariableSet Governors[3] = Pyrus (Fire)
      • Set VariableSet Governors[4] = Coldreaver (Ice)
      • Set VariableSet Governors[5] = Thrall (Thunder)
      • Set VariableSet Governors[6] = Arachne (Poison)
      • Set VariableSet Governors[7] = Tichondrius (Death)
      • Set VariableSet Governors[8] = Joranda (Holy)
      • Set VariableSet Governors[9] = Furion (Earth)
      • Set VariableSet Governors[10] = Tyrande (Wind)
      • Set VariableSet Governors[11] = Lisk (Hybrid)
      • Set VariableSet Governors[12] = Uther (Hero)
      • Set VariableSet Builders[1] = Human Builder (Human)
      • Set VariableSet Builders[2] = Magic Builder (Magic)
      • Set VariableSet Builders[3] = Fire Builder (Fire)
      • Set VariableSet Builders[4] = Ice Builder (Ice)
      • Set VariableSet Builders[5] = Thunder Builder (Thunder)
      • Set VariableSet Builders[6] = Poison Builder (Poison)
      • Set VariableSet Builders[7] = Death Builder (Death)
      • Set VariableSet Builders[8] = Holy Builder (Holy)
      • Set VariableSet Builders[9] = Earth Builder (Earth)
      • Set VariableSet Builders[10] = Wind Builder (Wind)
      • Set VariableSet Builders[11] = Hybrid Builder (Hybrid)
      • Set VariableSet Builders[12] = Hero Builder (Hero)
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
Updated my original post with a follow-up question
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Updated my original post with a follow-up question
The Hive has A LOT of outdated information since Warcraft 3 has changed so much over the years.

For instance, the "A unit is attacked" Event gets suggested a lot despite it being a terrible solution a lot of the time.

This Event happens when the Attack starts, which is before:

1) The attacking unit even begins playing it's attack animation.
2) The attacking unit has dealt any damage. The Damage Point hasn't occurred yet (how much time must pass for an attack to deal damage).

This means that the attacking unit has no obligation to actually finish the attack as the trigger will run regardless. This is obviously not ideal as the timing is way off, "stares at enemy unit and it dies", and the Event is easily abusable since you can cancel and reissue an attack over and over again. A user spamming Stop on their attacking unit could make your trigger run 10 times per second.

The solution is to use the Damage Events which occur when damage is actually dealt (implying the attack was successful):
  • Chaos Splash Damage
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Critical Strike for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • -------- Store our important data into variables to make the trigger efficient, bug free, and memory leak free: --------
      • Set VariableSet CSD_Hero = (Damage source)
      • Set VariableSet CSD_Hero_Player = (Owner of CSD_Hero)
      • Set VariableSet CSD_Point = (Position of CSD_Hero)
      • Set VariableSet CSD_Group = (Units within 400.00 of CSD_Point.)
      • -------- --------
      • -------- Create some fancy special effects to make things really pop! WOW! --------
      • Special Effect - Create a special effect at CSD_Point using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Deal damage to surrounding enemy units that match the conditions: --------
      • Trigger - Turn off Chaos Splash Damage <gen>
      • Unit Group - Pick every unit in CSD_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet CSD_Enemy = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CSD_Enemy belongs to an enemy of CSD_Hero_Player.) Equal to True
              • (CSD_Enemy is alive) Equal to True
              • (CSD_Enemy is A structure) Equal to False
              • (CSD_Enemy is invulnerable) Equal to False
            • Then - Actions
              • Set VariableSet CSD_Damage = (Random real number between 650.00 and 1200.00)
              • Unit - Cause CSD_Hero to damage CSD_Enemy, dealing CSD_Damage damage of attack type Chaos and damage type Normal
            • Else - Actions
      • Trigger - Turn on Chaos Splash Damage <gen>
      • -------- We turn this trigger off/on during the damage dealing stage to prevent it from running again (It could crash otherwise because it can cause an infinite loop) --------
      • -------- --------
      • -------- Clean up the memory leaks: --------
      • Custom script: call RemoveLocation( udg_CSD_Point )
      • Custom script: call DestroyGroup( udg_CSD_Group )

I've made it so that any unit with Blademaster's Critical Strike ability will have access to this chaos splash damage effect:
  • Conditions
    • (Level of Critical Strike for (Damage source)) Greater than 0
The Conditions should be changed to meet your requirements. Who has this Chaos Splash Damage effect? Do they always have it? Does it come from an ability? Is it a specific unit that can use this? Adjust the Conditions to answer those questions.

This condition helps ensure that our trigger only runs when the unit deals Attack damage as opposed to dealing damage from spells like Chain Lightning:
  • (Damage From Normal Attack) Equal to True
You could set it to False to flip the logic and make it only run when spells deal damage.
 

Attachments

  • Chaos Splash Damage 1.w3m
    18.9 KB · Views: 2
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Wow that's a lot of info to consume, thank you very much but ive put this tower on pause for now because i figured it's a bit out of my reach to configure and moved on to other issues with which ive hit a wall as well...
I will take a look at the trigger you attached later for sure to understand it and make it work, later when i get over the headaches this caused me yesterday and get back to it :p

Did read it through though and i gotta admit 99% of my tower triggers are using "is attacked", but they're mostly basic triggers to activate a spellcast when attackers mana is ## so i dont see a reason to complicate them now, unless?
Ive been searching through Hive a lot lately, also googling but Hive has a MASSIVE database and either im bad at searching or im just not finding the things i need, and google mostly provides articles form 2013 if they arent from hive. Saying that, i did find answers to a lot of questions i first intended to post here but regarding some issues, i dont even know which questions to ask if you know what i mean.

On an edited note: For this one i thought of just making it's attack speed on like 15 seconds with either artillery or missile(splash) projectile, projectile arc set on 90degrees so it falls from the sky, add an animation like the zeppelin crash one but it's a rocket(if i can find one) and add a massive explosion animation on rocket impact(if i can find it). But it has to deal damage on rocket impact so it doesnt missmatch with the animation. It's basically a nuke tower. Now that i think about it, nukes might be quite popular i might find all i need online so ill get back to you on this i guess :D



What i'm dealing with now if you're interested is
1) Making a Tesla coil tower that deals damage to multiple enemies at once in a 600 range, like barrage but barrage doesnt work because the missile art has to be "lightning attack/lizard lightning" and even if i make it work to deal damage to multiple enemies, the barrage missile art is non existent. And it has to be an attack, not a spell due to spell immunity issues this would cause... Goal is to basically make an authentic-looking-like electricity arcs that would resemble a tesla coil.
I had several failed attempts at this one, none of the triggers worked or worked/properly.Even tried using Meat wagons plague ward to spawn for 1s and deal damage but i never got it to spawn, or it did and never dealt damage. I did get it to damage nearby enemies using the following action but got lost at adding lightning animation to that attack and it isnt really ideal.
  • Unit - Cause (Attacking unit) to damage (Random unit from (Units within 600.00 of (Position of (Attacking unit)) matching (((Attacked unit) belongs to an enemy of Player 1 (Red).) Equal to True).)), dealing (Random real number between 1.00 and 650.00) damage of attack type Pierce and damage type Normal

2)Another Electricity ability that does the following: Every tower built from Thunder builder (6towers) increases the damage of the ultimate thunder tower(7th tower) by a flat amount. I know i need at least 1 variable to set thunder towers, i need a few abilities for towers since lower tier towers must provide a lower bonus than higher tier, more expensive towers but... no idea which ability to use (if it even matters except for counting and visuals), no idea how to count those different buffs to increase ultimate dmg only for the player that built them, and no idea how to actually increase the dmg of the ultimate... when i say no idea, i do have a faint grasp but i dont know how to construct the trigger properly. Havent tried it yet but its on the agenda.
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Whenever you use a Matching function the game is expecting you to use the (Matching unit) Event Response:
  • Unit - Cause (Attacking unit) to damage (Random unit from (Units within 600.00 of (Position of (Attacking unit)) matching (((Matching unit) belongs to an enemy of Player 1 (Red).) Equal to True).))...
You were using the (Attacked unit) there which doesn't make sense. You have to use the Event Responses that go with the Events/Functions.

The same goes for when using the Pick Every Unit function or Pick Every Player function in which case you use (Picked unit) and (Picked player). If you don't use these Event Responses then the game doesn't know what you're doing.

Regarding the lightning effect, Reforged broke triggered lightning effects, but abilities still work. I think you could get away with using a Forked Lightning ability that deals 0 damage and use Damage Events to then cause your tower to deal whatever type of damage you'd like to the zapped units. This would be done with a Damage Event trigger like the one I suggested before, a unique Dummy unit to cast Forked Lightning, and optionally a Unit Indexer or Hashtable to link the Dummy to the Tower that "created" it in order to make the Tower the source of the damage. To make Forked Lightning pierce spell immunity I believe you need to make it a Required Level 6 Hero ability. If memory serves me right that should give it the "Ultimate" flag and allow it to break through most things. Alternatively, you could use the Chimaera's lightning attack and have several Dummy units attack nearby enemy units.

For the Thunder Towers, you're designing something that is meant to happen once per Player. We call this MPI, multi-player-instanceable. This is rather simple:

Create an Integer array variable. Let's call it Thunder_Tower_Count. Now whenever you construct a Thunder Tower (assuming you construct these towers) let's increase the Thunder_Tower_Count for our Player by 1:
  • Events
    • Unit - A Unit finishes construction
  • Conditions
    • (Unit-type of (Constructed structure)) Equal to Thunder Tower
  • Actions
    • Set Variable PN = (Player number of (Owner of (Constructed structure)))
    • Set Variable Thunder_Tower_Count[PN] = Thunder_Tower_Count[PN] + 1
PN is an Integer variable. We set it to the Player Number of our tower player, 1 = Red, 2 = Blue, 3 = Teal, etc...
Since each Player has their own unique number, our Array will naturally store data for each Player without interfering with other Player's data.

Thunder_Tower_Count[1] = The number of thunder towers player 1 (red) has.
Thunder_Tower_Count[7] = The number of thunder towers player 7 (green) has.

Let's also remember that we may get rid of our Thunder Towers (assuming your towers can die/be sold) so let's do the opposite and subtract 1:
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Dying unit)) Equal to Thunder Tower
  • Actions
    • Set Variable PN = (Player number of (Owner of (Dying structure)))
    • Set Variable Thunder_Tower_Count[PN] = Thunder_Tower_Count[PN] - 1
We now always have the number of Thunder Towers that belong to a Player.

So how do we use this Integer?

1) Whenever a player constructs or destroys a Thunder Tower we need to pick ALL of our their existing Ultimate Thunder Towers and adjust their bonus attack damage based on that player's Thunder_Tower_Count.

2) Whenever a player constructs an Ultimate Thunder Tower we need to adjust it's bonus attack damage based on their Thunder_Tower_Count.

There's multiple ways of handling this but I would prefer using the new Ability Field functions made available in patch 1.31. This will allow you to give your Ultimate Thunder Towers a single +Attack Damage ability (like the one Claws of Attack uses) with a default value of +0 damage and modify it's value directly. I can go into greater detail in a bit but there's tutorials on Hive showing how to do this, just google "Hiveworkshop Uncle Stacking Damage" or "Hiveworkshop Uncle Ability Field" or something along those lines.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
That was fast, and a lot but i understand what you mean, btw i dont know what im doing dont expect the game to know what im doing :p

No wonder that damage function didn't work, also in that case i'd rather use a dummy that attacks not the same target as original tower but a random enemy in the same range with a lightning attack in the same damage range, i dont want them to hit the same target unless its a random hit then i dont mind. Would i need the Damage event trigger for this? Because honestly i havent dug into that yet as it seems a lot to understand and there's a lot of other work i gotta do so i'm doing what i currently think is in my capabilities, which usually ends up out of my capabilities but i learn.

Regarding the thunder stacking i pretty much understand everything, nicely explained thanks!
Now i know how to make a stack count and i'll figure out how to make the end result from your explanation, i'll also check your stacking damage article.

This post is one of my sources, later i'll update the original post with solutions you provided for all my questions.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
The editor often has tips that help you avoid these issues:

editor tips.png


Also, the "A unit Takes damage" event is pretty simple. You already understand the "A unit is attacked" event, which is essentially the same exact thing.

Here's how simple the switch is to go from the attack event to the damage event:

Event:
A unit is attacked -> A unit Takes damage

Event Responses:
(Attacked unit) -> (Damage Target)
(Attacking unit) -> (Damage source)

The Event Responses are often self-explanatory. In this case the source of the damage is obviously the unit that dealt the damage. Source implies "this is where the damage came from". The Target of the damage is obviously the unit that got damaged. Target implies "this is where the damage went".

There are also a bunch of Conditions/Actions related to this Event that allow you to:
1) Modify/Check the amount of damage dealt.
2) Check whether the damage came from a "normal" attack or not.
3) Modify/Check the attack-type / damage-type.
And more.

One thing to keep in mind is that these are all categorized under the name Event Response:
1691594506018.png


condition example.png


These functions were added in patch 1.31 as a pre-Reforged update. And like all things Reforged related, they're poorly handled hence the stupid categorization.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Whenever you use a Matching function the game is expecting you to use the (Matching unit) Event Response:
  • Unit - Cause (Attacking unit) to damage (Random unit from (Units within 600.00 of (Position of (Attacking unit)) matching (((Matching unit) belongs to an enemy of Player 1 (Red).) Equal to True).))...
You were using the (Attacked unit) there which doesn't make sense. You have to use the Event Responses that go with the Events/Functions.

The same goes for when using the Pick Every Unit function or Pick Every Player function in which case you use (Picked unit) and (Picked player). If you don't use these Event Responses then the game doesn't know what you're doing.

Regarding the lightning effect, Reforged broke triggered lightning effects, but abilities still work. I think you could get away with using a Forked Lightning ability that deals 0 damage and use Damage Events to then cause your tower to deal whatever type of damage you'd like to the zapped units. This would be done with a Damage Event trigger like the one I suggested before, a unique Dummy unit to cast Forked Lightning, and optionally a Unit Indexer or Hashtable to link the Dummy to the Tower that "created" it in order to make the Tower the source of the damage. To make Forked Lightning pierce spell immunity I believe you need to make it a Required Level 6 Hero ability. If memory serves me right that should give it the "Ultimate" flag and allow it to break through most things. Alternatively, you could use the Chimaera's lightning attack and have several Dummy units attack nearby enemy units.

For the Thunder Towers, you're designing something that is meant to happen once per Player. We call this MPI, multi-player-instanceable. This is rather simple:

Create an Integer array variable. Let's call it Thunder_Tower_Count. Now whenever you construct a Thunder Tower (assuming you construct these towers) let's increase the Thunder_Tower_Count for our Player by 1:
  • Events
    • Unit - A Unit finishes construction
  • Conditions
    • (Unit-type of (Constructed structure)) Equal to Thunder Tower
  • Actions
    • Set Variable PN = (Player number of (Owner of (Constructed structure)))
    • Set Variable Thunder_Tower_Count[PN] = Thunder_Tower_Count[PN] + 1
PN is an Integer variable. We set it to the Player Number of our tower player, 1 = Red, 2 = Blue, 3 = Teal, etc...
Since each Player has their own unique number, our Array will naturally store data for each Player without interfering with other Player's data.

Thunder_Tower_Count[1] = The number of thunder towers player 1 (red) has.
Thunder_Tower_Count[7] = The number of thunder towers player 7 (green) has.

Let's also remember that we may get rid of our Thunder Towers (assuming your towers can die/be sold) so let's do the opposite and subtract 1:
  • Events
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Dying unit)) Equal to Thunder Tower
  • Actions
    • Set Variable PN = (Player number of (Owner of (Dying structure)))
    • Set Variable Thunder_Tower_Count[PN] = Thunder_Tower_Count[PN] - 1
We now always have the number of Thunder Towers that belong to a Player.

So how do we use this Integer?

1) Whenever a player constructs or destroys a Thunder Tower we need to pick ALL of our their existing Ultimate Thunder Towers and adjust their bonus attack damage based on that player's Thunder_Tower_Count.

2) Whenever a player constructs an Ultimate Thunder Tower we need to adjust it's bonus attack damage based on their Thunder_Tower_Count.

There's multiple ways of handling this but I would prefer using the new Ability Field functions made available in patch 1.31. This will allow you to give your Ultimate Thunder Towers a single +Attack Damage ability (like the one Claws of Attack uses) with a default value of +0 damage and modify it's value directly. I can go into greater detail in a bit but there's tutorials on Hive showing how to do this, just google "Hiveworkshop Uncle Stacking Damage" or "Hiveworkshop Uncle Ability Field" or something along those lines.
Couldnt find the posts you mentioned, mind referring me to them?

Ive gone after this and made the stacking and de-stacking triggers Thunder_Tower_Count[PN] var for 1 tower, copying stuff - easy.
Now im at the results part of the triggers and i could use some more info, didnt get really far though i tried a few things that seemed a bit too illogical to work so i abandoned them.
What i have done is copy the item attack damage bonus ability, changed it up for this purpuse and defined it in this trigger, the last action is where i ended up dumbfounded.
  • ThunderVars
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet PowerPlant = Power Plant (Thunder)
      • Set VariableSet Capacitors = Capacitors Damage Bonus (+10)
      • For each (Integer Thunder_Tower_Count[PN]) from 1 to 99, do (Actions)
        • Loop - Actions
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
A lot of important info is in here:

I'll create a demo map for you in 5 minutes and attach it to this post.

Edit:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Thunder Tower
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Thunder Tower
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to ULTIMATE THUNDER TOWER
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
 

Attachments

  • Thunder Tower 1.w3m
    19.2 KB · Views: 1
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
The editor often has tips that help you avoid these issues:

View attachment 442857

Also, the "A unit Takes damage" event is pretty simple. You already understand the "A unit is attacked" event, which is essentially the same exact thing.

Here's how simple the switch is to go from the attack event to the damage event:

Event:
A unit is attacked -> A unit Takes damage

Event Responses:
(Attacked unit) -> (Damage Target)
(Attacking unit) -> (Damage source)

The Event Responses are often self-explanatory. In this case the source of the damage is obviously the unit that dealt the damage. Source implies "this is where the damage came from". The Target of the damage is obviously the unit that got damaged. Target implies "this is where the damage went".

There are also a bunch of Conditions/Actions related to this Event that allow you to:
1) Modify/Check the amount of damage dealt.
2) Check whether the damage came from a "normal" attack or not.
3) Modify/Check the attack-type / damage-type.
And more.

One thing to keep in mind is that these are all categorized under the name Event Response:
View attachment 442860

View attachment 442862

These functions were added in patch 1.31 as a pre-Reforged update. And like all things Reforged related, they're poorly handled hence the stupid categorization.
So this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit owned by Player 12 (Brown) Takes damage
    • Conditions
      • (Unit-type of (Damage source)) Equal to Example Tower
      • (Damage From Normal Attack) Equal to True
    • Actions
      • Event Response - Set Damage of Unit Damaged Event to 999.00
This will set the damage dealt to 999? Or set the damage of the damaged unit to 999? Confuzling...
Edit: Holy poop man what you do in 5mins takes me 3 days to come up with and even then it doesnt work
 
Level 4
Joined
Jul 22, 2023
Messages
36
A lot of important info is in here:

I'll create a demo map for you in 5 minutes and attach it to this post.

Edit:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Thunder Tower
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Thunder Tower
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to ULTIMATE THUNDER TOWER
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to ULTIMATE THUNDER TOWER).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus (+10))'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus (+10) for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus (+10) for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Amazing, i knew my goal was the Loop part of the last trigger for ultimate built but i didnt know how to get there, thank you very much!

EDIT: Does this require the ability to have multiple levels?
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Nope, the ability should have 1 level and a base attack damage value of 0. Also, make sure your Ultimate Thunder Tower actually has the ability.

If you want to adjust how much damage gets added per tower you would change 10 in this line:
  • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
 
Level 4
Joined
Jul 22, 2023
Messages
36
Currently have the ability level set to 1 and damage to 10 from before and it added up 10 by 10 fine when basic towers were built and... you should've been a bit faster, did a test without the ability actually on the ultimate tower but i realized it quickly :p

After testing, while the Ultimate towers gets correct ammount of damage... the issue i am having is the damage doesnt get subtracted from the ultimate tower when a basic thunder tower is deconstructed while the Ultimate tower is alive.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Currently have the ability level set to 1 and damage to 10 from before and it added up 10 by 10 fine when basic towers were built and... you should've been a bit faster, did a test without the ability actually on the ultimate tower but i realized it quickly :p

After testing, while the Ultimate towers gets correct ammount of damage... the issue i am having is the damage doesnt get subtracted from the ultimate tower when a basic thunder tower is deconstructed while the Ultimate tower is alive.
It works if the Thunder Tower dies:
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
If you're not killing the tower then the Event won't run and the subtraction won't happen.

You'll either need to use an Event that does detect your "deconstruction" (not sure what that implies) or run the Actions of the Thunder Tower Subtract trigger inside of the "deconstruction" trigger (make sure to use the appropriate Event Responses).

Note that a Removed unit doesn't "die":
  • Unit - Remove (Triggering unit) from the game
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
It works if the Thunder Tower dies:
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
If you're not killing the tower then the Event won't run and the subtraction won't happen.

You'll either need to use an Event that does detect your "deconstruction" (not sure what that implies) or run the Actions of the Thunder Tower Subtract trigger inside of the "deconstruction" trigger (make sure to use the appropriate Event Responses).

Note that a Removed unit doesn't "die":
  • Unit - Remove (Triggering unit) from the game
I see, so in my case i'm selling the tower which uses an ability sell so i suppose i should switch to event a unit finishes casting an ability and add a condition ability being sell, or am i wrong?

Like this
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Sell
      • (Unit-type of (Triggering unit)) Equal to Energy Pulse Emitter (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
          • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
          • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
I would keep your original Sell trigger but add an If Then Else to it that checks if the Tower is an Energy Pulse Emitter:
  • Sell Tower
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Energy Pulse Emitter (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
              • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
      • -------- --------
      • -------- Put the rest of your normal Sell actions here --------
      • -------- Put the rest of your normal Sell actions here --------
      • -------- Put the rest of your normal Sell actions here --------
Also, note that I changed the Event to Starts the effect of an ability rather than Finishes casting an ability. Finishes is generally avoided as it can get interrupted and fail to run. Starts happens the moment that an ability launches it's effect and goes on cooldown/spends mana.

You would generally use the cast events like so:

Begins casting an ability: Use this if you want to interrupt the ability before it launches it's effects/spends costs. It also allows you to bypass the unit's Art - Animation - Cast Point.

Starts the effect of an ability: Use this most of the time for your custom triggered abilities. This happens the same time that the ability launches it's effects.

Finishes casting an ability: Use this with channeled abilities to detect if they finished their full duration. (I could be wrong about this one)

Begins channeling an ability: Use this to detect when the Casting Time of an ability starts (if you're using Casting Time). It's not really necessary for channeled abilities since Starts the effect can be used instead.

Edit:
Note that I was assuming that you had a single Sell Tower trigger. This might not make sense if you were using a unique Sell trigger for each type of Tower.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
So i took this sell trigger
  • Sell Button
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is selected by (Owner of (Casting unit)).) Equal to False
                  • ((Picked unit) is in Transmuters.) Equal to True
                  • (Point-value of (Picked unit)) Less than or equal to 1
                  • (Life of (Picked unit)) Not equal to (Max life of (Picked unit))
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Selected[(Player number of (Owner of (Casting unit)))].
            • Else - Actions
      • Set VariableSet Sell = 0
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Set VariableSet Sell = (Sell + (3 x (Point-value of (Triggering unit)))))
      • Player - Add (Sell / 4) to (Owner of (Casting unit)).Current gold
      • Game - Display to (Player group((Owner of (Casting unit)))) the text: ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + ( building(s) sold for |cffffcc00 + ((String((Sell / 4))) + |r gold.)))
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from Built.
          • Unit Group - Remove (Picked unit) from Revertable.
          • Unit Group - Remove (Picked unit) from Attackable.
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Remove all units from Selected[(Player number of (Owner of (Casting unit)))].
and added this
  • Sell Button
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Casting unit)) Equal to Energy Pulse Emitter (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Capacitors Damage Bonus )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Capacitors Damage Bonus for (Picked unit)
              • Unit - Decrease level of Capacitors Damage Bonus for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
          • Do nothing
      • -------- (Above)Thunder Ultimate dmg reduction/(Below) Sell trigger --------
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is selected by (Owner of (Casting unit)).) Equal to False
                  • ((Picked unit) is in Transmuters.) Equal to True
                  • (Point-value of (Picked unit)) Less than or equal to 1
                  • (Life of (Picked unit)) Not equal to (Max life of (Picked unit))
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Selected[(Player number of (Owner of (Casting unit)))].
            • Else - Actions
      • Set VariableSet Sell = 0
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Set VariableSet Sell = (Sell + (3 x (Point-value of (Triggering unit)))))
      • Player - Add (Sell / 4) to (Owner of (Casting unit)).Current gold
      • Game - Display to (Player group((Owner of (Casting unit)))) the text: ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + ( building(s) sold for |cffffcc00 + ((String((Sell / 4))) + |r gold.)))
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from Built.
          • Unit Group - Remove (Picked unit) from Revertable.
          • Unit Group - Remove (Picked unit) from Attackable.
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Remove all units from Selected[(Player number of (Owner of (Casting unit)))].
Everything works like a charm man now i just have to add the rest of the towers to these triggers which is easy work, thanks again for all the hard work, it would have taken me at least a week of searching and learning on my own.
Now to attend to other things discussed in this thread, i will also update the OP with this resolve.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
Here's a more elaborate Sell Tower system which should help avoid issues and rid you the need of having the check if a Unit Is Selected (Selection functions are slow when playing online which can lead to unwanted behavior).
  • Sell Tower Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Add Events to the Sell Tower Finish trigger manually because we're lazy: --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Sell Tower Finish <gen> the event (Time - Sell_Timer[(Player number of (Picked player))] expires)
  • Sell Tower Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • -------- The Sell Tower ability needs a Casting Time for this to work! --------
      • -------- --------
      • Set VariableSet Sell_PN = (Player number of (Owner of (Triggering unit)))
      • Unit Group - Add (Triggering unit) to Sell_Group[Sell_PN]
      • Countdown Timer - Start Sell_Timer[Sell_PN] as a One-shot timer that will expire in 0.01 seconds
  • Sell Tower Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • Set VariableSet Sell_PN = (Player number of (Owner of (Triggering unit)))
      • Unit Group - Remove (Triggering unit) from Sell_Group[Sell_PN].
  • Sell Tower Finish
    • Events
    • Conditions
    • Actions
      • -------- Set Sell_PN to the Player Number of the Player whose Timer just expired: --------
      • -------- --------
      • Custom script: local timer t = GetExpiredTimer()
      • Set VariableSet Sell_PN = 0
      • Custom script: loop
      • Set VariableSet Sell_PN = (Sell_PN + 1)
      • Custom script: if t == udg_Sell_Timer[udg_Sell_PN] then
      • Custom script: exitwhen true
      • Custom script: endif
      • Custom script: endloop
      • Custom script: set t = null
      • -------- --------
      • -------- We can now reference Sell_PN to interact with our desired Player. --------
      • Set VariableSet Sell_Player = (Player(Sell_PN))
      • -------- --------
      • Set VariableSet Sell_Count = 0
      • Set VariableSet Sell_Value = 0
      • Unit Group - Pick every unit in Sell_Group[Sell_PN] and do (Actions)
        • Loop - Actions
          • Set VariableSet Sell_Tower = (Picked unit)
          • -------- --------
          • -------- Put your Thunder Tower actions here! Sell_Tower is the tower being sold. --------
          • -------- --------
          • -------- Calculate the total gold rewarded and then rermove the tower: --------
          • Set VariableSet Sell_Count = (Sell_Count + 1)
          • Set VariableSet Sell_Value = (Sell_Value + (3 x (Point-value of Sell_Tower)))
          • Unit - Remove Sell_Tower from the game
      • -------- --------
      • -------- Do nothing if there's nothing to sell: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Sell_Count Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • Player - Add Sell_Value to Sell_Player.Current gold
      • Game - Display to (Player group(Sell_Player)) for 30.00 seconds the text: (Sold + ((String(Sell_Count)) + ( towers for + ((String(Sell_Value)) + gold!))))
My Sell Tower ability is based on the Channel ability which gives us a lot of control over how it functions. In this case I made it a Universal Spell which means that when you have multiple units selected with this same Sell ability and you order one of them to cast it, ALL of the units will attempt to cast it. I take advantage of this in combination with a large Casting Time on the ability to track how many towers you're currently selling before actually executing the removal process. Part of this method takes advantage of a 0.01 second Timer which will run after we cast the Sell ability. Once it expires (0.01s later) I proceed to calculating the Sell_Count (how many were sold) and the Sell_Value (total gold reward) while also Removing the towers one by one.

Sell_Timer is a Timer array variable with a Size of 24 and Sell_Group is a Unit Group array variable with a Size of 24. This Size is very important for the triggers to work and must be defined inside of the Variable Editor.
 

Attachments

  • Sell Tower 1.w3m
    19.5 KB · Views: 3
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Here's a more elaborate Sell Tower system which should help avoid issues and rid you the need of having the check if a Unit Is Selected (Selection functions are slow when playing online which can lead to unwanted behavior).
  • Sell Tower Setup
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • -------- Add Events to the Sell Tower Finish trigger manually because we're lazy: --------
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Trigger - Add to Sell Tower Finish <gen> the event (Time - Sell_Timer[(Player number of (Picked player))] expires)
  • Sell Tower Start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • -------- The Sell Tower ability needs a Casting Time for this to work! --------
      • -------- --------
      • Set VariableSet Sell_PN = (Player number of (Owner of (Triggering unit)))
      • Unit Group - Add (Triggering unit) to Sell_Group[Sell_PN]
      • Countdown Timer - Start Sell_Timer[Sell_PN] as a One-shot timer that will expire in 0.01 seconds
  • Sell Tower Stop
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Ability being cast) Equal to Sell Tower
    • Actions
      • Set VariableSet Sell_PN = (Player number of (Owner of (Triggering unit)))
      • Unit Group - Remove (Triggering unit) from Sell_Group[Sell_PN].
  • Sell Tower Finish
    • Events
    • Conditions
    • Actions
      • -------- Set Sell_PN to the Player Number of the Player whose Timer just expired: --------
      • -------- --------
      • Custom script: local timer t = GetExpiredTimer()
      • Set VariableSet Sell_PN = 0
      • Custom script: loop
      • Set VariableSet Sell_PN = (Sell_PN + 1)
      • Custom script: if t == udg_Sell_Timer[udg_Sell_PN] then
      • Custom script: exitwhen true
      • Custom script: endif
      • Custom script: endloop
      • Custom script: set t = null
      • -------- --------
      • -------- We can now reference Sell_PN to interact with our desired Player. --------
      • Set VariableSet Sell_Player = (Player(Sell_PN))
      • -------- --------
      • Set VariableSet Sell_Count = 0
      • Set VariableSet Sell_Value = 0
      • Unit Group - Pick every unit in Sell_Group[Sell_PN] and do (Actions)
        • Loop - Actions
          • Set VariableSet Sell_Tower = (Picked unit)
          • -------- --------
          • -------- Put your Thunder Tower actions here! Sell_Tower is the tower being sold. --------
          • -------- --------
          • -------- Calculate the total gold rewarded and then rermove the tower: --------
          • Set VariableSet Sell_Count = (Sell_Count + 1)
          • Set VariableSet Sell_Value = (Sell_Value + (3 x (Point-value of Sell_Tower)))
          • Unit - Remove Sell_Tower from the game
      • -------- --------
      • -------- Do nothing if there's nothing to sell: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Sell_Count Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • Player - Add Sell_Value to Sell_Player.Current gold
      • Game - Display to (Player group(Sell_Player)) for 30.00 seconds the text: (Sold + ((String(Sell_Count)) + ( towers for + ((String(Sell_Value)) + gold!))))
My Sell Tower ability is based on the Channel ability which gives us a lot of control over how it functions. In this case I made it a Universal Spell which means that when you have multiple units selected with this same Sell ability and you order one of them to cast it, ALL of the units will attempt to cast it. I take advantage of this in combination with a large Casting Time on the ability to track how many towers you're currently selling before actually executing the removal process. Part of this method takes advantage of a 0.01 second Timer which will run after we cast the Sell ability. Once it expires (0.01s later) I proceed to calculating the Sell_Count (how many were sold) and the Sell_Value (total gold reward) while also Removing the towers one by one.

Sell_Timer is a Timer array variable with a Size of 24 and Sell_Group is a Unit Group array variable with a Size of 24. This Size is very important for the triggers to work and must be defined inside of the Variable Editor.
Oh stop giving me more work man, though i do love the input and all the info since this map im working on has a notoriously old sell bug for 2 of the builders and none of the other editors that worked on this map fixed it, i was gonna look into it eventually so great! But first i gotta finish up the Tesla tower, after that i should really get back to that Nuke tower and then ill look into these sell triggers. Damn the work keeps piling up, i also have another tower to make a trigger for after this, one that is supposed to attach a plasma granade on an enemy that explodes after 3 seconds dealing aoe damage, and all this work is just rebuilding the existing stuff in the most popular version of the map since previous editors locked and corrupted their maps so they are un-editable...Though these tesla towers and such are my own ideas since i would go crazy just figuring out how to rebuild the existing popular version.
 
Level 4
Joined
Jul 22, 2023
Messages
36
Just wondering if i went about this the correct way when adding the rest of the towers and deciding the bonus value they give?
Before i go editing the rest of these triggers the same way.
Here is a Thunder Tower Subtraction example
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Energy Pulse Emitter (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Thunder Cloud Creator (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Lightning Rod (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Overcharged Capacitors for (Picked unit)
              • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Triggering unit)) Equal to Static Field Generator (Thunder)
                  • (Unit-type of (Triggering unit)) Equal to Stormspire (Thunder)
                  • (Unit-type of (Triggering unit)) Equal to Purging Tower (Thunder)
                  • (Unit-type of (Triggering unit)) Equal to Heaven's Wrath (Thunder)
            • Then - Actions
              • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
              • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 1)
              • -------- --------
              • -------- Adjust damage: --------
              • Set VariableSet Thunder_Tower_Damage = (100 x Thunder_Tower_Count[Thunder_Tower_PN])
              • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
              • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
                • Loop - Actions
                  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
                  • Unit - Increase level of Overcharged Capacitors for (Picked unit)
                  • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
              • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
            • Else - Actions
              • Do nothing
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
So it looks like you want different bonuses based on the types of Thunder towers, +10 damage for those first 3 and +100 damage for those other 4.

In that case you'll need to modify how you're handling the damage calculation. Here's what I would do:

1) Delete the Thunder_Tower_Damage variable.

2) Rename Thunder_Tower_Count to Thunder_Tower_Damage.

3) Wherever you're increasing and decreasing Thunder_Tower_Count (now known as Thunder_Tower_Damage) you should change the Arithmetic math from + 1 and - 1 to the actual amount of damage that the tower is adding/subtracting. So when you construct a Thunder Tower add either 10 or 100 depending on it's Unit Type. Then when a Thunder Tower dies subtract either 10 or 100 depending on it's Unit-Type.

4) Change this Action that was using the old Thunder_Tower_Damage variable:
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
To now reference our new version of the variable with the array:
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
Now we're no longer tracking how many Thunder Towers we have and instead tracking how much Damage they're adding.

Note that if you wanted to use the Thunder_Tower_Count variable for other things and are hesitant on changing it, you could instead keep Thunder_Tower_Count as it is now and instead of deleting Thunder_Tower_Damage simply change it to an Array and use both of these at the same time. This way you're tracking both the number of Thunder Towers as well as the total Damage that they're adding.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
So it looks like you want different bonuses based on the types of Thunder towers, +10 damage for those first 3 and +100 damage for those other 4.

In that case you'll need to modify how you're handling the damage calculation. Here's what I would do:

1) Delete the Thunder_Tower_Damage variable.
2) Rename Thunder_Tower_Count to Thunder_Tower_Damage.
3) Wherever you're increasing and decreasing Thunder_Tower_Count (now known as Thunder_Tower_Damage) you should change the Arithmetic math from + 1 and - 1 to the actual amount of damage that the tower is adding/subtracting. So when you construct a Thunder Tower add either 10 or 100 depending on it's Unit Type. Then when a Thunder Tower dies subtract either 10 or 100 depending on it's Unit-Type.
4) Change this Action that used to use the old Thunder_Tower_Damage variable:
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
To now reference our new version of the variable with the array:
  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
Now we're no longer tracking how many Thunder Towers we have and instead tracking how much Damage they're granting.

Note that if you wanted to use the Thunder_Tower_Count for other things and are hesitant on changing it, you could instead KEEP Thunder_Tower_Count as it is now and instead make Thunder_Tower_Damage an Array and use both of those at the same time.
After what i posted just a few minutes ago didnt work i went about fixing it and came up with this, after testing all the damage is added and subtracted properly and seemed to work just fine, should i still go about doing the changes you just recomended?
I just changed
  • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] - 10)
to add or subtract 10 instead of 1, since i figured the first time around i had the math reversed.
I tested by building about 5 of the basic towers which resulted in 50 added bonus damage on the ultimate tower and i also constructed 3 advanced towers which properly gave 100 bonus damage each. All the damage was also properly removed after selling towers 1 by 1.
Here is the entire trigger
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Energy Pulse Emitter (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Thunder Cloud Creator (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Lightning Rod (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 1)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Overcharged Capacitors for (Picked unit)
              • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Static Field Generator (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Stormspire (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Purging Tower (Thunder)
              • (Unit-type of (Triggering unit)) Equal to Heaven's Wrath (Thunder)
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 10)
          • -------- --------
          • -------- Adjust damage: --------
          • Set VariableSet Thunder_Tower_Damage = (10 x Thunder_Tower_Count[Thunder_Tower_PN])
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage
              • Unit - Increase level of Overcharged Capacitors for (Picked unit)
              • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
          • Do nothing
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
On second thought:

A nice way to optimize these triggers would be to use hidden abilities as classifications. This would rid the need of having to check different unit-types.

For example, copy and paste the Storm Hammers ability, set it's Art - Button Positions to 0, -11 (hold shift for negative values, this hides the button), and rename it to Thunder Classification (+10). Then copy and paste that ability and rename it to Thunder Classification (+100).

Now we have two abilities which we can use as pseudo-classifications. Add the +10 ability to your Energy Pulse Emitter and the other towers like it. Then add the +100 ability to the Static Field Generator and the other towers like it.

Now we can simplify the trigger a lot by using this method:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Thunder Classification (+10) for (Triggering unit)) Equal to 1
          • (Level of Thunder Classification (+100) for (Triggering unit)) Equal to 1
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
    • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunder Classification (+10) for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 10)
        • Else - Actions
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 100)
    • -------- --------
    • -------- Adjust damage: --------
    • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
    • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
      • Loop - Actions
        • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Count[Thunder_Tower_PN]
        • Unit - Increase level of Overcharged Capacitors for (Picked unit)
        • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
    • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Clean and MUCH more efficient. Then simply copy and paste these Actions and subtract 1 or 10 when you want to reduce the damage.

Edit: I got rid of Thunder_Tower_Damage as it's no longer necessary. Just reference Thunder_Tower_Count directly in the Set Ability action.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
On second thought:

A nice way to optimize these triggers would be to use hidden abilities as classifications. This would rid the need of having to check different unit-types.

For example, copy and paste the Storm Hammers ability, set it's Art - Button Positions to 0, -11 (hold shift for negative values, this hides the button), and rename it to Thunder Classification (+10). Then copy and paste that ability and rename it to Thunder Classification (+100).

Now we have two abilities which we can use as pseudo-classifications. Add the +10 ability to your Energy Pulse Emitter and the other towers like it. Then add the +100 ability to the Static Field Generator and the other towers like it.

Now we can simplify the trigger a lot by using this method:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Thunder Classification (+10) for (Triggering unit)) Equal to 1
          • (Level of Thunder Classification (+100) for (Triggering unit)) Equal to 1
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
    • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunder Classification (+10) for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 10)
        • Else - Actions
          • Set VariableSet Thunder_Tower_Count[Thunder_Tower_PN] = (Thunder_Tower_Count[Thunder_Tower_PN] + 100)
    • -------- --------
    • -------- Adjust damage: --------
    • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
    • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
      • Loop - Actions
        • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Count[Thunder_Tower_PN]
        • Unit - Increase level of Overcharged Capacitors for (Picked unit)
        • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
    • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Clean and MUCH more efficient. Then simply copy and paste these Actions and subtract 1 or 10 when you want to reduce the damage.

Edit: I got rid of Thunder_Tower_Damage as it's no longer necessary.

Would it cause lagg or some issues not to optimize it for the long run? I'm done for today but i'll go for it tomorrow if you suggest it's worth it (for you its 15sec work, for me its at least 30 mins and checking everything over 5 times to make sure its correct :p).

Last thing i just worked on before i finished up was a trigger we talked about earlier regarding the Nuke tower.
So i used your trigger and the issue i have is the damage is done around the tower and so is the animation
  • Ghost
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Nuclear strike for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • -------- Store our important data into variables to make the trigger efficient, bug free, and memory leak free: --------
      • Set VariableSet CSD_Hero = (Damage source)
      • Set VariableSet CSD_Hero_Player = (Owner of CSD_Hero)
      • Set VariableSet CSD_Point = (Position of CSD_Hero)
      • Set VariableSet CSD_Group = (Units within 400.00 of CSD_Point.)
      • -------- --------
      • -------- Create some fancy special effects to make things really pop! WOW! --------
      • Special Effect - Create a special effect at CSD_Point using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Deal damage to surrounding enemy units that match the conditions: --------
      • Trigger - Turn off Ghost <gen>
      • Unit Group - Pick every unit in CSD_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet CSD_Enemy = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CSD_Enemy belongs to an enemy of CSD_Hero_Player.) Equal to True
              • (CSD_Enemy is alive) Equal to True
              • (CSD_Enemy is A structure) Equal to False
              • (CSD_Enemy is invulnerable) Equal to False
            • Then - Actions
              • Set VariableSet CSD_Damage = (Random real number between 650.00 and 1200.00)
              • Unit - Cause CSD_Hero to damage CSD_Enemy, dealing CSD_Damage damage of attack type Chaos and damage type Normal
            • Else - Actions
      • Trigger - Turn on Ghost <gen>
      • -------- We turn this trigger off/on during the damage dealing stage to prevent it from running again (It could crash otherwise because it can cause an infinite loop) --------
      • -------- --------
      • -------- Clean up the memory leaks: --------
      • Custom script: call RemoveLocation( udg_CSD_Point )
      • Custom script: call DestroyGroup( udg_CSD_Group )
I'm guessing its because of this
  • Set VariableSet CSD_Group = (Units within 400.00 of CSD_Point.)
Since the point is set on the damage dealing unit itself, but im too tired today ill continue tomorrow.
Thanks again :)
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
CSD_Point is at the position of the tower (CSD_Hero) and CSD_Group is set to units within 400.00 range of that point, so yes, that's the issue.

I forget that others don't have every single editor function burned into their memory, lol.

Anyway, the optimization stuff would help improve performance but it's not like players are going to be non-stop building these towers.

I do recommend doing it though, for the sake of keeping things clean, efficient, and making your life easier if you ever want to modify it in the future, but if your time is important to you then don't bother.
 
Level 4
Joined
Jul 22, 2023
Messages
36
CSD_Point is at the position of the tower (CSD_Hero) and CSD_Group is set to units within 400.00 range of that point, so yes, that's the issue.

I forget that others don't have every single editor function burned into their memory, lol.

Anyway, the optimization stuff would help improve performance but it's not like players are going to be non-stop building these towers.

I do recommend doing it though, for the sake of keeping things clean, efficient, and making your life easier if you ever want to modify it in the future, but if your time is important to you then don't bother.
Oh my man mine and your skills in this are completely on the opposite side of the spectrum, im just starting out which for you im guessing was decades ago 😄 Took me like 5 minutes just to find the "Event response > Ability being Cast", i'm stumbling around getting experience, there's just so many things possible its hard to find something that does exactly what you want it to do and the way you want it and theres 5 ways to do the said thing, 3 of which are sub-optimal and about 100 ways to do the thing wrong.

I went and did the thunder towers optimization and am currently looking at redesigning the sell system.
Meanwhile ive got a few questions.
First to make sure i changed everything correctly here are the optimized triggers for damage stacking:
  • Thunder Tower Add
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
          • (Level of Thunder Class+50 for (Triggering unit)) Equal to 1
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] + 5)
        • Else - Actions
          • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] + 50)
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Thunder Tower Subtract
    • Events
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
          • (Level of Thunder Class+50 for (Triggering unit)) Equal to 1
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 5)
        • Else - Actions
          • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 50)
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (10 x Thunder_Tower_Damage[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
  • Sell Button
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
              • (Level of Thunder Class+50 for (Triggering unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
            • Then - Actions
              • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 5)
            • Else - Actions
              • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 50)
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
              • Unit - Increase level of Overcharged Capacitors for (Picked unit)
              • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
      • -------- (Above)Thunder Ultimate dmg reduction/(Below) Sell trigger --------
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is selected by (Owner of (Casting unit)).) Equal to False
                  • ((Picked unit) is in Transmuters.) Equal to True
                  • (Point-value of (Picked unit)) Less than or equal to 1
                  • (Life of (Picked unit)) Not equal to (Max life of (Picked unit))
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Selected[(Player number of (Owner of (Casting unit)))].
            • Else - Actions
      • Set VariableSet Sell = 0
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Set VariableSet Sell = (Sell + (3 x (Point-value of (Triggering unit)))))
      • Player - Add (Sell / 4) to (Owner of (Casting unit)).Current gold
      • Game - Display to (Player group((Owner of (Casting unit)))) the text: ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + ( building(s) sold for |cffffcc00 + ((String((Sell / 4))) + |r gold.)))
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • Unit Group - Remove (Picked unit) from Built.
          • Unit Group - Remove (Picked unit) from Revertable.
          • Unit Group - Remove (Picked unit) from Attackable.
          • Unit - Remove (Picked unit) from the game
      • Unit Group - Remove all units from Selected[(Player number of (Owner of (Casting unit)))].



I want to re-define CSD_Point to the position of damage target, considering the order of everything in the trigger where/when should i define this? This is for the Nuke tower, so the damage will be dealt in a 400 area on CSD_Point which would be on the damage target.
  • Ghost
    • Events
      • Unit - A unit Takes damage
    • Conditions
      • (Level of Nuclear strike for (Damage source)) Greater than 0
      • (Damage From Normal Attack) Equal to True
    • Actions
      • -------- Store our important data into variables to make the trigger efficient, bug free, and memory leak free: --------
      • Set VariableSet CSD_Hero = (Damage source)
      • Set VariableSet CSD_Hero_Player = (Owner of CSD_Hero)
      • Set VariableSet CSD_Point = (Position of CSD_Hero)
      • Set VariableSet CSD_Group = (Units within 400.00 of CSD_Point.)
      • -------- --------
      • -------- Create some fancy special effects to make things really pop! WOW! --------
      • Special Effect - Create a special effect at CSD_Point using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • -------- --------
      • -------- Deal damage to surrounding enemy units that match the conditions: --------
      • Trigger - Turn off Ghost <gen>
      • Unit Group - Pick every unit in CSD_Group and do (Actions)
        • Loop - Actions
          • Set VariableSet CSD_Enemy = (Picked unit)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (CSD_Enemy belongs to an enemy of CSD_Hero_Player.) Equal to True
              • (CSD_Enemy is alive) Equal to True
              • (CSD_Enemy is A structure) Equal to False
              • (CSD_Enemy is invulnerable) Equal to False
            • Then - Actions
              • Set VariableSet CSD_Damage = (Random real number between 650.00 and 1200.00)
              • Unit - Cause CSD_Hero to damage CSD_Enemy, dealing CSD_Damage damage of attack type Chaos and damage type Normal
            • Else - Actions
      • Trigger - Turn on Ghost <gen>
      • -------- We turn this trigger off/on during the damage dealing stage to prevent it from running again (It could crash otherwise because it can cause an infinite loop) --------
      • -------- --------
      • -------- Clean up the memory leaks: --------
      • Custom script: call RemoveLocation( udg_CSD_Point )
      • Custom script: call DestroyGroup( udg_CSD_Group )
I also am thinking of using this same trigger basically the way it is for the Tesla Coil BUT i would have to change it to damage several random units in 400 Area around the tower using lightning attack, or at least something like a ward casting chain lightning and dealing damage with a trigger.


After this i think im done with this post as it's getting really long and messy and i got other big stuff to work on which will probably require their own posts but first i'll try playing around and figure out something myself, but i'm pretty sure i am gonna need help with a game mode that spawns creeps in increments of 2 after the original spawn...adding upon someone elses work is, tricky when one doesnt quite understand how everything functions :p
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
This Ultimate Thunder Tower Build trigger is incorrect. You don't need to calculate the damage or use a unit group:
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (10 x Thunder_Tower_Damage[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Simply set this towers ability attack damage to Thunder_Tower_Damage[Thunder_Tower_PN]:
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
      • Unit - Increase level of Overcharged Capacitors for (Triggering unit)
      • Unit - Decrease level of Overcharged Capacitors for (Triggering unit)
Remember, we're now tracking the total Damage at all times with Thunder_Tower_Damage. It'll always be equal to the exact value and doesn't need any extra steps like multiplying it.

Also, the Thunder Tower Subtract trigger is probably no longer necessary since you're never killing the tower. Your Sell trigger removes the unit which doesn't kill it, so assuming that these towers are never killed and only ever removed then you can delete the trigger since it'll never run.
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
This Ultimate Thunder Tower Build trigger is incorrect. You don't need to calculate the damage or use a unit group:
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (10 x Thunder_Tower_Damage[Thunder_Tower_PN])
      • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Constructed structure)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
      • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
        • Loop - Actions
          • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
          • Unit - Increase level of Overcharged Capacitors for (Picked unit)
          • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
      • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
Simply set this towers ability attack damage to Thunder_Tower_Damage[Thunder_Tower_PN]:
  • Ultimate Thunder Tower Build
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Unit-type of (Constructed structure)) Equal to Power Plant (Thunder)
    • Actions
      • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Constructed structure)))
      • -------- --------
      • -------- Adjust damage: --------
      • Ability - Set Ability: (Unit: (Triggering unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
      • Unit - Increase level of Overcharged Capacitors for (Triggering unit)
      • Unit - Decrease level of Overcharged Capacitors for (Triggering unit)
Remember, we're now tracking the total Damage at all times with Thunder_Tower_Damage. It'll always be equal to the exact value and doesn't need any extra steps like multiplying it.

Also, the Thunder Tower Subtract trigger is probably no longer necessary since you're never killing the tower. Your Sell trigger removes the unit which doesn't kill it, so assuming that these towers are never killed and only ever removed then you can delete the trigger since it'll never run.

I see thank you that part was a bit unclear to me. I do need the T.T. Subtract due to a few siege rounds in the map that do kill the towers.
I also would have forgotten to change from Picked Unit to Triggering Unit.

Continuing on the sell triggers as i didnt have much time yesterday, by the time im done (in 10 years or so) the entire map is gonna get revamped but hey as long as it works better and i learn im all up for it, there's too many rookie mistakes i still make
 
Last edited:
Level 4
Joined
Jul 22, 2023
Messages
36
Okay so i've imported your Sell trigger, changed the spell used to the one my map uses and it didnt work, was hoping to cut some corners but ended up getting the ability from you as well, added it and it works, sells for proper ammount (gotta do a better check on this) but displays double the ammount, there is also a trigger somewhere in the map i have to find that adds the original sell ability to all the towers since im guessing this is causing the issues and to remove the original sell button as it's not set as an ability on the object but is set somewhere in the triggers for all the towers.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Found the trigger and simply replaced the spell used to Sell towers, easy fix.
It also fixed the sell bug the map had.
Just had to add the /4 to give player gold value and the chat response and that's about it.

Now i just need to add the conditions for which towers get the sell spell and when sell is allowed, as it shouldnt be during siege rounds when towers are getting damaged which i should manage np and if the sell bug returns i know where to search for the culprit.

Thanks it's really an easy to understand Sell trigger, unlike the original version... With all the resources you provided for me, i see no reasons why the original triggers are so convoluted. Though the whole backside of the map is a bit messy, am thinking at this point it would probably be easier to just recreate the damn thing from scratch and copy paste the objects in but hey, ive gotten this far.

The only thing i am unsure about is the ability to transfer towers to a different players for thunder stacking that ive edited if i can ask you to check it out, i just hope you dont find the entire system outdated lol

What ive done here is add the Thunder Stacking remove/sell part of the trigger under Actions>Unit Group>Loop, and at the end added Run:Thunder Stacking add checking conditions (hoping it works as im not testing multiplayer yet). What IS Supposed to happen with this trigger is:
Transfer the ownership of the tower to another player, remove it from that players Thunder dmg stack, and add the tower to the recieving players Thunder dmg stack but i have my doubts about it, feel like something is missing or wrong.
  • Cede Button
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Player 1 (Red)
          • (Ability being cast) Equal to Player 2 (Blue)
          • (Ability being cast) Equal to Player 3 (Teal)
          • (Ability being cast) Equal to Player 4 (Purple)
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to CedeAbility[(Integer A)]
            • Then - Actions
              • Set VariableSet CedePlayer = (Player((Integer A)))
            • Else - Actions
      • If ((CedePlayer slot status) Not equal to Is playing) then do (Skip remaining actions) else do (Do nothing)
      • If (CedePlayer Equal to (Owner of (Casting unit))) then do (Skip remaining actions) else do (Do nothing)
      • If ((Number of units in Selected[(Player number of (Owner of (Casting unit)))]) Equal to 0) then do (Skip remaining actions) else do (Do nothing)
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
                  • (Level of Thunder Class+50 for (Triggering unit)) Equal to 1
            • Then - Actions
              • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Triggering unit)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Thunder Class+5 for (Triggering unit)) Equal to 1
                • Then - Actions
                  • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 5)
                • Else - Actions
                  • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 50)
              • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Triggering unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
              • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
                • Loop - Actions
                  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
                  • Unit - Increase level of Overcharged Capacitors for (Picked unit)
                  • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
              • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is selected by (Owner of (Casting unit)).) Equal to False
                  • ((Picked unit) is in Transmuters.) Equal to True
                  • (Point-value of (Picked unit)) Less than or equal to 1
                  • (Life of (Picked unit)) Not equal to (Max life of (Picked unit))
            • Then - Actions
              • Unit Group - Remove (Picked unit) from Selected[(Player number of (Owner of (Casting unit)))].
            • Else - Actions
      • Game - Display to (Player group((Owner of (Casting unit)))) the text: (You have ceded |cffff0000 + ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + (|r building(s) to |cffffcc00 + ((Name of CedePlayer) + |r.))))
      • Game - Display to (Player group(CedePlayer)) the text: ((|cffffcc00 + (Name of (Owner of (Casting unit)))) + (|r has ceded |cffff0000 + ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + |r building(s) to you.)))
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Unit - Change ownership of (Picked unit) to CedePlayer and Change color)
      • Unit Group - Remove all units from Selected[(Player number of (Owner of (Casting unit)))].
      • Trigger - Run Thunder Tower Add <gen> (checking conditions)
 
Last edited:

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,724
I haven't looked into your trigger yet but for transferring the tower, which I assume means changing it's owner from say Player 1 to Player 2, you would do the following in this order:

For transferring a basic tower (not a Power Plant (Thunder)):
1) Set PN1 = Player number of Player 1. Set PN2 = Player number of Player 2.
2) Set X = The amount of damage that the tower adds (5 or 50).
3) Subtract X from Thunder_Tower_Damage[PN1]. Add X to Thunder_Tower_Damage[PN2].
4) Change ownership of the tower being transferred.
5) Use the Thunder_Tower_Group + Pick Every Unit actions twice, once for each player, this way their Power Plants use the new updated Thunder_Tower_Damage values.

For transferring a Power Plant (Thunder):
1) Change ownership of the tower being transferred.
2) Apply Thunder_Tower_Damage directly on the unit being transferred using the new owner's player number. This is like how we handle the Ultimate Thunder Tower Build trigger, simple and direct.

Using Unit/Player variables could come in handy here to avoid headaches/bugs.
 
Level 4
Joined
Jul 22, 2023
Messages
36
I haven't looked into your trigger yet but for transferring the tower, which I assume means changing it's owner from say Player 1 to Player 2, you would do the following in this order:

For transferring a basic tower (not a Power Plant (Thunder)):
1) Set PN1 = Player number of Player 1. Set PN2 = Player number of Player 2.
2) Set X = The amount of damage that the tower adds (5 or 50).
3) Subtract X from Thunder_Tower_Damage[PN1]. Add X to Thunder_Tower_Damage[PN2].
4) Change ownership of the tower being transferred.
5) Use the Thunder_Tower_Group + Pick Every Unit actions twice, once for each player, this way their Power Plants use the new updated Thunder_Tower_Damage values.

For transferring a Power Plant (Thunder):
1) Change ownership of the tower being transferred.
2) Apply Thunder_Tower_Damage directly on the unit being transferred using the new owner's player number. This is like how we handle the Ultimate Thunder Tower Build trigger, simple and direct.

Using Unit/Player variables could come in handy here to avoid headaches/bugs.

I think ive got it now, had to adjust triggering unit/casting unit/picked unit on triggers and the sell one works properly so im assuming the transfer one works as well.
When it comes to the transfer one, i added the subtract part on the part (i think) is responsible for removing the tower, and add part on the bottom where (i hope) is the part to add tower to another player. I might be misunderstanding here, think of me like an ape with a smartphone when it comes to triggers:peasant-confused:
I have added the "add and subtract" parts of the trigger to the transfer trigger, do i have to add any part of the "power plant built" trigger in as well?
Didn't even think of transferring the actual Ultimate tower and it's damage tbh...
I had some issues adding sell conditions for the unit to be at full hp at least before sell works and it ended up not working at all. Original has a few more conditions but i think they are redundant so i have to play around with that a bit more but i'll take any suggestions or references.

After these things work properly i think im pretty much done with editing the original editors stuff, other than adding a game mode which i already know i will request help with because i dont know how to make it do what i want it to do. Other than that, ive been browsing the hive workshop resources lately and found a lot of things i wont bother asking about anymore since there's so much available from kind creators who share their stuff i can just copy pasta (ill make sure to credit).


  • Cede Button
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Player 1 (Red)
          • (Ability being cast) Equal to Player 2 (Blue)
          • (Ability being cast) Equal to Player 3 (Teal)
          • (Ability being cast) Equal to Player 4 (Purple)
    • Actions
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to CedeAbility[(Integer A)]
            • Then - Actions
              • Set VariableSet CedePlayer = (Player((Integer A)))
            • Else - Actions
      • If ((CedePlayer slot status) Not equal to Is playing) then do (Skip remaining actions) else do (Do nothing)
      • If (CedePlayer Equal to (Owner of (Casting unit))) then do (Skip remaining actions) else do (Do nothing)
      • If ((Number of units in Selected[(Player number of (Owner of (Casting unit)))]) Equal to 0) then do (Skip remaining actions) else do (Do nothing)
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) is selected by (Owner of (Casting unit)).) Equal to False
                  • ((Picked unit) is in Transmuters.) Equal to True
                  • (Point-value of (Picked unit)) Less than or equal to 1
                  • (Life of (Picked unit)) Not equal to (Max life of (Picked unit))
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Level of Thunder Class+5 for (Picked unit)) Equal to 1
                      • (Level of Thunder Class+50 for (Picked unit)) Equal to 1
                • Then - Actions
                  • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Picked unit)))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Level of Thunder Class+5 for (Picked unit)) Equal to 1
                    • Then - Actions
                      • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 5)
                    • Else - Actions
                      • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 50)
                  • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
                  • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
                    • Loop - Actions
                      • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
                      • Unit - Increase level of Overcharged Capacitors for (Picked unit)
                      • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
                  • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
                • Else - Actions
              • Unit Group - Remove (Picked unit) from Selected[(Player number of (Owner of (Casting unit)))].
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Level of Thunder Class+5 for (Casting unit)) Equal to 1
              • (Level of Thunder Class+50 for (Casting unit)) Equal to 1
        • Then - Actions
          • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Casting unit)))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Thunder Class+5 for (Casting unit)) Equal to 1
            • Then - Actions
              • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] + 5)
            • Else - Actions
              • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] + 50)
          • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Casting unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
          • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
            • Loop - Actions
              • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
              • Unit - Increase level of Overcharged Capacitors for (Picked unit)
              • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
          • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
        • Else - Actions
      • Game - Display to (Player group((Owner of (Casting unit)))) the text: (You have ceded |cffff0000 + ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + (|r building(s) to |cffffcc00 + ((Name of CedePlayer) + |r.))))
      • Game - Display to (Player group(CedePlayer)) the text: ((|cffffcc00 + (Name of (Owner of (Casting unit)))) + (|r has ceded |cffff0000 + ((String((Number of units in Selected[(Player number of (Owner of (Casting unit)))]))) + |r building(s) to you.)))
      • Unit Group - Pick every unit in Selected[(Player number of (Owner of (Casting unit)))] and do (Unit - Change ownership of (Picked unit) to CedePlayer and Change color)
      • Unit Group - Remove all units from Selected[(Player number of (Owner of (Casting unit)))].
  • Sell Tower Finish
    • Events
    • Conditions
    • Actions
      • -------- Set Sell_PN to the Player Number of the Player whose Timer just expired: --------
      • -------- --------
      • Custom script: local timer t = GetExpiredTimer()
      • Set VariableSet Sell_PN = 0
      • Custom script: loop
      • Set VariableSet Sell_PN = (Sell_PN + 1)
      • Custom script: if t == udg_Sell_Timer[udg_Sell_PN] then
      • Custom script: exitwhen true
      • Custom script: endif
      • Custom script: endloop
      • Custom script: set t = null
      • -------- --------
      • -------- We can now reference Sell_PN to interact with our desired Player. --------
      • Set VariableSet Sell_Player = (Player(Sell_PN))
      • -------- --------
      • Set VariableSet Sell_Count = 0
      • Set VariableSet Sell_Value = 0
      • Unit Group - Pick every unit in Sell_Group[Sell_PN] and do (Actions)
        • Loop - Actions
          • Set VariableSet Sell_Tower = (Picked unit)
          • -------- --------
          • -------- Put your Thunder Tower actions here! Sell_Tower is the tower being sold. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Level of Thunder Class+5 for (Picked unit)) Equal to 1
                  • (Level of Thunder Class+50 for (Picked unit)) Equal to 1
            • Then - Actions
              • Set VariableSet Thunder_Tower_PN = (Player number of (Owner of (Picked unit)))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Level of Thunder Class+5 for (Picked unit)) Equal to 1
                • Then - Actions
                  • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 5)
                • Else - Actions
                  • Set VariableSet Thunder_Tower_Damage[Thunder_Tower_PN] = (Thunder_Tower_Damage[Thunder_Tower_PN] - 50)
              • Set VariableSet Thunder_Tower_Group = (Units owned by (Owner of (Picked unit)) matching ((Unit-type of (Matching unit)) Equal to Power Plant (Thunder)).)
              • Unit Group - Pick every unit in Thunder_Tower_Group and do (Actions)
                • Loop - Actions
                  • Ability - Set Ability: (Unit: (Picked unit)'s Ability with Ability Code: Overcharged Capacitors )'s Integer Level Field: Attack Bonus ('Iatt') of Level: 0 to Thunder_Tower_Damage[Thunder_Tower_PN]
                  • Unit - Increase level of Overcharged Capacitors for (Picked unit)
                  • Unit - Decrease level of Overcharged Capacitors for (Picked unit)
              • Custom script: call DestroyGroup(udg_Thunder_Tower_Group)
            • Else - Actions
          • -------- --------
          • -------- Calculate the total gold rewarded and then rermove the tower: --------
          • Set VariableSet Sell_Count = (Sell_Count + 1)
          • Set VariableSet Sell_Value = (Sell_Value + (3 x (Point-value of Sell_Tower)))
          • Unit - Remove Sell_Tower from the game
      • -------- --------
      • -------- Do nothing if there's nothing to sell: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Sell_Count Equal to 0
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • -------- --------
      • Player - Add (Sell_Value / 4) to Sell_Player.Current gold
      • Game - Display to (Player group(Sell_Player)) for 30.00 seconds the text: (Sold + ((String(Sell_Count)) + ( towers for + ((String((Sell_Value / 4))) + gold!))))
 
Top