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

[Trigger] Weapon Pickup.

Status
Not open for further replies.
Level 4
Joined
Nov 17, 2015
Messages
91
Can someone optimize this weapon pickup script?
(make it so it isn't one right handed weapon per player, but rather per unit?)

(When a unit picks up a right handed weapon, HasWeaponRight = True)
  • Has Right Weapon
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Katana
          • (Item-type of (Item being manipulated)) Equal to Training Sword
    • Actions
      • Wait 0.10 seconds
      • Set HasWeaponRight[(Player number of (Triggering player))] = True
(Dropping right hand weapon sets HasWeaponRight = False)
  • Doesnt have Right Weapon
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Katana
          • (Item-type of (Item being manipulated)) Equal to Training Sword
    • Actions
      • Wait 0.10 seconds
      • Set HasWeaponRight[(Player number of (Triggering player))] = False
(If you try to pick up a right handed weapon and HasWeaponRight = True, it will not be picked up, because you already have something in that hand.)
  • Prevent Pickup Right
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • HasWeaponRight[(Player number of (Triggering player))] Equal to True
    • Actions
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Game - Display to (All players controlled by a ((Owner of (Triggering unit)) controller) player) the text: You already have a ...
 
Status
Not open for further replies.
Top