- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, well, recently i decided to convert all my GUI spells into JASS, for greater efficiency. However it being more complicated than i expected ... to start i have this spell:
This is the GUi version .... which i don't even know if it is MUI... and leaks like hell(that i am sure).
Now here is my version of the same spell:
A lot smaller but there is something wrong ... So, could you guys help me ???
For now i just want to improve the GUI spell, and see if my JASS version works .. =S
Another spell i found is this knock back spell:
It is really cool, it knockback units destroys trees, creates a nice smooth effect and plays the unit death animation.
Still my JASS editor finds some errors ... However the spell seems to work fine... Which leads me to the question, is this spell MUI and leak free ??? Why are the errors here ??
Errors:
41-46 Undeclared function GetHandleHandle; Undeclared function H2U
46 Cannot convert null to real
96-97 Undeclared function SetHandleHandle
98 Undeclared function SetHandleReal
100 Undeclared function FlushHandleLocals
10 errors total
I know about handles, but i don't know why the jasscraft sees them as an error ... is there anything wrong with the spell ???? Or is my program going nuts ?
plx help =S
-
Frost Nova
-
Events
- Unit - A unit Starts the effect of an ability
-
Conditions
- (Ability being cast) Equal to Frost Nova
-
Actions
- Set FrostNovaLevel = (Level of Frost Nova for (Triggering unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- FrostNovaLevel Equal to 1
-
Then - Actions
-
For each (Integer A) from 1 to 16, do (Actions)
-
Loop - Actions
- Unit - Create 1 Frost Nova Caster for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing degrees
- Unit - Set level of Frost nova wave (Neutral Hostile) for (Last created unit) to FrostNovaLevel
- Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
- Unit - Order (Last created unit) to Undead Crypt Lord - Impale ((Position of (Triggering unit)) offset by 100.00 towards PointofTargetNova degrees)
- Set PointofTargetNova = (PointofTargetNova + 25.00)
-
Loop - Actions
-
For each (Integer A) from 1 to 16, do (Actions)
-
Else - Actions
- Do nothing
-
If - Conditions
-
Events
JASS:
function Trig_Ice_Force_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A022' ) ) then
return false
endif
return true
endfunction
function Trig_Ice_Force_Func002C takes nothing returns boolean
if ( not ( udg_FrostNovaLevel == 1 ) ) then
return false
endif
return true
endfunction
function Trig_Ice_Force_Actions takes nothing returns nothing
set udg_FrostNovaLevel = GetUnitAbilityLevelSwapped('A022', GetTriggerUnit())
if ( Trig_Ice_Force_Func002C() ) then
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 16
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call CreateNUnitsAtLoc( 1, 'h01B', GetOwningPlayer(GetTriggerUnit()), GetUnitLoc(GetTriggerUnit()), bj_UNIT_FACING )
call SetUnitAbilityLevelSwapped( 'A021', GetLastCreatedUnit(), udg_FrostNovaLevel )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )
call IssuePointOrderLocBJ( GetLastCreatedUnit(), "impale", PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()), 100.00, udg_Point_Nova_Spell) )
set udg_Point_Nova_Spell = ( udg_Point_Nova_Spell + 25.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
else
call DoNothing( )
endif
endfunction
//===========================================================================
function InitTrig_Ice_Force takes nothing returns nothing
set gg_trg_Ice_Force = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Ice_Force, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Ice_Force, Condition( function Trig_Ice_Force_Conditions ) )
call TriggerAddAction( gg_trg_Ice_Force, function Trig_Ice_Force_Actions )
endfunction
This is the GUi version .... which i don't even know if it is MUI... and leaks like hell(that i am sure).
Now here is my version of the same spell:
JASS:
function IceForce_Conds takes nothing returns boolean
return GetSpellAbilityId() == 'A022'
endfunction
//==========================================================================
function IceForce_Acts takes nothing returns nothing
local unit caster = GetTriggerUnit()
local unit dum
local location loc = GetUnitLoc(caster)
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 16
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
set dum = CreateUnit(GetOwningPlayer(caster), 'h01B', GetUnitX(caster), GetUnitY(caster), 0)
call SetUnitAbilityLevel(dum, 'A021', 1)
call UnitApplyTimedLife(dum, 'BTLF', 2.00)
call IssuePointOrderLoc(dum, "impale", PolarProjectionBJ(loc), 100.00, udg_Point_Nova_Spell) )
set udg_Point_Nova_Spell = ( udg_Point_Nova_Spell + 25.00 )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
endfunction
//===========================================================================
function InitTrig_Ice_Force takes nothing returns nothing
local trigger IceForce = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( IceForce, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( IceForce, Condition( function IceForce_Conds ) )
call TriggerAddAction( IceForce, function IceForce_Acts )
set IceForce = null
endfunction
A lot smaller but there is something wrong ... So, could you guys help me ???
For now i just want to improve the GUI spell, and see if my JASS version works .. =S
Another spell i found is this knock back spell:
JASS:
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
It is really cool, it knockback units destroys trees, creates a nice smooth effect and plays the unit death animation.
Still my JASS editor finds some errors ... However the spell seems to work fine... Which leads me to the question, is this spell MUI and leak free ??? Why are the errors here ??
Errors:
41-46 Undeclared function GetHandleHandle; Undeclared function H2U
46 Cannot convert null to real
96-97 Undeclared function SetHandleHandle
98 Undeclared function SetHandleReal
100 Undeclared function FlushHandleLocals
10 errors total
I know about handles, but i don't know why the jasscraft sees them as an error ... is there anything wrong with the spell ???? Or is my program going nuts ?
plx help =S
Last edited: