Ellimistrox
New Member
- Reaction score
- 10
Ok, I'm pretty new to Jass, only started recently, and mainly self taught. I've made a spell in GUI, Static Electricity, then tried converting it to Jass, filling with locals where required and removed as many BJ's as I could. However No matter what I seem to do when in Jass it hits only one unit, dealing damage and stunning, whereas it is meant to hit one in five units. (Used random integer condition, integer is set between 1-100, if equal to or below 20 the unit is stunned and damaged for 10 times the current mana of the caster.)
Also it IS meant to remove all mana from the unit.
PS It DID work in GUI form. :banghead:
Also it IS meant to remove all mana from the unit.
PS It DID work in GUI form. :banghead:
JASS:
function Trig_Static_Electricity_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 039;A005039;
endfunction
function Trig_Static_Electricity_Func001Func001Func004C takes nothing returns boolean
if ( not ( GetRandomInt(1, 100) <= 20 ) ) then
return false
endif
return true
endfunction
function Trig_Static_Electricity_Func001Func001C takes nothing returns boolean
if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_STRUCTURE) == false ) ) then
return false
endif
if ( not ( IsUnitEnemy(GetEnumUnit(), GetOwningPlayer(GetSpellAbilityUnit())) == true ) ) then
return false
endif
if ( not ( IsUnitAliveBJ(GetEnumUnit()) == true ) ) then
return false
endif
return true
endfunction
function Trig_Static_Electricity_Func001A takes nothing returns nothing
local unit u = GetSpellAbilityUnit()
local player p = GetOwningPlayer(u)
local real x
local real y
local unit e
local unit d
local real r = ( GetUnitStateSwap(UNIT_STATE_MANA, GetSpellAbilityUnit()) * 10.00 )
if ( Trig_Static_Electricity_Func001Func001C() ) then
if ( Trig_Static_Electricity_Func001Func001Func004C() ) then
set e = GetEnumUnit()
set x = GetUnitX(e)
set y = GetUnitY(e)
set d = CreateUnit( p, 039;h006039;, x, y, bj_UNIT_FACING )
call UnitAddAbility( d, 039;A006039; )
call IssueTargetOrder( d, "thunderbolt", e )
call UnitApplyTimedLife( d, 039;BTLF039;, 0.50 )
call UnitDamageTarget( u, e, r, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS )
else
endif
else
endif
endfunction
function Trig_Static_Electricity_Actions takes nothing returns nothing
local group g = GetUnitsInRectAll(GetEntireMapRect())
call ForGroup(g, function Trig_Static_Electricity_Func001A )
call SetUnitManaPercentBJ( GetSpellAbilityUnit(), 0.00 )
call PolledWait(2.50)
call DestroyGroup(g)
endfunction
function InitTrig_Static_Electricity takes nothing returns nothing
set gg_trg_Static_Electricity = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Static_Electricity, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Static_Electricity, Condition( function Trig_Static_Electricity_Conditions ) )
call TriggerAddAction( gg_trg_Static_Electricity, function Trig_Static_Electricity_Actions )
endfunction