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

[Solved] This doesn't work quite right

Status
Not open for further replies.
Level 22
Joined
Jul 25, 2009
Messages
3,091
The trigger below makes it so that once a gun is equipped, it cannot be unequipped, and if you try to equip a gun that isn't your currently equipped gun nothing happens... But here's how it works right now... When I equip a gun, the item becomes undroppable, but if I equip another gun while a gun is equipped, both will be undroppable.

So let me try and do my best simple explanation one last time. xD

Equip/unequip via casting item.

No weapon equipped -> equipped weapon -> equipped weapon is undroppable -> equipping future weapons will do nothing until current one is unequipped

  • Undroppable 2
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Saiga 12k
          • (Item-type of (Item being manipulated)) Equal to LPO-50
          • (Item-type of (Item being manipulated)) Equal to AK-47
          • (Item-type of (Item being manipulated)) Equal to Dragunov SVD
          • (Item-type of (Item being manipulated)) Equal to RPK
          • (Item-type of (Item being manipulated)) Equal to Laser Rifle
          • (Item-type of (Item being manipulated)) Equal to AKS-74u
          • (Item-type of (Item being manipulated)) Equal to VSS (Silenced)
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Sound - Play Pickup2 <gen>
      • Sound - Stop Pickup2 <gen> After fading
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponIsEquipped[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
          • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Undroppable
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item being manipulated) Equal to WeaponInUse[(Player number of (Owner of (Triggering unit)))]
              • WeaponIsEquipped[(Player number of (Owner of (Triggering unit)))] Equal to False
            • Then - Actions
              • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Droppable
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item being manipulated) Not equal to WeaponInUse[(Player number of (Owner of (Triggering unit)))]
        • Then - Actions
          • Item - Make (Item being manipulated) Droppable
        • Else - Actions
 
Level 9
Joined
Dec 12, 2007
Messages
489
add the set weaponisequpped to false?
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • WeaponIsEquipped[(Player number of (Owner of (Triggering unit)))] Equal to True
    • Then - Actions
      • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
      • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Undroppable
      • Set WeaponInEquipped[(Player number of (Owner of (Triggering unit)))] = False
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item being manipulated) Equal to WeaponInUse[(Player number of (Owner of (Triggering unit)))]
          • WeaponIsEquipped[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Droppable
        • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item being manipulated) Not equal to WeaponInUse[(Player number of (Owner of (Triggering unit)))]
    • Then - Actions
      • Item - Make (Item being manipulated) Droppable
    • Else - Actions
 
Level 12
Joined
Oct 16, 2010
Messages
680
weaponisequipped for player equals false - what is required at first. the second one doesn't needed

Also the last ITE block is unneeded


BTW if that pickup2 sound is specially for pickups then insert it in the ITE block so it only plays on "pick up"

But i also agree with Maker. you don't realy need that boolean, you can simply check if WeaponInUse stores any item

  • Undroppable 2
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Saiga 12k
          • (Item-type of (Item being manipulated)) Equal to LPO-50
          • (Item-type of (Item being manipulated)) Equal to AK-47
          • (Item-type of (Item being manipulated)) Equal to Dragunov SVD
          • (Item-type of (Item being manipulated)) Equal to RPK
          • (Item-type of (Item being manipulated)) Equal to Laser Rifle
          • (Item-type of (Item being manipulated)) Equal to AKS-74u
          • (Item-type of (Item being manipulated)) Equal to VSS (Silenced)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponInUse[(Player number of (Owner of (Triggering unit)))] Equal to No Item
        • Then - Actions
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Sound - Play Pickup2 <gen>
          • Sound - Stop Pickup2 <gen> After fading
          • Custom script: endif
          • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
          • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Undroppable
          • Else - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Item being manipulated) Equal to WeaponInUse[(Player number of (Owner of (Triggering unit)))]
              • Then - Actions
                • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Droppable
                • Set WeaponInUse[(Player number of (Owner of(Triggering unit)))] = No Item
              • Else - Actions
 
Last edited:
Level 22
Joined
Jul 25, 2009
Messages
3,091
Weapon is equipped Boolean changes in other triggers, triggers that check what ability is cast, so that it can be edited in ways that the Item is Used function doesn't allow. Also pickup is for picking up and dropping so it's fine where it is.

Let me try Maker's suggestion and yours... I think I already tried this and it didn't work, for a reason I can't recall, it's been a while since I edited it.

Didn't work.

  • Undroppable 2
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Saiga 12k
          • (Item-type of (Item being manipulated)) Equal to LPO-50
          • (Item-type of (Item being manipulated)) Equal to AK-47
          • (Item-type of (Item being manipulated)) Equal to Dragunov SVD
          • (Item-type of (Item being manipulated)) Equal to RPK
          • (Item-type of (Item being manipulated)) Equal to Laser Rifle
          • (Item-type of (Item being manipulated)) Equal to AKS-74u
          • (Item-type of (Item being manipulated)) Equal to VSS (Silenced)
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Sound - Play Pickup2 <gen>
      • Sound - Stop Pickup2 <gen> After fading
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponInUse[(Player number of (Owner of (Triggering unit)))] Equal to (Item being manipulated)
        • Then - Actions
          • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = No item
          • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Droppable
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WeaponInUse[(Player number of (Owner of (Triggering unit)))] Equal to No item
            • Then - Actions
              • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
              • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Undroppable
            • Else - Actions
 
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,240
I tested with a trigger like this:
  • Untitled Trigger 114
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • Game - Display to Player Group - Player 1 (Red) for 2.00 seconds the text: Use
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • it Equal to (Item being manipulated)
        • Then - Actions
          • Set it = No item
          • Item - Make (Item being manipulated) Droppable
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • it Equal to No item
            • Then - Actions
              • Set it = (Item being manipulated)
              • Item - Make (Item being manipulated) Undroppable
            • Else - Actions
which is basically the same as yours. It works for me, maybe I am not understandingthe way you want it to work.
 
Level 22
Joined
Jul 25, 2009
Messages
3,091
Nope. The boolean is no longer in use. So it has nothing to do with the other triggers. As of right now it works like this.

You equip a gun, it's undroppable, you unequip the same gun, it's still undroppable.

How it's supposed to work, you can only equip one gun at a time, and only the gun you equip becomes undroppable.

Edit: I think I may have just figured it out, I set WeaponInUse to No Item before I made it droppable. xD

Edit 2: Never mind it still doesn't work.

  • Undroppable 2
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Saiga 12k
          • (Item-type of (Item being manipulated)) Equal to LPO-50
          • (Item-type of (Item being manipulated)) Equal to AK-47
          • (Item-type of (Item being manipulated)) Equal to Dragunov SVD
          • (Item-type of (Item being manipulated)) Equal to RPK
          • (Item-type of (Item being manipulated)) Equal to Laser Rifle
          • (Item-type of (Item being manipulated)) Equal to AKS-74u
          • (Item-type of (Item being manipulated)) Equal to VSS (Silenced)
    • Actions
      • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
      • Sound - Play Pickup2 <gen>
      • Sound - Stop Pickup2 <gen> After fading
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponInUse[(Player number of (Owner of (Triggering unit)))] Equal to (Item being manipulated)
        • Then - Actions
          • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Droppable
          • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = No item
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • WeaponInUse[(Player number of (Owner of (Triggering unit)))] Equal to No item
            • Then - Actions
              • Item - Make WeaponInUse[(Player number of (Owner of (Triggering unit)))] Undroppable
              • Set WeaponInUse[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
            • Else - Actions
Whoops, Set Weapon In Use = Item Being Manipulated needs to come up. Lemme re test.
 
Last edited:
Level 22
Joined
Jul 25, 2009
Messages
3,091
I think you should be comparing item types instead of items.

  • if item type of (WeaponInUse[(Player number of (Owner of (Triggering unit)))]) Equal to item of type (Item being manipulated)

No. That would make every AK-47 in your inventory undroppable lol, instead of just the one you used.

Anyway I resolved this, it was simply a misplacement of the variables/undroppable/droppable triggs.
 
Status
Not open for further replies.
Top