• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[JASS] Question.

Status
Not open for further replies.
Level 19
Joined
Oct 29, 2007
Messages
1,184
JASS:
function InitTrig_PICKUP takes nothing returns nothing
    set gg_trg_PICKUP = CreateTrigger(  )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[1], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[2], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[3], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[4], 64, null )
    call TriggerAddAction( gg_trg_PICKUP, function Trig_PICKUP_Actions )
endfunction

Will this work as event where GetTriggerUnit equals the unit in range of udg_u?

Cause it seems function Trig_PICKUP doesn't run at all.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
I doubt your udg_u array variable is already set to its values when this init function is run.

Write

JASS:
function InitTrig_PICKUP takes nothing returns nothing
    set gg_trg_PICKUP = CreateTrigger(  )
    set udg_u[1] = <unit>
    set udg_u[2] = <unit>
    set udg_u[3] = <unit>
    set udg_u[4] = <unit>

    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[1], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[2], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[3], 64, null )
    call TriggerRegisterUnitInRange( gg_trg_PICKUP, udg_u[4], 64, null )
    call TriggerAddAction( gg_trg_PICKUP, function Trig_PICKUP_Actions )
endfunction

or call this trigger setup function after you have filled your array.
 
64 range basically means that the two units cannot have more than 32 collision (all heroes have 32 for balancing reasons) and must be perfectly touching. The range has to be the collision size of the unit plus the collision size of the actively-colliding unit, plus 64, in order to negate the collision size factor. 128 collision radius will do the job.
 
Status
Not open for further replies.
Top