HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hey How do i do this in jass.

07-18-2009, 11:28 AM#1
PotatoPeeler
Trigger:
Untitled Trigger 001
Events
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units within 1000.00 of ((Position of Colony Citadel 0000 <gen>) offset by (0.00, 0.00))) and do (Actions)
Collapse Loop - Actions
Unit - Change ownership of (Picked unit) to (Owner of (Triggering unit)) and Change color

Hey I was wondering how to do that in JASS cos when i convert it to custom text it splits into two actions which I don't know how to get around yet hahaha.

EDIT: Offsets are only 0, 0 becausei plan on changing it when it's in jass form. excuse informality of this post as im not how you say 'sober'
07-18-2009, 11:46 AM#2
Kwah
Answered in chat.

Collapse JASS:
loop
    set u = FirstOfGroup( yourGroup )
    exitwhen u == null
    <youractions>
    call GroupRemoveUnit( yourGroup, u )
endloop
07-18-2009, 11:53 AM#3
PotatoPeeler
Collapse JASS:
scope Colonization

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00K'
endfunction

private function Actions takes nothing returns nothing
    local IslandData dat = IslandCount[GetUnitId(GetTriggerUnit())] 
    call GroupEnumUnitsInRange(ENUM_GROUP ,GetUnitX(gg_unit_htow_0000)+1536.03 * I2R(dat.SelectedX),GetUnitY(gg_unit_htow_0000)+1536.03 * I2R(dat.SelectedX),1000) 
    
    loop 
        set u = FirstOfGroup( ENUM_GROUP ) 
        exitwhen u == null 
        call SetUnitOwner( u, GetOwningPlayer(GetTriggerUnit()), true )
        call GroupRemoveUnit( ENUM_GROUP, u ) 
    endloop 
endfunction

//////////////////////////////////////////////////////
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_FINISH)
    call TriggerAddCondition(t, Filter(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction
endscope
07-18-2009, 01:24 PM#4
Blubb-Tec
Quote:
Originally Posted by PotatoPeeler
Collapse JASS:
scope Colonization

private function Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A00K'
endfunction

private function Actions takes nothing returns nothing
    local IslandData dat = IslandCount[GetUnitId(GetTriggerUnit())] 
    call GroupEnumUnitsInRange(ENUM_GROUP ,GetUnitX(gg_unit_htow_0000)+1536.03 * I2R(dat.SelectedX),GetUnitY(gg_unit_htow_0000)+1536.03 * I2R(dat.SelectedX),1000) 
    
    loop 
        set u = FirstOfGroup( ENUM_GROUP ) 
        exitwhen u == null 
        call SetUnitOwner( u, GetOwningPlayer(GetTriggerUnit()), true )
        call GroupRemoveUnit( ENUM_GROUP, u ) 
    endloop 
endfunction

//////////////////////////////////////////////////////
public function InitTrig takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_FINISH)
    call TriggerAddCondition(t, Filter(function Conditions))
    call TriggerAddAction(t, function Actions)
endfunction
endscope

since i can't see any wait in your actions part, you might as well merge your actions block into your conditions block, saves one function call at init, and a little speed at runtime. But main reason i'm telling this to you is that you're not doing it already ~