- Joined
- Oct 18, 2007
- Messages
- 930
[SOLVED]WTF? It worked now suddenly it dosent, strange...
ok my problem is that after the units have moved it shoots shockwave alright? and that is a good thing, BUT in the wrong DIRECTION!!!
Code
And end result is like: Dam how do i fix this??
ok my problem is that after the units have moved it shoots shockwave alright? and that is a good thing, BUT in the wrong DIRECTION!!!
Code
JASS:
function Double_Edge_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A00P'
endfunction
function Double_Edge_Actions takes nothing returns nothing
//#######################################################################
local unit cast = GetTriggerUnit()
local unit targ = GetSpellTargetUnit()
local unit dummy = null
local player owner = GetOwningPlayer(cast)
local real x = GetUnitX(cast)
local real y = GetUnitY(cast)
local real x2 = GetUnitX(targ)
local real y2 = GetUnitY(targ)
local real x3
local real y3
local real Angle1 = bj_RADTODEG * Atan2(y2 - y, x2 - x)
local real Angle2 = bj_RADTODEG * Atan2(y - y2, x - x2)
local real dx = x2 - x
local real dy = y2 - y
local real Distance1 = SquareRoot(dx * dx + dy * dy) - 100
local real dx2 = x - x2
local real dy2 = y - y2
local real Distance2 = SquareRoot(dx2 * dx2 + dy2 * dy2) - 100
local real x4 = x + Distance1 / 2.00 * Cos(Angle1 * bj_DEGTORAD)
local real y4 = y + Distance1 / 2.00 * Sin(Angle1 * bj_DEGTORAD)
local real x5 = x2 + Distance2 / 2.00 * Cos(Angle2 * bj_DEGTORAD)
local real y5 = y2 + Distance2 / 2.00 * Sin(Angle2 * bj_DEGTORAD)
local effect se = null
//#######################################################################
call SetUnitPosition(cast,x4,y4)
call SetUnitFacing(cast,Angle1)
call SetUnitPosition(targ,x5,y5)
call SetUnitFacing(targ,Angle2)
set se = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Thunderclap\\ThunderClapCaster.mdl", cast, "origin")
call DestroyEffect(se)
set se = null
set se = AddSpecialEffectTarget("Abilities\\Spells\\Orc\\WarStomp\\WarStompCaster.mdl", targ, "origin")
call DestroyEffect(se)
set se = null
set x3 = x4 + 300 * Cos(Angle1 + 15 * bj_DEGTORAD)
set y3 = y4 + 300 * Sin(Angle1 + 15 * bj_DEGTORAD)
set dummy = CreateUnit(owner,'h000',x4,y4,90.00)
call UnitApplyTimedLife(dummy,'BTLF', 1.5 )
call UnitAddAbility(dummy,'A00Q')
call SetUnitAbilityLevelSwapped( 'A00Q', dummy, GetUnitAbilityLevelSwapped('A00P', cast) )
call IssuePointOrder(dummy,"shockwave",x3,y3)
set dummy = null
set x3 = x4 + 300 * Cos(Angle1 - 15 * bj_DEGTORAD)
set y3 = y4 + 300 * Sin(Angle1 - 15 * bj_DEGTORAD)
set dummy = CreateUnit(owner,'h000',x4,y4,90.00)
call UnitApplyTimedLife(dummy,'BTLF', 1.5 )
call UnitAddAbility(dummy,'A00Q')
call SetUnitAbilityLevelSwapped( 'A00Q', dummy, GetUnitAbilityLevelSwapped('A00P', cast) )
call IssuePointOrder(dummy,"shockwave",x3,y3)
set dummy = null
set cast = null
set targ = null
set owner = null
endfunction
//===========================================================================
function InitTrig_Double_Edge takes nothing returns nothing
local trigger T = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( T, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( T, Condition( function Double_Edge_Conditions ) )
call TriggerAddAction( T, function Double_Edge_Actions )
set T = null
endfunction
And end result is like: Dam how do i fix this??