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.
Hi everyone! Does anyone know how to make goblin mines to deal damage depending on Intelligence of their master in triggers?)![]()
Setting Damage

Events


Unit - A unit Finishes casting an ability

Conditions


(Ability being cast) Equal to Mine - exploding (Goblin Land Mine)

Actions


Set u = (Triggering unit)


Set cv = (Custom value of u)


Set MINE_DMG[cv] = ((Real((Intelligence of (Triggering unit) (Exclude bonuses)))) x 50.00)


Set AOE[cv] = 256.00


Trigger - Turn on Dealing Damage <gen>
Dealing Damage

Events


Unit - A unit comes within 256.00 of Your Mine

Conditions

Actions


Unit - Cause u to damage circular area after 0.00 seconds of radius AOE[cv] at (Position of (Triggering unit)), dealing MINE_DMG[cv] damage of attack type Spells and damage type Normal
Do you need them MUI ?
Setting Damage
Events
Unit - A unit Finishes casting an ability
Conditions
(Ability being cast) Equal to Mine - exploding (Goblin Land Mine)
Actions
Set u = (Triggering unit)
Set cv = (Custom value of u)
Set MINE_DMG[cv] = ((Real((Intelligence of (Triggering unit) (Exclude bonuses)))) x 50.00)
Set AOE[cv] = 256.00
Trigger - Turn on Dealing Damage <gen>
that's just an example.
Dealing Damage
Events
Unit - A unit comes within 256.00 of Your Mine
Conditions
Actions
Unit - Cause u to damage circular area after 0.00 seconds of radius AOE[cv] at (Position of (Triggering unit)), dealing MINE_DMG[cv] damage of attack type Spells and damage type Normal
Note : - Mine_DMG and AOE is a real variables.
- cv is an integer variable.
- u is a unit variable.
Setting Damage

Events


Unit - A unit Starts the effect of an ability

Conditions


(Ability being cast) Equal to Item Place Goblin Land Mines

Actions


Set u = (Triggering unit)


Set cv = (Custom value of u)


Set MINE_DMG[cv] = ((Real((Intelligence of (Triggering unit) (Exclude bonuses)))) x 50.00)


Set AOE[cv] = 256.00


Trigger - Turn on Dealing Damage <gen>
Dealing Damage

Events


Unit - A unit comes within 256.00 of Goblin Land Mines

Conditions

Actions


Unit - Cause u to damage circular area after 0.00 seconds of radius AOE[cv] at (Position of (Triggering unit)), dealing MINE_DMG[cv] damage of attack type Spells and damage type Normal
Use starts the effect of ability instead of finishes casting... because finishes casting runs when the unit finishes casting which includes playing all animations included for the cast, which in a normal scenario doesn't happen much as the user normally already issues another order before the unit actually finishes casting...
fixed!because it doesn't need to... You trigger the damage when a unit comes near the mine which is also when it blows up so no need to check the ability itself...
though his trigger has errors... first it isn't MUI... second it doesn't check if the unit can actually trigger the mine or not (it triggers for all units passing near the mine)... third, unit in range takes a direct unit as an event (it cannot take unit-types) so you need to register every appearing goblin mine to that trigger...
Events

Unit - A unit enters the map
Conditions

Unit-type of triggering unit equal to Goblin Mine
Actions

Trigger- Add to EXPLOSION_TRIGGER the event Unit - A unit comes within 256.0 of Triggering unit
Though this way is a bit inefficient and causes event leaks... you might actually just want to check when a unit of type goblin mine dies...
Events
Unit - A unit enters the map
Conditions
Unit-type of triggering unit equal to Goblin Mine
Actions
Trigger- Add to EXPLOSION_TRIGGER the event Unit - A unit comes within 256.0 of Triggering unit

Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Goblin Land Mine (tinker)
Actions
Set Goblin_Mine_Caster = (Casting unit)
Events
Unit - A unit enters (Playable map area)
Conditions
(Unit-type of (Entering unit)) Equal to 1. Goblin Land Mine
Actions
Set Goblin_Mine_1 = (Entering unit)
Wait 2:00 seconds
Trigger - Add to Goblin Land Mines Damage 1 <gen> the event (Unit - A unit comes within 200.00 of Goblin_Mine_1)
Events
Conditions
Actions
Set Goblin_Mine_Group_1 = (Units within (((Real((Level of Goblin Land Mine(tinker) for Goblin_Mine_Caster))) x 25) + 125.00) of (Position of Goblin_Mine_1) matching ((((Matching unit) belongs to an enemy of (Owner of Goblin_Mine_Caster)) Equal to True and ((((Matching unit ) is A structure) Not equal to True) and (((Matching unit) is alive) Equal to True)
Unit Group - Pick every unit in Goblin_Mine_Group_1 and do (Actions)
Loop - Actions
Unit - Cause Goblin _Mine_Caster to damage Picked unit, dealing ((Real((Intelligence of Goblin_Mine_Caster (Include bonuses)))) x 50) damage of attack type Spells and damage type Fire
Events

Unit - A unit is summoned
Conditions

Unit Type of (Triggering Unit) is Equal to Goblin Land Mine
Actions

Set Stat = Intelligence of (Summong Unit)

Custom script: call SaveReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0, udg_Stat)
Events

Unit - A unit dies
Conditions

Unit type of (Triggering Unit) equal to Goblin Land Mine
Actions

Custom script: set udg_RealVariable = LoadReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0)

Custom script: set bj_wantDestroyGroup = true

Unit Group - Pick Every unit in 350 radius and do (Actions)


Loop - (Actions)



Unit - Make Triggering cause RealVariable damage to (Picked Unit)

Hashtable - Flush Child Hash of Key(Handle(Triggering Unit))
Too complex. I would do something similar to this:
What it basically does is detect the Mine entering the map, and saving the Intelligence of the Caster on the Mine Handle Id. When the Mine Dies, it retrieves the Intelligence saved on it's Id, and deal that damage to units around.
Events
Unit - A unit is summoned
Conditions
Unit Type of (Triggering Unit) is Equal to Goblin Land Mine
Actions
Set Stat = Intelligence of (Summong Unit)
Custom script: call SaveReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0, udg_Stat)
Events
Unit - A unit dies
Conditions
Unit type of (Triggering Unit) equal to Goblin Land Mine
Actions
Custom script: set udg_RealVariable = LoadReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick Every unit in 350 radius and do (Actions)
Loop - (Actions)
Unit - Make Triggering cause RealVariable damage to (Picked Unit)
Hashtable - Flush Child Hash of Key(Handle(Triggering Unit))
what.... that customscript set bj_wantdestroygroup = true destroys the next unit group ?
then i don't need to use variables?
// This function automatically clears the group before adding new units to it.
call GroupEnumUnitsInRange(bj_lastCreatedGroup, radius, X, Y, null)
loop
set u = FirstOfGroup(bj_lastCreatedGroup)
exitwhen u = null
if u == *Your Conditions* then
Do your thing
endif
call GroupRemoveUnit(u, bj_lastCreatedGroup)
endloop
There are some cases when you need to declare the Group into a variable, and some where you can just use that set bj_wantDestroyGroup = true script.
If you use some custom scripts you can even optimize the thing and even avoid having to create/destroy a group, like the following:
JASS:// This function automatically clears the group before adding new units to it. call GroupEnumUnitsInRange(bj_lastCreatedGroup, radius, X, Y, null) loop set u = FirstOfGroup(bj_lastCreatedGroup) exitwhen u = null if u == *Your Conditions* then Do your thing endif call GroupRemoveUnit(u, bj_lastCreatedGroup) endloop
Adding/removing units from an already created group is a lot faster than creating a group, adding units, then destroying the group.
do removing units from a Unit group means destroying the group ?NOPE... they are clearly not equal... remove units is just that, removing units... the group will still remain...
but in this case you're not supposed to destroy the group, since he's using the global group bj_lastCreatedGroup... if you destroy it, you're doomed, I assure that...
Too complex. I would do something similar to this:
What it basically does is detect the Mine entering the map, and saving the Intelligence of the Caster on the Mine Handle Id. When the Mine Dies, it retrieves the Intelligence saved on it's Id, and deal that damage to units around.
Events
Unit - A unit is summoned
Conditions
Unit Type of (Triggering Unit) is Equal to Goblin Land Mine
Actions
Set Stat = Intelligence of (Summong Unit)
Custom script: call SaveReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0, udg_Stat)
Events
Unit - A unit dies
Conditions
Unit type of (Triggering Unit) equal to Goblin Land Mine
Actions
Custom script: set udg_RealVariable = LoadReal(udg_HashtableName, GetHandleId(GetTriggerUnit()), 0)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick Every unit in 350 radius and do (Actions)
Loop - (Actions)
Unit - Make Triggering cause RealVariable damage to (Picked Unit)
Hashtable - Flush Child Hash of Key(Handle(Triggering Unit))

Hashtable - Save 5 as Key(Handle(Triggering Unit)) of 1 in Hashtable
Set Value[Custom value of (Triggering Unit)] = 5.

Check the unit-type, not the exact unit so that it will fire for all goblin mines...
Look at his trigger, he used unit-type as the condition and not a specific unit...
If you will just copy his trigger as it is, you will have no problems... seriously...
function OR Conditions takes nothing returns boolean
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
return true
endif
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
return true
endif
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
return true
endif
if ( ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) == true ) ) then
return true
endif
return false
endfunction
function IsUnitInGroup condition takes nothing returns boolean
if ( not ( IsUnitInGroup(GetTriggerUnit(), GetLastCreatedGroup()) == true ) ) then
return false
endif
return true
endfunction
You can make a small chain of If/Then/Else to save an specific value (like Intx1, Intx2, Intx3, Intx4) based on the mine that's being summoned, instead of creating 1 trigger for each one.
You can also add them to a UnitGroup (Mines) so the condition for "A unit dies" is "Unit is in Mines group". It's still better than having 4 triggers with different condition for each mine type.

if IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then
Since you've used the jass conversion then let me make a better one:
JASS:if IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) or IsUnitType(GetTriggerUnit(), UNIT_TYPE_STRUCTURE) then

