• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Items - help!

Status
Not open for further replies.
Level 20
Joined
Aug 29, 2012
Messages
825
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: 15
Status
Not open for further replies.
Top