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

Charged Arrow does nothing

Status
Not open for further replies.
Level 12
Joined
Mar 23, 2008
Messages
942
These triggers are supposed to summon a arrow that start moving after released and damage someone that goes into way... but does nothing, the unit just start channeling, and after that nothing happens...

  • Caladbolg start
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Caladbolg II (based in channel)
    • Actions
      • Set Caladbolg = (Casting unit)
      • Set temppoint = (Target point of ability being cast)
      • Unit - Make (Casting unit) face temppoint over 0.00 seconds
      • Custom script: call RemoveLocation(udg_temppoint)
      • Trigger - Turn on Caladbolg charge <gen>
      • Trigger - Turn on Caladbolg end <gen>
  • Caladbolg charge
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Set the custom value of Caladbolg to ((Custom value of Caladbolg) + 1)
  • Caladbolg end
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Dies
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Dying unit) Equal to Caladbolg
          • (Ordered unit) Equal to Caladbolg
    • Actions
      • Set SpellPoint[0] = (Position of Caladbolg)
      • Set SpellPoint[1] = (SpellPoint[0] offset by 100.00 towards (Facing of Caladbolg) degrees)
      • Unit - Create 1 Caladbolg Arrow for (Owner of Caladbolg) at SpellPoint[1] facing (Facing of Caladbolg) degrees
      • Set Caladbolg = (Last created unit)
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off Caladbolg charge <gen>
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
      • Custom script: call RemoveLocation(udg_SpellPoint[1])
      • Trigger - Turn on Caladbolg move <gen>
  • Caladbolg move
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Custom script: local real udg_tempreal
      • Set SpellPoint[0] = (Position of Caladbolg)
      • Set tempgroup = (Units within 80.00 of SpellPoint[0] matching (((Owner of (Triggering unit)) is an enemy of (Owner of Caladbolg)) Equal to True))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (tempgroup is empty) Equal to True
        • Then - Actions
          • Unit - Cause PlayerHero[(Player number of (Owner of Caladbolg))] to damage (Random unit from tempgroup), dealing (120.00 x (Real((Custom value of PlayerHero[(Player number of (Owner of Caladbolg))])))) damage of attack type Spells and damage type Normal
          • Unit - Set the custom value of PlayerHero[(Player number of (Owner of Caladbolg))] to 0
          • Unit - Remove Caladbolg from the game
          • Set Caladbolg = No unit
          • Trigger - Turn off (This trigger)
          • Custom script: call RemoveLocation(udg_SpellPoint[0])
          • Custom script: call RemoveLocation(udg_SpellPoint[1])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • tempreal Greater than or equal to 1200.00
            • Then - Actions
              • Set Caladbolg = No unit
              • Trigger - Turn off (This trigger)
              • Custom script: call RemoveLocation(udg_SpellPoint[0])
              • Custom script: call RemoveLocation(udg_SpellPoint[1])
            • Else - Actions
              • Set tempreal = (tempreal + 8.00)
              • Set SpellPoint[1] = (SpellPoint[0] offset by 8.00 towards (Facing of Caladbolg) degrees)
              • Unit - Move Caladbolg instantly to SpellPoint[1]
              • Custom script: call RemoveLocation(udg_SpellPoint[0])
              • Custom script: call RemoveLocation(udg_SpellPoint[1])
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Does the trigger "Caladbolg charge" fire? If not maybe you could try
  • Unit - A unit starts the effect of an ability
instead.

There is also an error in the "Caladbolg move" trigger. (((Owner of (Triggering unit)) should be (((Owner of (Matching unit))
 
Level 12
Joined
Mar 23, 2008
Messages
942
I found the problem, when I set (tempgroup is empty) Equal to True it was to be False, the arrow was been destroyed after enter the game.

I had to change the last trigger due to need of locals, but I need help to put the boolean functions inside the main function to be able to use locals... But I don't know how I do that.

Can someone help me?

JASS:
function Trig_Caladbolg_move_Func003002003 takes nothing returns boolean
    return ( IsPlayerEnemy(GetOwningPlayer(GetFilterUnit()), GetOwningPlayer(udg_Caladbolg)) == true )
endfunction

function Trig_Caladbolg_move_Func004Func001C takes nothing returns boolean
    if ( not ( tempreal >= 1200.00 ) ) then
        return false
    endif
    return true
endfunction

function Trig_Caladbolg_move_Func004C takes nothing returns boolean
    if ( not ( IsUnitGroupEmptyBJ(tg) == false ) ) then
        return false
    endif
    return true
endfunction

function Trig_Caladbolg_move_Actions takes nothing returns nothing
    local real tempreal
    local location sp0
    local location sp1
    local group tg
    set sp0 = GetUnitLoc(udg_Caladbolg)
    set tg = GetUnitsInRangeOfLocMatching(80.00, sp0, Condition(function Trig_Caladbolg_move_Func003002003))
    if ( Trig_Caladbolg_move_Func004C() ) then
        call UnitDamageTargetBJ( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], GroupPickRandomUnit(tg), ( 120.00 * I2R(GetUnitUserData(udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))])) ), ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        call RemoveLocation(sp1)
    else
        if ( Trig_Caladbolg_move_Func004Func001C() ) then
            call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
            call RemoveUnit( udg_Caladbolg )
            set udg_Caladbolg = null
            call DisableTrigger( GetTriggeringTrigger() )
            call RemoveLocation(sp0)
            call RemoveLocation(sp1)
        else
            set tempreal = ( tempreal + 8.00 )
            set sp1 = PolarProjectionBJ(sp0, 8.00, GetUnitFacing(udg_Caladbolg))
            call SetUnitPositionLoc( udg_Caladbolg, sp1 )
            call RemoveLocation(sp0)
            call RemoveLocation(sp1)
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Caladbolg_move takes nothing returns nothing
    set gg_trg_Caladbolg_move = CreateTrigger(  )
    call DisableTrigger( gg_trg_Caladbolg_move )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Caladbolg_move, 0.04 )
    call TriggerAddAction( gg_trg_Caladbolg_move, function Trig_Caladbolg_move_Actions )
endfunction

Also, the arrow is not moving... I don't know why...
 
Level 22
Joined
Dec 31, 2006
Messages
2,216
Here:

JASS:
function Caladbolg_Conditions takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Caladbolg))
endfunction

function Caladbolg_Move takes nothing returns nothing
    local location sp0
    local location sp1
    local group tg
    local boolexpr b = Condition(function Caladbolg_Conditions)
    set sp0 = GetUnitLoc(udg_Caladbolg)
    set tg = GetUnitsInRangeOfLocMatching(80.00, sp0, b)
    if IsUnitGroupEmptyBJ(tg) == false then
        call UnitDamageTarget( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], GroupPickRandomUnit(tg), ( 120.00 * I2R(GetUnitUserData(udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))])) ), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null )
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    elseif udg_tempreal >= 1200. then
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    else
        set udg_tempreal = udg_tempreal + 8.00
        set sp1 = PolarProjectionBJ(sp0, 8.00, GetUnitFacing(udg_Caladbolg))
        call SetUnitPositionLoc( udg_Caladbolg, sp1 )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    endif
endfunction

//===========================================================================
function InitTrig_Caladbolg_Move takes nothing returns nothing
    set gg_trg_Caladbolg_Move = CreateTrigger( )
    //call DisableTrigger( gg_trg_Caladbolg_Move )    <------WHY DID YOU DO THIS? This will disable the trigger so it cannot run.
    call TriggerRegisterTimerEventPeriodic( gg_trg_Caladbolg_Move, 0.04 )
    call TriggerAddAction( gg_trg_Caladbolg_Move, function Caladbolg_Move )
endfunction

The variable tempreal must be global if you want it to be able to become over 1200.

And the reason for why it didn't move was because you disabled the trigger.
 
Level 12
Joined
Mar 23, 2008
Messages
942
Lol I didn't put that disable trigger that, looking into the GUI trigger you can see that this line inst there!

Edit: lol... I forgot to thank you!
Thank you! ^^

Edit2: How much can a local real get?
Edit3: This is giving me errors: set gg_trg_Caladbolg_Move = CreateTrigger( )
(Undeclared variable gg_trg_Caladbolg_Move)
 
Level 12
Joined
Mar 23, 2008
Messages
942
Still not moving the arrow

JASS:
function Caladbolg_Conditions takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Caladbolg))
endfunction

function Caladbolg_Move takes nothing returns nothing
    local location sp0
    local location sp1
    local group tg
    local real tempreal
    local boolexpr b = Condition(function Caladbolg_Conditions)
    set sp0 = GetUnitLoc(udg_Caladbolg)
    set tg = GetUnitsInRangeOfLocMatching(80.00, sp0, b)
    if IsUnitGroupEmptyBJ(tg) == false then
        call UnitDamageTarget( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], GroupPickRandomUnit(tg), ( 120.00 * I2R(GetUnitUserData(udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))])) ), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null )
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    elseif tempreal >= 150. then
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    else
set tempreal = tempreal + 1.00
        set sp1 = PolarProjectionBJ(sp0, 8.00, GetUnitFacing(udg_Caladbolg))
        call SetUnitPositionLoc( udg_Caladbolg, sp1 )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    endif
endfunction

//===========================================================================
function InitTrig_Caladbolg_Move takes nothing returns nothing
    set gg_trg_Caladbolg_Move = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Caladbolg_Move, 0.04 )
    call TriggerAddAction( gg_trg_Caladbolg_Move, function Caladbolg_Move )
endfunction
 
Level 11
Joined
Apr 6, 2008
Messages
760
  • Unit - A unit Is issued an order targeting an object
  • Unit - A unit Is issued an order targeting a point
  • Unit - A unit Is issued an order with no target
  • Unit - A unit Dies
dont do like that...

  • Unit - A unit Stops casting an ability
way better since ur event wont register if he get stunned or something
 
Level 12
Joined
Mar 23, 2008
Messages
942
  • Unit - A unit Is issued an order targeting an object
  • Unit - A unit Is issued an order targeting a point
  • Unit - A unit Is issued an order with no target
  • Unit - A unit Dies
dont do like that...

  • Unit - A unit Stops casting an ability
way better since ur event wont register if he get stunned or something
hahahaha, I'm using that "Unit - A unit Stops casting an ability"
I changed some time ago.

I don't know if getting stunned is a order, but is registered correctly with the events.

I think my problem is because my arrow have locust, but I thought it will not give problems because I added it to a variable...
*Remove locust*
Lol... still not moving o_O

  • Caladbolg start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Caladbolg II (based in channel)
    • Actions
      • Set Caladbolg = (Casting unit)
      • Set temppoint = (Target point of ability being cast)
      • Unit - Make (Casting unit) face temppoint over 0.00 seconds
      • Custom script: call RemoveLocation(udg_temppoint)
      • Trigger - Turn on Caladbolg charge <gen>
      • Trigger - Turn on Caladbolg end <gen>
  • Caladbolg charge
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Set the custom value of Caladbolg to ((Custom value of Caladbolg) + 1)
  • Caladbolg end
    • Events
      • Unit - A unit Stops casting an ability
    • Conditions
      • (Casting unit) Equal to Caladbolg
    • Actions
      • Set SpellPoint[0] = (Position of Caladbolg)
      • Set SpellPoint[1] = (SpellPoint[0] offset by 100.00 towards (Facing of Caladbolg) degrees)
      • Unit - Create 1 Caladbolg Arrow for (Owner of Caladbolg) at SpellPoint[1] facing (Facing of Caladbolg) degrees
      • Set Caladbolg = (Last created unit)
      • Trigger - Turn on Caladbolg Move <gen>
      • Trigger - Turn off (This trigger)
      • Trigger - Turn off Caladbolg charge <gen>
      • Custom script: call RemoveLocation(udg_SpellPoint[0])
      • Custom script: call RemoveLocation(udg_SpellPoint[1])
JASS:
function Caladbolg_Conditions takes nothing returns boolean
    return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Caladbolg))
endfunction

function Caladbolg_Move takes nothing returns nothing
    local location sp0
    local location sp1
    local group tg
    local real tempreal = 0
    local boolexpr b = Condition(function Caladbolg_Conditions)
    set sp0 = GetUnitLoc(udg_Caladbolg)
    set tg = GetUnitsInRangeOfLocMatching(80.00, sp0, b)
    if IsUnitGroupEmptyBJ(tg) == false then
        call UnitDamageTarget( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], GroupPickRandomUnit(tg), ( 120.00 * I2R(GetUnitUserData(udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))])) ), true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, null )
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    elseif tempreal >= 150. then
        call SetUnitUserData( udg_PlayerHero[GetConvertedPlayerId(GetOwningPlayer(udg_Caladbolg))], 0 )
        call RemoveUnit( udg_Caladbolg )
        set udg_Caladbolg = null
        call DisableTrigger( GetTriggeringTrigger() )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    else
        set tempreal = tempreal + 1.00
        set sp1 = PolarProjectionBJ(sp0, 8.00, GetUnitFacing(udg_Caladbolg))
        call SetUnitPositionLoc( udg_Caladbolg, sp1 )
        call RemoveLocation(sp0)
        set sp0 = null
        call RemoveLocation(sp1)
        set sp1 = null
        set b = null
    endif
endfunction

//===========================================================================
function InitTrig_Caladbolg_Move takes nothing returns nothing
    set gg_trg_Caladbolg_Move = CreateTrigger( )
    call TriggerRegisterTimerEventPeriodic( gg_trg_Caladbolg_Move, 0.04 )
    call TriggerAddAction( gg_trg_Caladbolg_Move, function Caladbolg_Move )
endfunction

Edit: Lol tested again and it works... but the arrow is never destroyed!
Why?

Edit2: Bugs

- The arrow never got destroyed if don't hit someone (Always)
- The arrow don't do any damage (Common)
- You got a 1 extra charge, the max is 5 charges, but you can got 6 sometimes. (Rare)
 
Last edited:
Status
Not open for further replies.
Top