- Joined
- Jul 14, 2011
- Messages
- 3,213
Hi! I made this trigger to deal the sum of the last 5 hits to the target. Now I want to pick every unit in 350 from the position of the target to cast Purge on them. I've been trying for about 30 minutes to understand how to create the UnitGroups and else in JASS without leaking or bugging.
What I want to do is basically this, adding the actions in the JASS script below.
JASS:
function Electric7Overcharge_Conditions takes nothing returns boolean
return GetUnitTypeId(udg_GDD_DamageSource) == 'h01S'
endfunction
function Electric_7_Overcharge_Actions takes nothing returns nothing
local integer Id = GetHandleId(udg_GDD_DamageSource) // Damage Source ID
local integer Hits = (LoadInteger(udg_Hash, Id, 4) + 1) // Amount of Hits
local real Damage = (LoadReal(udg_Hash, Id, 5) + udg_GDD_Damage) // Amount of damage dealt
local texttag TT = CreateTextTag() // The Critical TextTag
call SaveInteger(udg_Hash, Id, 4, Hits) // Update Hits
call SaveReal(udg_Hash, Id, 5, Damage) // Update Damage
// Deal Damage if "Hits > 5" and display TextTag"
if Hits == 5 then
call DisableTrigger(gg_trg_Electric_7_Overcharge)
call UnitDamageTarget(udg_GDD_DamageSource, udg_GDD_DamagedUnit, Damage, true, true, ATTACK_TYPE_HERO, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
call EnableTrigger(gg_trg_Electric_7_Overcharge)
// Text Tag Critical
call SetTextTagPermanent(TT, false)
call SetTextTagText(TT, (I2S(R2I(Damage)) + "!"), 0.036)
call SetTextTagPos(TT, GetUnitX(udg_GDD_DamagedUnit), GetUnitY(udg_GDD_DamagedUnit), 0)
call SetTextTagColor(TT, 230, 0, 0, 255)
call SetTextTagVelocity(TT, (0.08 * Cos(90 * bj_DEGTORAD)), ((0.08 * Sin(90 * bj_DEGTORAD))))
call SetTextTagVisibility(TT, true)
call SetTextTagLifespan(TT, 3)
call SetTextTagFadepoint(TT, 2)
// Clearing values
call SaveInteger(udg_Hash, Id, 4, 0)
call SaveReal(udg_Hash, Id, 5, 0)
// Special Effect
set udg_SfxQ = (udg_SfxQ + 1)
set udg_Sfx[udg_SfxQ] = AddSpecialEffect("war3mapImported\\LightningsLong.mdx", GetUnitX(udg_GDD_DamagedUnit), GetUnitY(udg_GDD_DamagedUnit))
set udg_Reals = (udg_Reals + 1)
// Here's where the Unit Group thing goes.
endif
set TT = null
endfunction
//===========================================================================
function InitTrig_Electric_7_Overcharge takes nothing returns nothing
set gg_trg_Electric_7_Overcharge = CreateTrigger( )
call TriggerRegisterVariableEvent( gg_trg_Electric_7_Overcharge, "udg_GDD_Event", EQUAL, 0 )
call TriggerAddCondition( gg_trg_Electric_7_Overcharge, function Electric7Overcharge_Conditions )
call TriggerAddAction( gg_trg_Electric_7_Overcharge, function Electric_7_Overcharge_Actions )
endfunction
What I want to do is basically this, adding the actions in the JASS script below.
-
Actions
- Custom script: set bj_wantDestroyGroup == true
-
Unit Group - Pick every unit in (Units within 350.00 of (Position of GDD_DamagedUnit) matching (((Picked unit) belongs to an enemy of (Owner of GDD_DamageSource)) Equal to True)) and do (Actions)
- Loop - (Actions)
JASS:
function Electric_7_OverChargeGroup_Actions takes nothing returns nothing
call CreateUnit(GetOwningPlayer(udg_GDD_DamageSource), 'h021', GetUnitX(udg_GDD_DamagedUnit), GetUnitY(udg_GDD_DamagedUnit), 0.00)
call UnitAddAbility(bj_lastCreatedUnit, 'A004')
call UnitApplyTimedLife(bj_lastCreatedUnit, 'BTLF', 1.00)
call IssueTargetOrder(GetEnumUnit(), "purge", bj_lastCreatedUnit)
endfunction
Last edited: