- Joined
- Mar 30, 2008
- Messages
- 666
I have a problem with this JASS,when I save tha map,ERROR!What can I do to repair all those thousands of errors?
JASS:
function Trig_Grenade_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A003'
endfunction
function movegrenade takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit g = GetHandleUnit(t, "g")
local unit cast = GetHandleUnit(t, "cast")
local location caster = GetUnitLoc(cast)
local location gl = GetUnitLoc(g)
local real x = GetHandleReal(t, "x")
local real y = GetHandleReal(t, "y")
local location targp = Location(x, y)
local real dist = DistanceBetweenPoints(gl, targp)
local real maxdist = DistanceBetweenPoints(caster, targp)
local real height = JumpParabola(dist, maxdist, 1.70)
call SetUnitPositionLoc(g, PolarProjectionBJ(gl, maxdist/50.00, AngleBetweenPoints(gl, targp)))
call SetUnitFlyHeight(g, height, 0)
call RemoveLocation(caster)
call RemoveLocation(gl)
call RemoveLocation(targp)
set caster = null
set gl = null
set targp = null
endfunction
function Trig_Grenade_Actions takes nothing returns nothing
local timer t = CreateTimer()
local unit cast = GetTriggerUnit()
local location caster = GetUnitLoc(cast)
local location targp = GetSpellTargetLoc()
local location temp
local location temppoint
local unit g
local real r = DistanceBetweenPoints(caster, targp)/(DistanceBetweenPoints(caster, targp)/50.00)*.016579
local real x = GetLocationX(targp)
local real y = GetLocationY(targp)
set temp = PolarProjectionBJ(caster, 25.00, AngleBetweenPoints(caster, targp))
call CreateNUnitsAtLoc(1, 'H004',GetOwningPlayer(cast), temp, AngleBetweenPoints(caster, targp))
set g = GetLastCreatedUnit()
call SetHandleHandle(t, "cast", cast)
call SetHandleReal(t, "x", x)
call SetHandleReal(t, "y", y)
call SetHandleHandle(t, "g", g)
call TimerStart(t, 0.02, true, function movegrenade)
call TriggerSleepAction(r)
call DestroyTimer(t)
call KillUnit(g)
set temppoint = GetUnitLoc(g)
call UnitDamagePointLoc(g, 0.00, 256.00, temppoint, 500.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", temppoint))
call RemoveUnit(g)
call RemoveLocation(caster)
call RemoveLocation(targp)
call FlushHandleLocals(t)
call RemoveLocation(temp)
call RemoveLocation(temppoint)
set temppoint = null
set temp = null
set t = null
set caster = null
set targp = null
set g = null
set cast = null
endfunction
//===========================================================================
function InitTrig_Real_Grenade takes nothing returns nothing
set gg_trg_Real_Grenade = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Real_Grenade, EVENT_PLAYER_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Real_Grenade, Condition(function Trig_Grenade_Conditions))
call TriggerAddAction(gg_trg_Real_Grenade, function Trig_Grenade_Actions)
endfunction
JASS:
function Trig_GrenadeB_Func001A takes nothing returns nothing
local unit u = GetEnumUnit()
local location l = GetUnitLoc(u)
local real maxdist = I2R(GetUnitUserData(u))
local location temppoint = GetUnitLoc(u)
local location temppoint2 = Location(I2R(GetItemUserData(UnitItemInSlot(u, 0))), I2R(GetItemUserData(UnitItemInSlot(u, 1))))
local real dist = DistanceBetweenPoints(temppoint, temppoint2)
local real height = JumpParabola(dist, maxdist, 1.40)
local location temppoint3 = PolarProjectionBJ(l, 10.00, GetUnitFacing(u))
if GetUnitFlyHeight(u) >= 6.00 then
call SetUnitPositionLoc(u, temppoint3)
call SetUnitFlyHeight(u, height, 0)
else
call KillUnit(u)
call UnitDamagePointLoc(u, 0.00, 256.00, temppoint, 500.00, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_FIRE)
call DestroyEffect(AddSpecialEffectLoc("Objects\\Spawnmodels\\Other\\NeutralBuildingExplosion\\NeutralBuildingExplosion.mdl", temppoint))
call GroupRemoveUnitSimple(u, udg_Grenades)
call RemoveUnit(u)
endif
call RemoveLocation(temppoint)
call RemoveLocation(temppoint2)
call RemoveLocation(temppoint3)
call RemoveLocation(l)
set l = null
set u = null
set temppoint = null
set temppoint2 = null
set temppoint3 = null
endfunction
function Trig_GrenadeB_Actions takes nothing returns nothing
call ForGroup(udg_Grenades, function Trig_GrenadeB_Func001A)
endfunction
//===========================================================================
function InitTrig_GrenadeB takes nothing returns nothing
set gg_trg_GrenadeB = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_GrenadeB, 0.02 )
call TriggerAddAction( gg_trg_GrenadeB, function Trig_GrenadeB_Actions )
endfunction