• 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.

[Spell] "non targeted leap" help plzz

Status
Not open for further replies.
Level 2
Joined
Jul 6, 2007
Messages
12
Hi all i need help with a non targeted leap...Descriptn: the caster jumps (700 range) and at the end of his path the caster stuns all nearby enemy units with the stomp ability, the stomp stacks in continuous cast (in a very fast cast) logically, the number of stomps=the number of continuous cast...Ok i make the leap in gui but it does not suport a 10 players map bcoz the leap have problems when two players cast the leap at the same time. So i make this spell in jass and all players can cast the leap at the same time without problems but now the leap s stomp effect does not stack....Heres the leap spell en gui and the bad code in jass:
  • TigerLeap
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to TigerLeap
    • Actions
      • Set Unis[15] = (Casting unit)
      • Set r[2] = 0.00
      • Custom script: call SetUnitAnimationByIndex(udg_Unis[15],6)
      • Custom script: call SetUnitInvulnerable(udg_Unis[15],true)
      • Custom script: call SetUnitPathing(udg_Unis[15],false)
      • Unit - Add to Unis[15]
      • Trigger - Turn on LeapMove <gen>
      • Trigger - Run gg_trg_TigerLeapPathing (checking conditions)
      • Animation - Change Unis[15] flying height to 250.00 at 350.00
      • Wait 0.25 seconds
      • Animation - Change Unis[15] flying height to 0.00 at 700.00
      • Wait until (r[2] Greater than or equal to 700.00), checking every 0.10 seconds
      • Trigger - Turn off LeapMove <gen>
      • Animation - Reset Unis[15]'s animation
      • Unit - Create 1 TigerLeapUnit for (Owner of Unis[15]) at (Position of Unis[15]) facing Default building facing degrees
      • Unit - Order (Last created unit) to Orc Tauren Chieftain - War Stomp
      • Special Effect - Create a special effect at (Position of Unis[15]) using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call SetUnitInvulnerable(udg_Unis[15],false)
      • Custom script: call SetUnitPathing(udg_Unis[15],true)
      • Unit - Remove from Unis[15]
      • Animation - Change Unis[15]'s animation speed to 100.00% of its original speed
  • Leap Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • Set p[7] = (Position of Unis[15])
      • Set r[2] = (r[2] + 25.00)
      • Unit - Move Unis[15] instantly to p[7], facing (Facing of Unis[15]) degrees
      • Custom script: call RemoveLocation(udg_p[7])
JASS:
function Trig_TigerLeap1_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A010'
endfunction
function Leap_Move takes nothing returns nothing
    local timer tl = GetExpiredTimer()
    local unit lp = GetHandleUnit(tl,"lp")
    local location loct = GetUnitLoc(lp)
    local real lr = GetHandleReal(tl,"lr")
    local location loct2 = PolarProjectionBJ(loct,5,GetUnitFacing(lp))
    if lr >= 0 then
    call SetUnitPositionLoc( lp,loct2 )
    call SetHandleReal(tl,"lr",lr*.25)
else
call CreateNUnitsAtLoc( 1, 'e00B', GetOwningPlayer(lp), GetUnitLoc(lp), bj_UNIT_FACING )
    call IssueImmediateOrderBJ( GetLastCreatedUnit(), "stomp" )
    call AddSpecialEffectLocBJ( GetUnitLoc(lp), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
endif
    call RemoveLocation(loct)
    set loct = null
    call RemoveLocation(loct2)
    set loct2 = null
    set lp = null
    set tl = null
endfunction

function Trig_TigerLeap1_Actions takes nothing returns nothing
    local timer tl = CreateTimer()
    local unit lp = GetTriggerUnit()
    local location loct = GetUnitLoc(lp)
    call SetHandleReal(tl,"lr",5)
    call SetHandleHandle(tl, "lp", lp)
    call SetUnitAnimationByIndex(lp,6)
    call SetUnitInvulnerable(lp,true)
    call SetUnitPathing(lp,false)
    call UnitAddAbilityBJ( 'A00Z', lp )
    call SetUnitFlyHeightBJ( lp, 250.00, 350.00 )
    call TimerStart(tl, 0.01, true, function Leap_Move)
    call TriggerSleepAction( 0.25 )
    call SetUnitFlyHeightBJ( lp, 0.00, 700.00 )
    call TriggerSleepAction( 0.01 )
    call ResetUnitAnimation( lp )
    call CreateNUnitsAtLoc( 1, 'e00B', GetOwningPlayer(lp), GetUnitLoc(lp), bj_UNIT_FACING )
    call IssueImmediateOrderBJ( GetLastCreatedUnit(), "stomp" )
    call AddSpecialEffectLocBJ( GetUnitLoc(lp), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    call SetUnitInvulnerable(lp,false)
    call SetUnitPathing(lp,true)
    call UnitRemoveAbilityBJ( 'A00Z', lp )
    call SetUnitTimeScalePercent( lp, 100.00 )
    call FlushHandleLocals(tl)
    call PauseTimer(tl)
    call DestroyTimer(tl)    
    set tl = null
endfunction

//===========================================================================
function InitTrig_TigerLeap1 takes nothing returns nothing
    set gg_trg_TigerLeap1 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_TigerLeap1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_TigerLeap1, Condition( function Trig_TigerLeap1_Conditions ) )
    call TriggerAddAction( gg_trg_TigerLeap1, function Trig_TigerLeap1_Actions )
endfunction
I want to convert my GUI leap spell in a correctly code in jass with all his atributes. Help plzz
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I didn't notice anything that shouldn't work with the dummy in the Jass that does in the GUI.

Anyways, your JASS needs a cleanup; use X/Y, get read of BJs, and so on, and so forth.

EDIT: In the second func, shouldn't it be if lr <= 0 then and not if lr >= 0 then since you store lr as 5?

EDIT: Why do you even have all the dummy stuff within the move func in general?
 
Level 2
Joined
Jul 6, 2007
Messages
12
could you make the clean up for me plz? im new in jass
this is the reason of my bad jass code. I want to convert gui with all its effexcts and atributes to jass
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Untested in game, but try this out

JASS:
function Trig_TigerLeap1_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A010'
endfunction
function Leap_Move takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit lp = GetHandleUnit(t,"lp")
    local location loct = GetUnitLoc(lp)
    local real lr = GetHandleReal(t,"lr")
    local unit d
    if lr < 700 then
        call SetUnitX(lp,GetUnitX(lp)+5*Cos(GetUnitFacing(lp)*bj_DEGTORAD))
        call SetUnitY(lp,GetUnitY(lp)+5*Sin(GetUnitFacing(lp)*bj_DEGTORAD))
        call SetHandleReal(t,"lr",lr+5)
    else
        set d = CreateUnit(GetOwningPlayer(lp),'e00B',GetUnitX(lp),GetUnitY(lp),0)
        call IssueImmediateOrder( d, "stomp" )
        call DestroyEffect(AddSpecialEffect( "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", GetUnitX(d),GetUnitY(d)))
        call UnitApplyTimedLife(d,'BTLF',1)
        call PauseTimer(t)
        call FlushHandleLocals(t)
        call DestroyTimer(t)
        call SetUnitTimeScale(lp,1)
        call UnitRemoveAbility(lp,'A00Z')
        call SetUnitPathing(lp,true)
        call SetUnitInvulnerable(lp,false)
        call ResetUnitAnimation(lp)
        set d = null
    endif
    set lp = null
    set t = null
endfunction

function Trig_TigerLeap1_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local unit lp = GetTriggerUnit()
    call SetHandleReal(t,"lr",5)
    call SetHandleHandle(t, "lp", lp)
    call SetUnitAnimationByIndex(lp,6)
    call SetUnitInvulnerable(lp,true)
    call SetUnitPathing(lp,false)
    call UnitAddAbility( lp, 'A00Z' )
    call SetUnitFlyHeight( lp, 250, 350 )
    call TimerStart(t, .01, true, function Leap_Move)
    call TriggerSleepAction( .25 )
    call SetUnitFlyHeight( lp, 0, 700 )    
    set t = null
    set lp = null
endfunction

function InitTrig_TigerLeap1 takes nothing returns nothing
    set gg_trg_TigerLeap1 = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( gg_trg_TigerLeap1, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_TigerLeap1, Condition( function Trig_TigerLeap1_Conditions ) )
    call TriggerAddAction( gg_trg_TigerLeap1, function Trig_TigerLeap1_Actions )
endfunction
 
Status
Not open for further replies.
Top