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

Add trigger event with specific unit - variable event

Status
Not open for further replies.
Level 17
Joined
Nov 13, 2006
Messages
1,814
JASS:
            set x = GetRandomReal(GetRectMinX(udg_Region[1]), GetRectMaxX(udg_Region[1]))
            set y = GetRandomReal(GetRectMinY(udg_Region[1]), GetRectMaxY(udg_Region[1]))
            set udg_HarvesterBot[0] = CreateUnit( Player(11), 'n005', x, y, 0 )
            set x = GetRandomReal(GetRectMinX(udg_Region[0]), GetRectMaxX(udg_Region[0]))
            set y = GetRandomReal(GetRectMinY(udg_Region[0]), GetRectMaxY(udg_Region[0]))
            set cv = GetUnitUserData(udg_HarvesterBot[0])
            set udg_H_Job[cv] = 1
            set udg_H_Home[cv] = CreateUnit( Player(11), 'n007', x, y, 0 )
            set x = GetRandomReal(GetRectMinX(udg_Region[1]), GetRectMaxX(udg_Region[1]))
            set y = GetRandomReal(GetRectMinY(udg_Region[1]), GetRectMaxY(udg_Region[1]))
            call TriggerRegisterUnitInRange( gg_trg_Harvester_home, udg_H_Home[cv], 50.00, null )
            set udg_HarvesterBot[1] = CreateUnit( Player(11), 'n008', x, y, 0 )
            set x = GetRandomReal(GetRectMinX(udg_Region[0]), GetRectMaxX(udg_Region[0]))
            set y = GetRandomReal(GetRectMinY(udg_Region[0]), GetRectMaxY(udg_Region[0]))
            set cv = GetUnitUserData(udg_HarvesterBot[1])
            set udg_H_Job[cv] = 2
            set udg_H_Home[cv] = CreateUnit( Player(11), 'n009', x, y, 0 )
            call TriggerRegisterUnitInRange( gg_trg_Harvester_home, udg_H_Home[cv], 50.00, null )

the 2nd event not registered, only 1st but if i chanege to this then work

JASS:
           call TriggerRegisterUnitInRange( gg_trg_Harvester_home, u1, 50.00, 
           call TriggerRegisterUnitInRange( gg_trg_Harvester_home, u2, 50.00,
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
instead of using a TriggerRegisterUnitInRange, why dont you just use IsUnitMoving and use the native IsUnitInRange?...

it is faster?

i dont know what happen in background when i use TriggerRegisterUnitInRange, this is why i dont know if faster: a peridic check with 0.05 OR this TriggerRegisterUnitInRange is faster?

(if it important then the action is same but each specific unit got a specific building and if they go close then will be hided, its mean here must check more than 1-2 unit)
 
Status
Not open for further replies.
Top