Thread: Item help
View Single Post
Old 10-10-2006, 11:07 PM   #5
Join Date: Oct 2006
Posts: 47

aidan_124 has little to show at this moment (1)


Could i use this as that part of the trigger then? (again check i'm using the right commands etc.):
Collapse JASS:
function Trig_help_with_jass_Func001 takes nothing returns boolean
    return ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true )
//** Checks every to unit to see if its a hero

function Trig_help_with_jass_Func001A takes nothing returns nothing
    if ( Trig_help_with_jass_Func001() ) then
        set udg_Player_Hero[GetForLoopIndexB()] = GetEnumUnit()
//** If the condition was correct then it sets variable Player_Hero to that //** unit

function Trig_help_with_jass_Actions takes nothing returns nothing
    call ForGroupBJ( GetUnitsOfPlayerAll(ConvertedPlayer(GetForLoopIndexB())), function Trig_help_with_jass_Func001A )
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 2
//** Loops twice
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call UnitRemoveItemFromSlotSwapped( GetRandomInt(1, 6), udg_Player_Hero[GetConvertedPlayerId(GetOwningPlayer(GetSpellTargetUnit()))] )
//** removes an item from a random slot 1-6 from the Player_Hero with
//** Player number equal to the owner of triggering unit
        call RemoveItem( GetLastRemovedItem() )
        set bj_forLoopAIndex = bj_forLoopAIndex + 1

function InitTrig_help_with_jass takes nothing returns nothing
    set gg_trg_help_with_jass = CreateTrigger(  )
    call TriggerAddAction( gg_trg_help_with_jass, function Trig_help_with_jass_Actions )

Or is there an easier way to do it. Also if I use the new trigger-->custom text as a place to write my code in the trigger editor (not using GUI obv) do I need to declare the variables I use, or can I use the variable editor?
Can I set the variables in a different trigger and still use them is this trigger?
aidan_124 is offline   Reply With Quote