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

Replacing GetUnitsSelectedAll inside condition?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Is there any way to replace: GetUnitsSelectedAll(player) so that it can be used inside a condition scope? Currently it terminates the thread.

JASS:
scope BugTest initializer Init
  
    private function OnRun takes nothing returns nothing
        local group g
        call BJDebugMsg("Here we are")
        set g = GetUnitsSelectedAll(GetTriggerPlayer())  
        call BJDebugMsg("Here we are not")                    // unreachable
    endfunction
    private function Init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "-run", true )
        call TriggerAddCondition(t, Condition(function OnRun))
    endfunction
endscope


Edit: Solved!

JASS:
scope BugTest initializer Init 
    globals 
        group g = CreateGroup()
    endglobals
   
    private function OnRun takes nothing returns boolean 
        call GroupEnumUnitsSelected(g, GetTriggerPlayer(), null)   
        return false
    endfunction
    private function Init takes nothing returns nothing 
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t, Player(0), "-run", true )
        call TriggerAddCondition(t, Condition(function OnRun))
    endfunction
endscope
 
Last edited:
Status
Not open for further replies.
Top