• 🏆 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!

[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