[Jass=]
function Fireball takes nothing returns boolean
local unit targetU
local destructable targetD
local unit caster = GetTriggerUnit()
local unit dummy
local boolean tree
local real dmg
local real x
local real y
if GetSpellAbilityId() == 'A101' then
if ( GetSpellTargetUnit() == null ) then
set targetD = GetSpellTargetDestructable()
set tree = true
set x = GetDestructableX(targetD)
set y = GetDestructableY(targetD)
else
set targetU = GetSpellTargetUnit()
set tree = false
set x = GetUnitX(targetU)
set y = GetUnitY(targetU)
endif
if IsTerrainPathable( x, y, PATHING_TYPE_FLOATABILITY) or udg_Raining then
if not tree then
call UnitDamageTarget(caster, targetU, 60.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WOOD_MEDIUM_BASH)
set dummy = CreateUnit( GetOwningPlayer(caster), 'hfoo', x, y, bj_UNIT_FACING )
call UnitAddAbility( dummy , 'Abun' )
call IssueTargetOrder( dummy, "attack", targetU )
else
call DisableTrigger( gg_trg_DropItemDestructible__JASS )
call KillDestructable( targetD )
call EnableTrigger( gg_trg_DropItemDestructible__JASS )
endif
else
if not tree then
call UnitDamageTarget(caster, targetU, 30.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WOOD_MEDIUM_BASH)
else
call DisableTrigger( gg_trg_DropItemDestructible__JASS )
call UnitDamageTarget(caster, targetU, 100.00, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WOOD_MEDIUM_BASH)
call EnableTrigger( gg_trg_DropItemDestructible__JASS )
endif
endif
set targetU = null
set targetD = null
set caster = null
set dummy = null
endif
return false
endfunction
//===========================================================================
function InitTrig_custom_Fireball_JASS takes nothing returns nothing
set gg_trg_custom_Fireball_JASS = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_custom_Fireball_JASS, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_custom_Fireball_JASS, Condition( function Fireball ) )
endfunction
[/code]
so, is this ok?
what does the damage type fire do?
and is there a way to not get a weapon type (it is used only for sound right?)
Edit
it needed return a boolean