- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, i've been reading some JESP spells lately and i found this approved spell.
The spell works perfectly and i must say that it is quite impressive ... However when JassCraft runs the syntax checker it founds lots of errors ... and i don't know why ... the main error is that it can't convert Handlers to something else ... I don't know why because the spell actually works, but i will not use bugged spells that cause tremendous lag in map multiplayer map.
Anyway here is the spell:
as you can see it is a knockback spell ... and i think it is easy to understand.
Any suggestions about why this is wrong ?? please ?
The spell works perfectly and i must say that it is quite impressive ... However when JassCraft runs the syntax checker it founds lots of errors ... and i don't know why ... the main error is that it can't convert Handlers to something else ... I don't know why because the spell actually works, but i will not use bugged spells that cause tremendous lag in map multiplayer map.
Anyway here is the spell:
JASS:
// Bloody // Bloody Pile Spell Configuration:
constant function BloodyPile_SpellId takes nothing returns integer
return 'A000' //Rawcode of the BloodyPile Ability
endfunction
constant function BloodyPile_SlideDuration takes nothing returns real
return 0.60 //Defines the slide duration of target
endfunction
constant function BloodyPile_SpellDemage takes integer level returns real
return level*90.00
//This formula adds 90 demage per level of the spell
//Starting from 90
endfunction
constant function BloodyPile_TargetConditions takes unit Caster, unit Target returns boolean
return (Target != Caster) and ( IsPlayerEnemy(GetOwningPlayer(Target), GetOwningPlayer(Caster)) ) and not(IsUnitType(Target, UNIT_TYPE_STRUCTURE)) and not(IsUnitType(Target,UNIT_TYPE_DEAD)) and not(IsUnitType(Target, UNIT_TYPE_MAGIC_IMMUNE))
//Defines the targetable units which will get demage from unit sliding effect
endfunction
// This spell is playing target units death animation while sliding
// This gives a pain effect but if you use units which has no fleshy
// body animation modify this function
constant function BloodyPile_DeathAnimation takes nothing returns boolean
return true //Make this "false" to disable targets death animation.
endfunction
//===================================================================================================
function BloodyPile_Conditions takes nothing returns boolean
return GetSpellAbilityId() == BloodyPile_SpellId()
endfunction
//Kills Picked Destructables near target when sliding
function BloodyPile_KillTreesOnTheWay takes nothing returns nothing
call KillDestructable( GetEnumDestructable() )
endfunction
//Makes target unit slide and demage nearby units and throw them avay from it
function BloodyPile_SlideUnit takes nothing returns nothing
local timer Loop = GetExpiredTimer()
local unit Target = H2U(GetHandleHandle(Loop, "Target"))
local unit Caster = H2U(GetHandleHandle(Loop, "Caster"))
local unit PickedUnit
local group UnitsInRange
local real Angle = GetHandleReal(Loop, "Angle")
local real AngleSmall
local location TargetPoint = GetUnitLoc(Target)
local location TargetPointSmall
local location MovePoint = PolarProjectionBJ(TargetPoint,20.00,Angle)
local location MovePointSmall
local effect MiniEffect
call SetUnitPositionLoc(Target, MovePoint)
set MiniEffect = AddSpecialEffectTarget("Abilities\\Weapons\\FrostWyrmMissile\\FrostWyrmMissile.mdl",Target,"origin")
call DestroyEffect(MiniEffect)
call EnumDestructablesInCircleBJ( 200.00, TargetPoint, function BloodyPile_KillTreesOnTheWay )
set UnitsInRange = GetUnitsInRangeOfLocAll(250, TargetPoint)
call GroupRemoveUnit(UnitsInRange,Target)
set PickedUnit = FirstOfGroup(UnitsInRange)
loop
exitwhen PickedUnit==null
set PickedUnit = FirstOfGroup(UnitsInRange)
call GroupRemoveUnit(UnitsInRange,PickedUnit)
if (BloodyPile_TargetConditions(Caster, PickedUnit)) then
set TargetPointSmall = GetUnitLoc(PickedUnit)
set AngleSmall = AngleBetweenPoints(TargetPoint,TargetPointSmall)
set MovePointSmall = PolarProjectionBJ(TargetPointSmall,80,AngleSmall)
call SetUnitPositionLoc(PickedUnit, MovePointSmall)
call UnitDamageTarget(Caster,PickedUnit,25*GetUnitAbilityLevel(Caster, BloodyPile_SpellId()),false,false,null,null,null)
call RemoveLocation(TargetPointSmall)
call RemoveLocation(MovePointSmall)
endif
endloop
call RemoveLocation(MovePoint)
call RemoveLocation(TargetPoint)
call DestroyGroup(UnitsInRange)
set Caster = null
set Target = null
endfunction
function BloodyPile_Actions takes nothing returns nothing
local timer Loop = CreateTimer()
local effect StunEffect
local unit Target = GetSpellTargetUnit()
local unit Caster = GetSpellAbilityUnit()
local location TargetPoint = GetUnitLoc(Target)
local location CasterPoint = GetUnitLoc(Caster)
local real Angle = AngleBetweenPoints(CasterPoint, TargetPoint)
local real Demage = BloodyPile_SpellDemage(GetUnitAbilityLevel(Caster, BloodyPile_SpellId()))
local real Duration = BloodyPile_SlideDuration()
call SetHandleHandle(Loop, "Target", Target)
call SetHandleHandle(Loop, "Caster", Caster)
call SetHandleReal(Loop, "Angle", Angle)
call SetUnitFacingToFaceUnitTimed( Target, Caster, 0 )
call PauseUnit(Target,true)
if (BloodyPile_DeathAnimation()) then
call SetUnitAnimation( Target, "death" )
endif
call UnitDamageTarget(Caster,Target,Demage,false,false,null,null,null)
call TimerStart(Loop, 0.03, true, function BloodyPile_SlideUnit)
call TriggerSleepAction( Duration )
call PauseTimer(Loop)
call FlushHandleLocals(Loop)
call DestroyTimer(Loop)
if not (IsUnitType(Target,UNIT_TYPE_DEAD)) then
set StunEffect = AddSpecialEffectTarget( "Abilities\\Spells\\Human\\Thunderclap\\ThunderclapTarget.mdl", Target, "overhead")
call TriggerSleepAction( 1.25 * GetUnitAbilityLevel(Caster, BloodyPile_SpellId()))
call DestroyEffectBJ( StunEffect )
endif
call PauseUnit(Target,false)
call RemoveLocation(TargetPoint)
call RemoveLocation(CasterPoint)
set Caster = null
set Target = null
endfunction
// ===========================================================================
function InitTrig_BloodyPile takes nothing returns nothing
local trigger gg_trg_BloodyPile = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_BloodyPile, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_BloodyPile, Condition( function BloodyPile_Conditions ) )
call TriggerAddAction( gg_trg_BloodyPile, function BloodyPile_Actions )
endfunction
as you can see it is a knockback spell ... and i think it is easy to understand.
Any suggestions about why this is wrong ?? please ?