- Joined
- Apr 16, 2025
- Messages
- 160
Well, I mean, so it hits a single target only once, like chain lightning, rather than jumping between two units. I couldn't find the answer online...
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
You need to track which units were already hit, for example in unit group and use that unit group to filter out potential new targets.
What is auto-aim? That doesn't sound like a mechanic in Warcraft 3.That sounds complicated!
udg. I did some searching and found out that turning off auto-aim fixes everything. Anyway, thanks!
If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions


(NextEnemyUnit is in I_Was_Already_Hit) Equal to False

Then - Actions


Unit Group - Add NextEnemyUnit to I_Was_Already_Hit


Unit - Deal 1000.00 damage to NextEnemyUnit...

Else - Actions
missile homing - yes/no.What is auto-aim? That doesn't sound like a mechanic in Warcraft 3.
Anyway, it's not that complicated:
A Unit Group is just a container that holds Units. So it's like a bag, or a box, or a drawer. You can Add things to it (put them in the bag), you can Remove things from it (take them out of the bag), you can check if something is in the bag (like in my Condition above), and you can interact with everything inside of the bag (Pick every unit).
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(NextEnemyUnit is in I_Was_Already_Hit) Equal to False
Then - Actions
Unit Group - Add NextEnemyUnit to I_Was_Already_Hit
Unit - Deal 1000.00 damage to NextEnemyUnit...
Else - Actions
So Chain Lightning isn't that complicated to recreate yourself. Here are the basic steps:
1) Add nearby units to a temporary Unit Group.
2) Remove any units that are "bad" targets from this temporary Unit Group -> Allies, Structures, Units that were already hit, etc.
3) Now you're left with a Unit Group that contains only "good" targets. Pick one at random or pick the closest one (using distance checks).
4) Damage that picked unit and Add them to the "already hit" Unit Group.
5) Repeat this process X times, which is how many Bounces you have.
I see.missile homing - yes/no.
This is in the unit editor. I have a very busy map with extra units, 500 towers and hundreds of mobs, so thankfully there's an in-game solution.
Anyway, thanks for the help.
I'm not too sure what you mean. What are you trying to do exactly?By the way, do you know how to track a unit's deletion? For some reason, leaving the game map doesn't track it.
I see.
I'm not too sure what you mean. What are you trying to do exactly?
function Trig_Enter_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local player p = GetOwningPlayer(u)
local integer playerId = GetPlayerId(p)
if (GetUnitTypeId(u) == 'h00C' and playerId >= 0 and playerId <= 5) then
set udg_ArmageddonGuntowers[playerId] = udg_ArmageddonGuntowers[playerId] + 1
if (udg_ArmageddonGuntowers[playerId] >= 30) then
call SetPlayerTechResearched(p, 'R03A', 1)
endif
endif
set u = null
set p = null
endfunction
function InitTrig_Enter takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_UPGRADE_FINISH)
call TriggerAddAction(t, function Trig_Enter_Actions)
set t = null
endfunction
function Trig_Leave_Actions takes nothing returns nothing
local unit u = GetDyingUnit()
local player p = GetOwningPlayer(u)
local integer playerId = GetPlayerId(p)
if (GetUnitTypeId(u) == 'h00C' and playerId >= 0 and playerId <= 5) then
set udg_ArmageddonGuntowers[playerId] = udg_ArmageddonGuntowers[playerId] - 1
if (udg_ArmageddonGuntowers[playerId] < 30) then
call SetPlayerTechResearched(p, 'R03A', 0)
endif
endif
set u = null
set p = null
endfunction
function InitTrig_Leave takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t, function Trig_Leave_Actions)
set t = null
endfunction
Actions

Unit - Kill (Triggering unit)

Unit - Remove (Triggering unit) from the game
Sell Towers

Events


Unit - A unit Begins casting an ability

Conditions


(Ability being cast) Equal to Sell Tower

Actions


Set Variable PN = (Player number of (Owner of (Triggering unit))


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




PN Less than 6




Unit-type of (Triggering unit) Equal to Armageddon Gun Tower



Then - Actions




Set Variable ArmageddonGuntowers[PN] = (ArmageddonGuntowers[PN] - 1)




...



Else - Actions


Unit - Remove (Triggering unit) from the game
Removing a unit skips the "A unit Dies" event. If you want to use that Event then you need to actually Kill the unit first:
Alternatively, you can just subtract 1 from ArmagedonGuntowers in your Sell trigger:
Actions
Unit - Kill (Triggering unit)
Unit - Remove (Triggering unit) from the game
Sell Towers
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Sell Tower
Actions
Set Variable PN = (Player number of (Owner of (Triggering unit))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
PN Less than 6
Unit-type of (Triggering unit) Equal to Armageddon Gun Tower
Then - Actions
Set Variable ArmageddonGuntowers[PN] = (ArmageddonGuntowers[PN] - 1)
...
Else - Actions
Unit - Remove (Triggering unit) from the game
