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

A Steal Ability

Status
Not open for further replies.
Level 9
Joined
Feb 3, 2006
Messages
326
[quote="MeanMachine" what do you mean by steal :?: I'll make you a trigger if you tell me what has to be stealed.[/quote]

well, you press a button, and he runs to the enemy, then a random number between 1 and 20, but thats where it stuffs up...just put your own items, ill checnge them when i put it in my campaign.
 
Level 3
Joined
Mar 2, 2006
Messages
40
Here's a nice way of stealing a random item from a unit's inventory:
-----------------------------------------------------
Variables(2) :
Steal_Target - Unit
Steal_Item - Item
Triggers(2)
Steal
Code:
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Steal 
    Actions
        Set Steal_Target = (Target unit of ability being cast)
        Trigger - Run GetItem <gen> (ignoring conditions)
        Wait until (Steal_Item Not equal to No item), checking every 0.10 seconds
        Hero - Give Steal_Item to (Casting unit)
-----
GetItem
Code:
    Events
    Conditions
    Actions
        Set Steal_Item = (Item carried by Steal_Target in slot (Random integer number between 1 and 6))
        If (Steal_Item Equal to No item) then do (Trigger - Run (This trigger) (ignoring conditions)) else do (Do nothing)
-----------------------------------------------------
Change the first trigger to add chance of getting an item.
 
Level 3
Joined
Mar 2, 2006
Messages
40
And if you want a random item drop:
-----------------------------------------------------
Variables(3):
Items - Item Type (Array)
Items_DropChance - Real
Items_Ammount - Integer
Triggers(2):
Random Item Drop Config
Code:
    Events
        Map initialization
    Conditions
    Actions
        Set Items_Ammount = 2
        Set Items_DropChance = 7.25
        Set Items[1] = Frostguard
        Set Items[2] = Searing Blade
Random Item Drop
Code:
    Events
        Unit - A unit Dies
    Conditions
    Actions
        If ((Random real number between 1.00 and 100.00) Less than or equal to Items_DropChance) then do (Item - Create Items[(Random integer number between 1 and Items_Ammount)] at (Position of (Dying unit))) else do (Do nothing)
Change the config trigger to add more items, change the drop chance and ammount of items. To add more items to the array:
set Items(3) = ????
set Items(4) = ????
etc.
Change the second trigger's events and add the conditions you want.
 
Status
Not open for further replies.
Top