• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] WTF? It worked now suddenly it dosent -.- strange...

Status
Not open for further replies.
Level 18
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
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??
 

Attachments

  • untitled.JPG
    untitled.JPG
    20.2 KB · Views: 80
Level 18
Joined
Oct 18, 2007
Messages
930
i think you don't need the bj_RADTODEG... Atan2(y2-y,x2-x) is enough

Wrong -.- but i found my fault

JASS:
    set x3 = x4 + 300 * Cos(Angle1 - 15 * bj_DEGTORAD)
    set y3 = y4 + 300 * Sin(Angle1 - 15 * bj_DEGTORAD)

Should be

JASS:
local real Angle

~ scripts
    set Angle = Angle1 - 15
    set x3 = x4 + 300 * Cos(Angle * bj_DEGTORAD)
    set y3 = y4 + 300 * Sin(Angle * bj_DEGTORAD)

    set Angle = Angle1 + 30
    set x3 = x4 + 300 * Cos(Angle * bj_DEGTORAD)
    set y3 = y4 + 300 * Sin(Angle * bj_DEGTORAD)
 
Level 5
Joined
Jan 6, 2006
Messages
106
LOLz, it should be

set x3 = x4 + 300 * Cos( ( Angle1 - 15 ) * bj_DEGTORAD)
set y3 = y4 + 300 * Sin( ( Angle1 - 15 ) * bj_DEGTORAD)

instead of

set x3 = x4 + 300 * Cos(Angle1 - 15 * bj_DEGTORAD)
set y3 = y4 + 300 * Sin(Angle1 - 15 * bj_DEGTORAD)


Angle1 - 15 is an arithmetic function. You need those ().
 
Level 18
Joined
Oct 18, 2007
Messages
930
LOLz, it should be

set x3 = x4 + 300 * Cos( ( Angle1 - 15 ) * bj_DEGTORAD)
set y3 = y4 + 300 * Sin( ( Angle1 - 15 ) * bj_DEGTORAD)

instead of

set x3 = x4 + 300 * Cos(Angle1 - 15 * bj_DEGTORAD)
set y3 = y4 + 300 * Sin(Angle1 - 15 * bj_DEGTORAD)


Angle1 - 15 is an arithmetic function. You need those ().

Yes ure totaly right but i can use a local to do the job to :) but ure solution is better thx :)
+rep
 
Status
Not open for further replies.
Top