Thread: Item help
View Single Post
Old 10-10-2006, 09:39 PM   #3
aidan_124
User
 
Join Date: Oct 2006
Posts: 47

aidan_124 has little to show at this moment (1)

Default

so like this?:
Trigger:
Clutch of The Undercity
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Clutch of the Undercity (item)
Collapse Actions
Unit - Move (Target unit of ability being cast) instantly to (Center of (Playable map area))

I'm also trying to use JASS. This is a trigger i wrote using JASS for a different ability. Can you check what i'm doing works and it does what i want it to?
Collapse JASS:

endfunctionfunction Trig_Dimir_Machinations_Conditions takes nothing returns boolean
      if ( not ( GetSpellAbilityId() == 'A00M' ) ) then
          return false
      endif
      returntrue
//** Checks that correct ability is used.
endfunction

Function Trig_Dimir_Machinations_Actions takes nothing returns nothing
    set bj_forLoopAIndex = 1
    set bj_forLoopAIndexEnd = 2
//** Sets effect to loop twice
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        call UnitRemoveItemFromSlotSwapped( GetRandomInt(1, 6), null )
//** Removes an Item from a unit (not decided on a variable yet) in a random slot 1-6
        call RemoveItem( GetLastRemovedItem() )
//** Removes the dropped item from the game
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction
//===========================================================================
function InitTrig_Dimir_Machinations takes nothing returns nothing
    set gg_trg_Dimir_Machinations = CreateTrigger(  )
//** Creates the Trigger (at initialization) with the name "gg_trg_Dimir_Machinations"
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Dimir_Machinations, EVENT_PLAYER_UNIT_SPELL_CAST )
//** Triggeres the ability whenever someone casts a spell
    call TriggerAddCondition( gg_trg_Dimir_Machinations, Condition( function Trig_Dimir_Machinations_Conditions ) )
//** Causes the trigger to use the above condition   
    call TriggerAddAction( gg_trg_Dimir_Machinations, function Trig_Dimir_Machinations_Actions )
//** Causes the trigger to use the above actions
endfunction

Thanks
aidan_124 is offline   Reply With Quote