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

[Trigger] Area Knockback - why the **** does this trigger not work?????

Status
Not open for further replies.
I wanted to make a spell for my Witch Doctor named Voodoo Flash. Should work like this:

u cast the spell (eg warthunder or hoof stomp)

all units within 800 range should be knockbacked from the position of the caster

here is my trigger:

  • VoodooFlash
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Voodoo Flash
    • Actions
      • Set FlashCaster = (Triggering unit)
      • Set FlashPoint = (Position of FlashCaster)
      • Set FlashGroup = (Units within 800.00 of FlashPoint matching (((Owner of (Matching unit)) is an enemy of (Owner of FlashCaster)) equal to True))
      • Unitgroup - Pick every unit in FlashGroup and do (Actions)
        • Loop - Actions
          • Set FlashTarget = (Picked unit)
          • Unit - Cause FlashCaster to damage FlashTarget, dealing ((Real((Level of Voodoo Flash for FlashCaster))) x 75.00) damage of attack type Spells and damage type God
          • For each (Integer A) from 1 to 50, do (Actions)
            • Loop - Actions
              • Set FlashPoint02 = (Position of FlashTarget)
              • Set FlashPoint03 = (FlashPoint02 offset by 2.00 towards (Angle from FlashPoint to FlashPoint02) degrees)
              • Unit - Turn collision for FlashTarget Off
                • Specialeffect - Create a special effect attached to the origin of FlashTarget using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
                • Specialeffect - Destroy (Last created special effect)
                • Unit - Move FlashTarget instantly to FlashPoint03
                • Custom script: call PolledWait( 0.03 )
                • Custom script: call RemoveLocation(udg_FlashPoint02)
                • Custom script: call RemoveLocation(udg_FlashPoint03)
          • Custom script: set udg_FlashTarget = null
      • Custom script: call DestroyGroup(udg_FlashGroup)
      • Custom script: call RemoveLocation(udg_FlashPoint)
      • Custom script: set udg_FlashCaster = null

the whole thing inside the seconds loop with special effect and move unit does not work.... it damages but nothing else
 
so i made 3 triggers:

trigger 1

  • Voodoo Learn
    • Events
      • Unit - A unit learns an ability
    • Conditions
      • (Learned Hero Skill) equal to Voodoo Flash
    • Actions
      • Set VoodooLearn = (Triggering unit)


trigger 2

  • VoodooFlash
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Voodoo Flash
    • Actions
      • Set VoodoooCounter = 0
      • Set FlashCaster = (Triggering unit)
      • Set FlashPoint = (Position of FlashCaster)
      • Set FlashGroup = (Units within 800.00 of FlashPoint matching (((Owner of (Matching unit)) is an enemy of (Owner of FlashCaster)) Gleich True))
      • Trigger - Turn on VoodooKnockback <gen>
      • Custom script: call DestroyGroup(udg_FlashGroup)
      • Custom script: call RemoveLocation(udg_FlashPoint)
      • Custom script: set udg_FlashCaster = null
trigger 3

  • VoodooKnockback
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
      • (Real((Level of Voodoo Flash for VoodooLearn))) greater than als 0.00
    • Actions
      • Unitgroup - Pick every unit in FlashGroup and do (Actions)
        • Loop - Actions
          • Set FlashTarget = (Picked unit)
          • Set FlashPoint02 = (Position of FlashTarget)
          • Set FlashPoint03 = (FlashPoint02 offset by 2.00 towards (Angle from FlashPoint to FlashPoint02) degrees)
          • Unit - Turn collision for FlashTarget off
          • Specialeffect - Create a special effect attached to the origin of FlashTarget using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
          • Specialeffect - Destroy (Last created special effect)
          • Unit - Move FlashTarget instantly to FlashPoint03
          • Unit - Turn collision for FlashTarget on
          • Custom script: set udg_FlashTarget = null
          • Custom script: call RemoveLocation(udg_FlashPoint02)
          • Custom script: call RemoveLocation(udg_FlashPoint03)
      • Set VoodoooCounter = (VoodoooCounter + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • VoodoooCounter equal to 50
        • 'THEN'-Actions
          • Trigger - Turn off (This trigger)
        • 'ELSE'-Actions
i did it without damage now letting the hoof stomp doing it

it doesnt work either
 
Last edited:
Level 3
Joined
Sep 25, 2008
Messages
39
  • VoodooFlash
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Voodoo Flash
    • Actions
      • Set FlashCaster = (Triggering unit)
      • Set FlashPoint = (Position of FlashCaster)
      • Set FlashGroup = (Units within 800.00 of FlashPoint matching (((Owner of (Matching unit)) is an enemy of (Owner of FlashCaster)) equal to True))
      • For each (integer A) from 1 to 50, do (Actions)
        • Loop - Actions
          • Unitgroup - Pick every unit in FlashGroup and do (Actions)
            • Loop - Actions
              • Set FlashTarget = (Picked unit)
              • Unit - Cause FlashCaster to damage FlashTarget, dealing ((Real((Level of Voodoo Flash for FlashCaster))) x 75.00) damage of attack type Spells and damage type God
              • Set FlashPoint02 = (Position of FlashTarget)
              • Set FlashPoint03 = (FlashPoint02 offset by 2.00 towards (Angle from FlashPoint to FlashPoint02) degrees)
              • Unit - Turn collision for FlashTarget Off
              • Specialeffect - Create a special effect attached to the origin of FlashTarget using Abilities\Spells\Undead\AntiMagicShell\AntiMagicShell.mdl
              • Specialeffect - Destroy (Last created special effect)
              • Unit - Move FlashTarget instantly to FlashPoint03
            • Custom script: call PolledWait( 0.03 )
            • Custom script: call RemoveLocation(udg_FlashPoint02)
            • Custom script: call RemoveLocation(udg_FlashPoint03)
          • Custom script: set udg_FlashTarget = null
      • Custom script: call DestroyGroup(udg_FlashGroup)
      • Custom script: call RemoveLocation(udg_FlashPoint)
      • Custom script: set udg_FlashCaster = null

I've not tried this but I think it should work.
 
new problem occured

look at this trigger (converted from gui to jass):

JASS:
function Trig_VoodooFlash_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01R' ) ) then
        return false
    endif
    return true
endfunction

function Trig_VoodooFlash_Func003002003 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true )
endfunction

function Trig_VoodooFlash_Func004Func001A takes nothing returns nothing
    set udg_FlashTarget = GetEnumUnit()
    set udg_FlashPoint02 = GetUnitLoc(udg_FlashTarget)
    set udg_FlashPoint03 = PolarProjectionBJ(udg_FlashPoint02, 2.00, AngleBetweenPoints(udg_FlashPoint, udg_FlashPoint02))
    call SetUnitPathing( udg_FlashTarget, false )
    call AddSpecialEffectTargetUnitBJ( "chest", udg_FlashTarget, "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    call SetUnitPositionLoc( udg_FlashTarget, udg_FlashPoint03 )
    call RemoveLocation(udg_FlashPoint02)
    call RemoveLocation(udg_FlashPoint03)
    set udg_FlashTarget = null
endfunction

function Trig_VoodooFlash_Actions takes nothing returns nothing
    set udg_FlashCaster = GetTriggerUnit()
    set udg_FlashPoint = GetUnitLoc(udg_FlashCaster)
    set udg_FlashGroup = GetUnitsInRangeOfLocMatching(800.00, udg_FlashPoint, Condition(function Trig_VoodooFlash_Func003002003))
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 50
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call ForGroupBJ( udg_FlashGroup, function Trig_VoodooFlash_Func004Func001A )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DestroyGroup(udg_FlashGroup)
    call RemoveLocation(udg_FlashPoint)
    set udg_FlashCaster = null
endfunction

//===========================================================================
function InitTrig_VoodooFlash takes nothing returns nothing
    set gg_trg_VoodooFlash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_VoodooFlash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_VoodooFlash, Condition( function Trig_VoodooFlash_Conditions ) )
    call TriggerAddAction( gg_trg_VoodooFlash, function Trig_VoodooFlash_Actions )
endfunction

it works but it also works on buildings....
thats not the way it should be

look: i changed the trigger a little bit using jasscraft, it shows some errors...
JASS:
function Trig_VoodooFlash_Conditions takes nothing returns boolean
    if ( GetSpellAbilityId() == 'A01R' ) then
        return true
    endif
    return false
endfunction


function Trig_VoodooFlash_Func004Func001A takes nothing returns nothing
    set udg_FlashTarget = GetEnumUnit()
    set udg_FlashPoint02 = GetUnitLoc(udg_FlashTarget)
    set udg_FlashPoint03 = PolarProjectionBJ(udg_FlashPoint02, 2.00, AngleBetweenPoints(udg_FlashPoint, udg_FlashPoint02))
    call SetUnitPathing( udg_FlashTarget, false )
    call AddSpecialEffectTargetUnitBJ( "chest", udg_FlashTarget, "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    call SetUnitPositionLoc( udg_FlashTarget, udg_FlashPoint03 )
    call SetUnitPathing( udg_FlashTarget, true )
    call RemoveLocation(udg_FlashPoint02)
    call RemoveLocation(udg_FlashPoint03)
    set udg_FlashTarget = null
endfunction

function Trig_VoodooFlash_Actions takes nothing returns nothing
    set udg_FlashCaster = GetTriggerUnit()
    set udg_FlashPoint = GetUnitLoc(udg_FlashCaster)
    set udg_FlashGroup = GetUnitsInRangeOfLocMatching(800.00, udg_FlashPoint, Condition(return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true))
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 50
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call ForGroupBJ( udg_FlashGroup, function Trig_VoodooFlash_Func004Func001A )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DestroyGroup(udg_FlashGroup)
    call RemoveLocation(udg_FlashPoint)
    set udg_FlashCaster = null
endfunction

//===========================================================================
function InitTrig_VoodooFlash takes nothing returns nothing
    set gg_trg_VoodooFlash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_VoodooFlash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_VoodooFlash, Condition( function Trig_VoodooFlash_Conditions ) )
    call TriggerAddAction( gg_trg_VoodooFlash, function Trig_VoodooFlash_Actions )
endfunction

this is the script hw it looks now (experimental)

i erased this part:
JASS:
function Trig_VoodooFlash_Func003002003 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true )
endfunction

and made this instead:
JASS:
set udg_FlashGroup = GetUnitsInRangeOfLocMatching(800.00, udg_FlashPoint, Condition(return IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true))

i could need some suggestions to change the trigger making it easier and shorter, maybe i could need a wait for a smooth slide....

n help, thx!
 
Last edited:
Level 11
Joined
Dec 31, 2007
Messages
780
  • Set FlashGroup = (Units within 800.00 of FlashPoint matching (((Owner of (Matching unit)) is an enemy of (Owner of FlashCaster)) equal to True))
in this part add matching unit is a building not equal to true and thats done

(you need to look for an "and" inside the conditions and make those 2 matching unit together)
 
why does this not work on normal units

JASS:
function Trig_VoodooFlash_Kopieren_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01R' ) ) then
        return false
    endif
    return true
endfunction

function Trig_VoodooFlash_Kopieren_Func003002003001 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true )
endfunction

function Trig_VoodooFlash_Kopieren_Func003002003002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true )
endfunction

function Trig_VoodooFlash_Kopieren_Func003002003 takes nothing returns boolean
    return GetBooleanAnd( Trig_VoodooFlash_Kopieren_Func003002003001(), Trig_VoodooFlash_Kopieren_Func003002003002() )
endfunction

function Trig_VoodooFlash_Kopieren_Func004Func001A takes nothing returns nothing
    set udg_FlashTarget = GetEnumUnit()
    call UnitDamageTargetBJ( udg_FlashCaster, udg_FlashTarget, ( I2R(GetUnitAbilityLevelSwapped('A01R', udg_FlashCaster)) * 1 ), ATTACK_TYPE_CHAOS, DAMAGE_TYPE_DIVINE )
    set udg_FlashPoint02 = GetUnitLoc(udg_FlashTarget)
    set udg_FlashPoint03 = PolarProjectionBJ(udg_FlashPoint02, 2.00, AngleBetweenPoints(udg_FlashPoint, udg_FlashPoint02))
    call SetUnitPathing( udg_FlashTarget, false )
    call AddSpecialEffectTargetUnitBJ( "chest", udg_FlashTarget, "Abilities\\Spells\\Undead\\AntiMagicShell\\AntiMagicShell.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    call SetUnitPositionLoc( udg_FlashTarget, udg_FlashPoint03 )
    call RemoveLocation(udg_FlashPoint02)
    call RemoveLocation(udg_FlashPoint03)
    set udg_FlashTarget = null
    call PolledWait( 0.03 )
endfunction

function Trig_VoodooFlash_Kopieren_Actions takes nothing returns nothing
    set udg_FlashCaster = GetTriggerUnit()
    set udg_FlashPoint = GetUnitLoc(udg_FlashCaster)
    set udg_FlashGroup = GetUnitsInRangeOfLocMatching(800.00, udg_FlashPoint, Condition(function Trig_VoodooFlash_Kopieren_Func003002003))
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 50
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call ForGroupBJ( udg_FlashGroup, function Trig_VoodooFlash_Kopieren_Func004Func001A )
        call PolledWait( 0.03 )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DestroyGroup(udg_FlashGroup)
    call RemoveLocation(udg_FlashPoint)
    set udg_FlashCaster = null
endfunction

//===========================================================================
function InitTrig_VoodooFlash_Kopieren takes nothing returns nothing
    set gg_trg_VoodooFlash_Kopieren = CreateTrigger(  )
    call DisableTrigger( gg_trg_VoodooFlash_Kopieren )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_VoodooFlash_Kopieren, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_VoodooFlash_Kopieren, Condition( function Trig_VoodooFlash_Kopieren_Conditions ) )
    call TriggerAddAction( gg_trg_VoodooFlash_Kopieren, function Trig_VoodooFlash_Kopieren_Actions )
endfunction



and this does work????

JASS:
function Trig_VoodooFlash_Conditions takes nothing returns boolean
    if ( not ( GetSpellAbilityId() == 'A01R' ) ) then
        return false
    endif
    return true
endfunction

function Trig_VoodooFlash_Func003002003 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true )
endfunction

function Trig_VoodooFlash_Func004Func001A takes nothing returns nothing
    set udg_FlashTarget = GetEnumUnit()
    set udg_FlashPoint02 = GetUnitLoc(udg_FlashTarget)
    set udg_FlashPoint03 = PolarProjectionBJ(udg_FlashPoint02, 5.00, AngleBetweenPoints(udg_FlashPoint, udg_FlashPoint02))
    call SetUnitPathing( udg_FlashTarget, false )
    call AddSpecialEffectTargetUnitBJ( "chest", udg_FlashTarget, "Abilities\\Spells\\Demon\\DarkConversion\\ZombifyTarget.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    call SetUnitPositionLoc( udg_FlashTarget, udg_FlashPoint03 )
    call SetUnitPathing( udg_FlashTarget, true )
    call RemoveLocation(udg_FlashPoint02)
    call RemoveLocation(udg_FlashPoint03)
    set udg_FlashTarget = null
    call PolledWait( 0.02 )
endfunction

function Trig_VoodooFlash_Actions takes nothing returns nothing
    set udg_FlashCaster = GetTriggerUnit()
    set udg_FlashPoint = GetUnitLoc(udg_FlashCaster)
    set udg_FlashGroup = GetUnitsInRangeOfLocMatching(800.00, udg_FlashPoint, Condition(function Trig_VoodooFlash_Func003002003))
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 50
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call ForGroupBJ( udg_FlashGroup, function Trig_VoodooFlash_Func004Func001A )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
    call DestroyGroup(udg_FlashGroup)
    call RemoveLocation(udg_FlashPoint)
    set udg_FlashCaster = null
endfunction

//===========================================================================
function InitTrig_VoodooFlash takes nothing returns nothing
    set gg_trg_VoodooFlash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_VoodooFlash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_VoodooFlash, Condition( function Trig_VoodooFlash_Conditions ) )
    call TriggerAddAction( gg_trg_VoodooFlash, function Trig_VoodooFlash_Actions )
endfunction



plz i n help now!!!
 
Level 11
Joined
Dec 31, 2007
Messages
780
i cant help you with jass but i have an area knockback spell here in my signature (in the map that says "basic abilities"... maybe if you take a look at it you might figure something out (it is made in gui and it is leakless)
 
Level 3
Joined
Sep 25, 2008
Messages
39
Looks like a problem with this bit.

JASS:
function Trig_VoodooFlash_Kopieren_Func003002003002 takes nothing returns boolean
    return ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) != true )
endfunction

I would replace the 3 condition functions with this one

JASS:
function Trig_VoodoFlash_MatchingCondition takes nothing returns boolean
return  ((IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_FlashCaster)) == true ) and ( IsUnitType(GetFilterUnit(), UNIT_TYPE_STRUCTURE) == false ))
endfunction
 
Status
Not open for further replies.
Top