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

How Do i Make Knock Back Spells

Status
Not open for further replies.
Level 4
Joined
Nov 3, 2004
Messages
79
Thats a example from my Stygian Lord for a push back function, u need to start a timer for 0,01 seconds repeatedly and call to move unit instantly to a point behind himself (polar projection function used) I hope i could help u. (sorry its a few german in this script.
JASS:
function Trig_Smash_Push_Back_Kopieren_Func001C takes nothing returns boolean
    if ( not ( udg_SmashedPBCap >= 50 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Smash_Push_Back_Kopieren_Func003A takes nothing returns nothing
    call RemoveLocation(udg_SmashedCurrentPoint)
    call RemoveLocation(udg_SmashedPBBackPoint)
    call DestroyEffectBJ( udg_SmashedPBEffect )
    set udg_SmashedCurrentPoint = GetUnitLoc(GetEnumUnit())
    set udg_SmashedPBBackPoint = PolarProjectionBJ(udg_SmashedCurrentPoint, 4.00, AngleBetweenPoints(udg_SmashedArea, udg_SmashedCurrentPoint))
    call SetUnitPositionLoc( GetEnumUnit(), udg_SmashedPBBackPoint )
    call AddSpecialEffectLocBJ( udg_SmashedCurrentPoint, "Abilities\\Spells\\Human\\FlakCannons\\FlakTarget.mdl" )
    set udg_SmashedPBEffect = GetLastCreatedEffectBJ()
endfunction

function Trig_Smash_Push_Back_Kopieren_Actions takes nothing returns nothing
    if ( Trig_Smash_Push_Back_Kopieren_Func001C() ) then
        call GroupClear( udg_SmashedPBGroup )
        set udg_SmashedPBCap = 0
        set udg_SmashUnit = null
        set udg_SmashedUnit = null
        call PauseTimerBJ( true, udg_SmashedPBTimer )
        call RemoveLocation(udg_SmashedArea)
        call RemoveLocation(udg_SmashedCurrentPoint)
        call RemoveLocation(udg_SmashedPBBackPoint)
        return
    else
    endif
    set udg_SmashedPBCap = ( udg_SmashedPBCap + 1 )
    call ForGroupBJ( udg_SmashedPBGroup, function Trig_Smash_Push_Back_Kopieren_Func003A )
endfunction

//===========================================================================
function InitTrig_Smash_Push_Back_Kopieren takes nothing returns nothing
    set gg_trg_Smash_Push_Back_Kopieren = CreateTrigger(  )
    call TriggerRegisterTimerExpireEventBJ( gg_trg_Smash_Push_Back_Kopieren, udg_SmashedPBTimer )
    call TriggerAddAction( gg_trg_Smash_Push_Back_Kopieren, function Trig_Smash_Push_Back_Kopieren_Actions )
endfunction
 
Level 22
Joined
Jan 10, 2005
Messages
3,426
use the actions 'unit - move unit instantly to 'position' then use point with polar offset and move it to position of the unit u want to slide offset by 30 (depends on how fast u want it to slide) facing the unit facing, or the facing of the unit that attacks him or anything

use that function in a trigger with the event: every XXX seconds of the game (0.03)
 
Status
Not open for further replies.
Top