B
botanic
Guest
Sorry i added this in the wrong area clicked wrong button ;/
Im trying to modify the Dash_Strike_Image_Damage and the Dash_Strike_Target_Damage from Level * a number to using the AGI of the hero... I tried doing
however it gives me an error ;/
I know the I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Shapeshifter_Hero, true)) is fine because i used it in a spell earlier however it seems that im missing something ~.~ Works great without trying to base the damage off the AGI...
IF you want the spell script it is:
Im trying to modify the Dash_Strike_Image_Damage and the Dash_Strike_Target_Damage from Level * a number to using the AGI of the hero... I tried doing
JASS:
constant function Dash_Strike_Target_Damage takes real Level returns real
return Level * I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Shapeshifter_Hero, true)) //Damage done to the target
endfunction
however it gives me an error ;/
I know the I2R(GetHeroStatBJ(bj_HEROSTAT_AGI, udg_Shapeshifter_Hero, true)) is fine because i used it in a spell earlier however it seems that im missing something ~.~ Works great without trying to base the damage off the AGI...
IF you want the spell script it is:
JASS:
constant function Dash_Strike_SpellId takes nothing returns integer
return 039;A01H039; //Rawcode of the ability being cast
endfunction
function Dash_Strike_DummyID takes nothing returns integer
return 039;n00H039; //Rawcode for the Dash Dummy unit
endfunction
function Dash_Strike_Distance takes nothing returns real
return 1.3 //Distance out related to the total distance between the target and caster
endfunction
constant function Dash_Strike_Target_Damage takes real Level returns real
return Level * 50 //Damage done to the target
endfunction
constant function Dash_Strike_Image_Damage takes real Level returns real
return Level * 50 //Damage done by the image movement
endfunction
constant function Dash_Strike_Image_Damage_Area takes real Level returns real
return 50 + Level * 0 //Area of damage done by the image movement
endfunction
function Dash_Strike_Attack_Effect takes nothing returns string
return "Abilities\\Weapons\\PhoenixMissile\\Phoenix_Missile_mini.mdl" //Effect on the caster when they attack the target
endfunction
function Dash_Strike_Attack_Effect_Location takes nothing returns string
return "weapon" //Location of effect on the caster when they attack the target
endfunction
function Dash_Strike_Slide_Effect takes nothing returns string
return "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" //Effect at the feat of the dummys as the dash
endfunction
//***************************************************\\
function Dash_Strike_Bezier_Curve takes real a, real b, real A, real B, real C returns real
return A*a*a+2*B*a*b+C*b*b
endfunction
function Dash_Strike_MoveUnitToPolarProjection takes unit tomove, real dist, real angle returns nothing
call SetUnitPosition(tomove, GetUnitX(tomove) + dist * Cos(angle * bj_DEGTORAD) , GetUnitY(tomove) + dist * Sin(angle * bj_DEGTORAD))
endfunction
function Dash_Strike_Fade_In takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
local integer i = GetHandleInt(t,"i")
if i < 255 then
call SetUnitVertexColor(u,255,255,255,i)
set i=i+6
call SetHandleInt(t,"i",i)
else
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
set t = null
set u = null
endfunction
function Dash_Strike_Fade_Out takes nothing returns nothing
local timer t4 = GetExpiredTimer()
local timer t = CreateTimer()
local unit u = GetHandleUnit(t4,"u")
local integer i = GetHandleInt(t4,"i")
if i>0 then
call SetUnitVertexColor(u,255,255,255,i)
set i=i-6
call SetHandleInt(t4,"i",i)
else
call PauseTimer(t4)
call FlushHandleLocals(t4)
call DestroyTimer(t4)
call SetHandleHandle(t,"u",u)
call SetHandleInt(t,"i",i)
call TimerStart(t, 0.01, true, function Dash_Strike_Fade_In)
endif
set u = null
set t = null
set t4 = null
endfunction
function Dash_Strike_Group takes nothing returns boolean
return IsUnitEnemy(GetFilterUnit(),bj_groupEnumOwningPlayer) and IsUnitType(GetFilterUnit(),UNIT_TYPE_GROUND)==true
endfunction
function Dash_Strike_Damage takes unit u, real r, real x, real y, real r2, boolean attack, boolean ranged, attacktype at, damagetype dt, weapontype wt returns nothing
local group g = CreateGroup()
local boolexpr b = Condition(function Dash_Strike_Group)
local unit v
set bj_groupEnumOwningPlayer = GetOwningPlayer(u)
call GroupEnumUnitsInRange(g, x, y, r, b)
call DestroyBoolExpr(b)
loop
set v = FirstOfGroup(g)
exitwhen v == null
call GroupRemoveUnit(g,v)
call UnitDamageTarget(u,v,r2,attack,ranged,at,dt,wt)
endloop
call DestroyGroup(g)
set g = null
set b = null
endfunction
function Dash_Strike_Move3 takes nothing returns nothing
local timer t3 = GetExpiredTimer()
local unit u = GetHandleUnit(t3,"u")
local unit dum3 = GetHandleUnit(t3,"dum3")
local real lvl = GetHandleReal(t3,"lvl")
local real angle = GetHandleReal(t3,"angle")
local real dist = GetHandleReal(t3,"dist")
local real x2 = GetHandleReal(t3,"x2")
local real y2 = GetHandleReal(t3,"y2")
call Dash_Strike_MoveUnitToPolarProjection(dum3,dist,angle)
call SetUnitAnimation(dum3, "walk")
call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),GetUnitX(dum3),GetUnitY(dum3)))
call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), GetUnitX(dum3), GetUnitY(dum3), Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
if IsUnitInRangeXY(dum3,x2,y2, 50) then
call KillUnit(dum3)
call RemoveUnit(dum3)
call PauseTimer(t3)
call FlushHandleLocals(t3)
call DestroyTimer(t3)
endif
set t3 = null
set u = null
set dum3 = null
endfunction
function Dash_Strike_Move2 takes nothing returns nothing
local timer t2 = GetExpiredTimer()
local unit u = GetHandleUnit(t2,"u")
local unit dum2 = GetHandleUnit(t2,"dum2")
local real lvl = GetHandleReal(t2,"lvl")
local real x1 = GetHandleReal(t2,"x1")
local real y1 = GetHandleReal(t2,"y1")
local real x2 = GetHandleReal(t2,"x2")
local real y2 = GetHandleReal(t2,"y2")
local real x4 = GetHandleReal(t2,"x4")
local real y4 = GetHandleReal(t2,"y4")
local real a = GetHandleReal(t2,"a")
local real b = 1-a
local real dum2x = Dash_Strike_Bezier_Curve(a,b,x1,x4,x2)
local real dum2y = Dash_Strike_Bezier_Curve(a,b,y1,y4,y2)
call SetUnitPosition(dum2,dum2x,dum2y)
call SetUnitAnimation(dum2, "walk")
call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),dum2x,dum2y))
call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), dum2x, dum2y, Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
if IsUnitInRangeXY(dum2,x2,y2, 50) then
call KillUnit(dum2)
call RemoveUnit(dum2)
call PauseTimer(t2)
call FlushHandleLocals(t2)
call DestroyTimer(t2)
endif
call SetHandleReal(t2,"a",a - .04)
set u = null
set dum2 = null
set t2 = null
endfunction
function Dash_Strike_Move1 takes nothing returns nothing
local timer t = GetExpiredTimer()
local unit u = GetHandleUnit(t,"u")
local unit dum1 = GetHandleUnit(t,"dum1")
local real lvl = GetHandleReal(t,"lvl")
local real x1 = GetHandleReal(t,"x1")
local real y1 = GetHandleReal(t,"y1")
local real x2 = GetHandleReal(t,"x2")
local real y2 = GetHandleReal(t,"y2")
local real x3 = GetHandleReal(t,"x3")
local real y3 = GetHandleReal(t,"y3")
local real a = GetHandleReal(t,"a")
local real b = 1-a
local real dum1x = Dash_Strike_Bezier_Curve(a,b,x1,x3,x2)
local real dum1y = Dash_Strike_Bezier_Curve(a,b,y1,y3,y2)
call SetUnitPosition(dum1,dum1x,dum1y)
call SetUnitAnimation(dum1, "walk")
call DestroyEffect( AddSpecialEffect(Dash_Strike_Slide_Effect(),dum1x,dum1y))
call Dash_Strike_Damage(u,Dash_Strike_Image_Damage_Area(lvl), dum1x, dum1y, Dash_Strike_Image_Damage(lvl), false, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null)
if IsUnitInRangeXY(dum1,x2,y2, 50) then
call KillUnit(dum1)
call RemoveUnit(dum1)
call PauseTimer(t)
call FlushHandleLocals(t)
call DestroyTimer(t)
endif
call SetHandleReal(t,"a",a - .04)
set u = null
set dum1 = null
set t = null
endfunction
function Trig_Dash_Strike_Actions takes nothing returns nothing
local unit u = GetTriggerUnit()
local unit u2 = GetSpellTargetUnit()
local timer t = CreateTimer()
local timer t2 = CreateTimer()
local timer t3 = CreateTimer()
local timer t4 = CreateTimer()
local real lvl = GetUnitAbilityLevel(u, Dash_Strike_SpellId())
local real x1 = GetUnitX(u)
local real y1 = GetUnitY(u)
local real x2 = GetUnitX(u2)
local real y2 = GetUnitY(u2)
local real a = bj_RADTODEG * Atan2(y2 - y1, x2 - x1)
local unit dum1 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)
local unit dum2 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)
local unit dum3 = CreateUnit(GetOwningPlayer(u), Dash_Strike_DummyID(), x1, y1, a)
local real length = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/Dash_Strike_Distance()
local real dist = SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/2
local real dist2 = SquareRoot((dist*dist)+(length*length))
local real x3 = x1 + dist2 * Cos((a+45) * bj_DEGTORAD)
local real y3 = y1 + dist2 * Sin((a+45) * bj_DEGTORAD)
local real x4 = x1 + dist2 * Cos((a+315) * bj_DEGTORAD)
local real y4 = y1 + dist2 * Sin((a+315) * bj_DEGTORAD)
call SetHandleReal(t,"lvl",lvl)
call SetHandleReal(t2,"lvl",lvl)
call SetHandleReal(t3,"lvl",lvl)
call SetHandleReal(t,"x1",x1)
call SetHandleReal(t,"y1",y1)
call SetHandleReal(t,"x2",x2)
call SetHandleReal(t,"y2",y2)
call SetHandleReal(t2,"x1",x1)
call SetHandleReal(t2,"y1",y1)
call SetHandleReal(t2,"x2",x2)
call SetHandleReal(t2,"y2",y2)
call SetHandleReal(t3,"x2",x2)
call SetHandleReal(t3,"y2",y2)
call SetHandleReal(t,"x3",x3)
call SetHandleReal(t,"y3",y3)
call SetHandleReal(t2,"x4",x4)
call SetHandleReal(t2,"y4",y4)
call SetHandleReal(t,"a",1)
call SetHandleReal(t2,"a",1)
call SetHandleReal(t3,"angle",bj_RADTODEG * Atan2(y2 - y1, x2 - x1))
call SetHandleReal(t3,"dist",SquareRoot((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))/25)
call SetHandleInt(t4,"i",255)
call SetHandleHandle(t,"dum1",dum1)
call SetHandleHandle(t2,"dum2",dum2)
call SetHandleHandle(t3,"dum3",dum3)
call SetHandleHandle(t,"u",u)
call SetHandleHandle(t2,"u",u)
call SetHandleHandle(t3,"u",u)
call SetHandleHandle(t4,"u",u)
call SetUnitTimeScalePercent(dum1, 10000)
call SetUnitAnimation(dum1, "walk")
call SetUnitTimeScalePercent(dum2, 10000)
call SetUnitAnimation(dum2, "walk")
call SetUnitTimeScalePercent(dum3, 10000)
call SetUnitAnimation(dum3, "walk")
call ClearSelectionForPlayer(GetOwningPlayer(u))
call TimerStart(t, .025, true, function Dash_Strike_Move1)
call TimerStart(t2, .025, true, function Dash_Strike_Move2)
call TimerStart(t3, .025, true, function Dash_Strike_Move3)
call TimerStart(t4, .01, true, function Dash_Strike_Fade_Out)
call TriggerSleepAction(.4)
call SetUnitPosition(u,GetUnitX(u2),GetUnitY(u2))
call SelectUnitAddForPlayer(u,GetOwningPlayer(u))
if IsUnitAlly(u2,GetOwningPlayer(u))==false then
call IssueTargetOrder(u,"attack",u2)
call UnitDamageTarget(u,u2,Dash_Strike_Target_Damage(lvl),false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_NORMAL,null)
call DestroyEffect(AddSpecialEffectTarget( Dash_Strike_Attack_Effect(), u , Dash_Strike_Attack_Effect_Location()))
endif
call TriggerSleepAction(2)
set t = null
set t2 = null
set t3 = null
set t4 = null
set u = null
set u2 = null
set dum1 = null
set dum2 = null
set dum3 = null
endfunction
//===========================================================================
function Trig_Dash_Strike_Conditions takes nothing returns boolean
return GetSpellAbilityId() == Dash_Strike_SpellId()
endfunction
function InitTrig_Dash_Strike takes nothing returns nothing
set gg_trg_Dash_Strike = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Dash_Strike, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( gg_trg_Dash_Strike, Condition( function Trig_Dash_Strike_Conditions ) )
call TriggerAddAction( gg_trg_Dash_Strike, function Trig_Dash_Strike_Actions )
endfunction