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

Items - help!

Status
Not open for further replies.
Level 30
Joined
Aug 29, 2012
Messages
1,382
There are multiple ways to do it. Here's my approach using item classes and a boolean variable.

  • Acquire Item
    • Evénements
      • Unité - A unit Acquiert un objet
    • Conditions
      • (Item-class of (Item being manipulated)) Egal à Permanent
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • HeroHasItem[(Player number of (Owner of (Triggering unit)))] Egal à TRUE
        • Alors - Actions
          • Partie - Display to (Player group((Owner of (Triggering unit)))) for 5.00 seconds the text: You can only have 1...
          • Héros - Drop (Item being manipulated) from (Triggering unit)
        • Sinon - Actions
          • Set HeroHasItem[(Player number of (Owner of (Triggering unit)))] = TRUE
  • Drop Item
    • Evénements
      • Unité - A unit Perd un objet
    • Conditions
      • (Item-class of (Item being manipulated)) Egal à Permanent
    • Actions
      • Set HeroHasItem[(Player number of (Owner of (Triggering unit)))] = FALSE
Basically, when a hero acquires an item of class Permanent (these classes are already built in the item editor, you can use whichever you want), I use a boolean variable to check what to do:
- If it returns false, the hero gets the item and the variable turns to true
- If it returns true, the item is dropped and a message tells the player they can't use more than 1 weapon (optional)

This will only work if you have 1 hero per player, though, but that's the gist of it.

I attached an example map.
 

Attachments

  • TestItems.w3x
    18 KB · Views: 20
Status
Not open for further replies.
Top