Lo, I has problem.
This trigger seems to be causing 390 compile errors (most of them irrational as is the blizzard parser's wont
). The trigger was converted from GUI then heavily modified and triggers when a spell is cast, then checks if that spell is the correct one as usual.
Most of the trigger was written using a (presumably) rather old version of PJASS (in the JassCraft program), and the trigger uses Daelin's Geometrical checks to see if a unit is within a rectangle or not. There may be issues with how I generate the points/coordinates; I haven't even been able to test this due to the trigger not working.
Uncertain areas include how I use the filter function for my pick, and certain local var declarations.
JassCraft gives errors on:
Line 90: local integer sfxcount = 0 <cannot convert real to integer>
Line 93: call GroupEnumUnitsOfType(dashgroup,'E000', Filter(function dash_filter)) <cannot convert integer to string>
(I've checked different values for this, I may have the wrong one)
Line 127: call TriggerRegisterAnyUnitEventBJ( gg_trg_DragonDash_RectFunc, EVENT_PLAYER_UNIT_SPELL_EFFECT ) <Undeclared variable: gg_trg_DragonDash_RectFunc>
The full trigger plus map header dependencies is:
Help plix? *casts Eyes of the Puppy*
This trigger seems to be causing 390 compile errors (most of them irrational as is the blizzard parser's wont
Most of the trigger was written using a (presumably) rather old version of PJASS (in the JassCraft program), and the trigger uses Daelin's Geometrical checks to see if a unit is within a rectangle or not. There may be issues with how I generate the points/coordinates; I haven't even been able to test this due to the trigger not working.
Uncertain areas include how I use the filter function for my pick, and certain local var declarations.
JassCraft gives errors on:
Line 90: local integer sfxcount = 0 <cannot convert real to integer>
Line 93: call GroupEnumUnitsOfType(dashgroup,'E000', Filter(function dash_filter)) <cannot convert integer to string>
(I've checked different values for this, I may have the wrong one)
Line 127: call TriggerRegisterAnyUnitEventBJ( gg_trg_DragonDash_RectFunc, EVENT_PLAYER_UNIT_SPELL_EFFECT ) <Undeclared variable: gg_trg_DragonDash_RectFunc>
The full trigger plus map header dependencies is:
JASS:
function GetAngleBetweenPoints takes real x1, real y1, real x2, real y2 returns real
return bj_RADTODEG * Atan2(y2 - y1, x2 - x1)
endfunction
function PolarProjectionX takes real x, real distance, real angle returns real
return x+distance*Cos(angle * bj_DEGTORAD)
endfunction
function PolarProjectionY takes real y, real distance, real angle returns real
return y+distance*Sin(angle * bj_DEGTORAD)
endfunction
function IsPointInTriangle takes real x1, real y1, real x2, real y2, real x3, real y3, real x, real y returns boolean
local real calc1 = (y-y1)*(x2-x1) - (x-x1)*(y2-y1)
local real calc2 = (y-y3)*(x1-x3) - (x-x3)*(y1-y3)
local real calc3 = (y-y2)*(x3-x2) - (x-x2)*(y3-y2)
return (calc1*calc2>0) and (calc3*calc2>0)
endfunction
function IsPointInRectangle takes real x1, real y1, real x2, real y2, real x3, real y3, real x4, real y4, real x, real y returns boolean
return IsPointInTriangle(x1,y1,x2,y2,x3,y3,x,y) or IsPointInTriangle(x4,y4,x2,y2,x3,y3,x,y) or IsPointInTriangle(x1,y1,x4,y4,x3,y3,x,y) or IsPointInTriangle(x1,y1,x2,y2,x4,y4,x,y)
endfunction
function IsPointInCircle takes real xC, real yC, real radius, real x, real y returns boolean
local real xx = xC-x
local real yy = yC-y
return xx*xx + yy*yy<=radius*radius
endfunction
function IsPointInCircleSector takes real xC, real yC, real radius, real x, real y, real angleA, real angleB returns boolean
local real angle = GetAngleBetweenPoints(xC,yC,x,y)
local real aux
if angleA>angleB then
set aux=angleA
set angleA=angleB
set angleB=aux
endif
return IsPointInCircle(xC,yC,radius,x,y) and angle>=angleA and angle<=angleB
endfunction
function Trig_DragonDash_Copy_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A004' ) ) then
return false
endif
return true
endfunction
function Trig_DragonDash_Copy_Func002C takes nothing returns boolean
if ( not ( DistanceBetweenPoints(GetUnitLoc(GetTriggerUnit()), GetSpellTargetLoc()) >= 100.00 ) ) then
return false
endif
return true
endfunction
function dash_filter takes nothing returns boolean
if (IsUnitDeadBJ(GetFilterUnit()) == true)then
return false
endif
return true
endfunction
function Trig_DragonDash_Copy_Actions takes nothing returns nothing
local group dashgroup = CreateGroup()
local unit dashtrig = GetTriggerUnit()
local unit dashed = null
local location dashcastloc = GetUnitLoc(dashtrig)
local location dashcasttarget = GetSpellTargetLoc()
local real Dashdirection = AngleBetweenPoints(dashcastloc, dashcasttarget)
local real dashdistance = DistanceBetweenPoints(dashcastloc, dashcasttarget)
local real x = GetLocationX(dashcastloc)
local real x1 = GetLocationX(dashcastloc) + 75 * Cos((Dashdirection-90)* bj_DEGTORAD)
local real x2 = GetLocationX(dashcastloc) + 75 * Cos((Dashdirection+90)* bj_DEGTORAD)
local real x3 = x1 + dashdistance * Cos(Dashdirection * bj_DEGTORAD)
local real x4 = x2 + dashdistance * Cos(Dashdirection * bj_DEGTORAD)
local real y = GetLocationY(dashcastloc)
local real y1 = GetLocationY(dashcastloc) + 75 * Sin((Dashdirection-90)* bj_DEGTORAD)
local real y2 = GetLocationY(dashcastloc) + 75 * Sin((Dashdirection+90)* bj_DEGTORAD)
local real y3 = y1+ dashdistance * Sin(Dashdirection * bj_DEGTORAD)
local real y4 = y2 + dashdistance * Sin(Dashdirection * bj_DEGTORAD)
local real dashedX = 0
local real dashedY = 0
local integer sfxmax = dashdistance / 100
local integer sfxcount = 0
// This is a rather riotous mass of locals, but it is needed to use the IsUnitInRectangle function. I hope I did it right.
if (Trig_DragonDash_Copy_Func002C()) then
call GroupEnumUnitsOfType(dashgroup,'E000', Filter(function dash_filter))
loop
set dashed = FirstOfGroup(dashgroup)
exitwhen dashed == null
set dashedX = GetUnitX(dashed)
set dashedY = GetUnitY(dashed)
if ( IsPointInRectangle(x1, y1, x2, y2, x3, y3, x4, y4, dashedX, dashedY))then
call UnitDamageTarget(dashtrig, dashed, 1.00, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_UNKNOWN, WEAPON_TYPE_WHOKNOWS)
endif
call GroupRemoveUnit(dashgroup, dashed)
endloop
// sfx loop
loop
call AddSpecialEffect("Abilities\\Spells\\Human\\FlameStrike\\FlameStrike1.mdl",x + (100.00*I2R(sfxcount)) * Cos(Dashdirection*bj_DEGTORAD), y + (100.00*I2R(sfxcount)) * Sin(Dashdirection*bj_DEGTORAD))
call DestroyEffect(GetLastCreatedEffectBJ())
set sfxcount = sfxcount + 1
exitwhen sfxmax == sfxcount
endloop
else
//-------------Error Sound-----------------
if (GetLocalPlayer()==(GetOwningPlayer(GetTriggerUnit()))) then
// Will eventually .mp3 this sound (hopefully)
call PlaySoundBJ( gg_snd_Error )
endif
call DisplayTextToForce( GetForceOfPlayer(GetOwningPlayer(GetTriggerUnit())), "TRIGSTR_374" )
// This refreshes the skill's cooldown
call UnitRemoveAbilityBJ( 'A004', GetTriggerUnit() )
call UnitAddAbilityBJ( 'A004', GetTriggerUnit() )
endif
endfunction
//===========================================================================
function InitTrig_DragonDash_RectFunc takes nothing returns nothing
set gg_trg_DragonDash_RectFunc = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_DragonDash_RectFunc, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_DragonDash_RectFunc, Condition( function Trig_DragonDash_Copy_Conditions ) )
call TriggerAddAction( gg_trg_DragonDash_RectFunc, function Trig_DragonDash_Copy_Actions )
endfunction
Help plix? *casts Eyes of the Puppy*