• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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