Weapon item handling goes terrible wrong

Kazuga

Let the game begin...
Reaction score
110
Ok so I'm creating an gladiator arena map, and in it your weapons will be attatched to your unit so each item represents each weapon. Now of course this means that you can't run around with two weapons in the same hand etc, that's why I need some sort of item handling system that makes you only able to have one weapon of it's own kind.

I have splited up the item weapons in campaign, permanent, purchasable and miscellaneous:
Permanent = Two handed melee weapons.
Purchasable = Bows.
Campaign = Left handed weapons or shields.
Miscellaneous = Right handed weapons or shields.

I have tried to create triggers that makes you drop all items your not supposed to be able to carry when you pick up a new item, but it doesn't work to 100%, the loop drops one unallowed item and then skips the rest.

I even tried to code the loop manually, step by step, but I got the same result. (Meaning the loop actually works but that something else is wrong.)

Here is the trigger used for Bows:
Trigger:
  • Pickup Bow
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Item-class of (Item being manipulated)) Equal to Purchasable
          • ((Triggering unit) is in PlayerHeroes) Equal to True
    • Actions
      • Game - Display to (All players) the text: 1
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Permanent
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Miscellaneous
            • Then - Actions
              • Hero - Drop the item from slot (Integer A) of (Triggering unit)
              • Wait 0.01 seconds
              • Game - Display to (All players) the text: 1.5
            • Else - Actions
      • Game - Display to (All players) the text: 2
      • For each (Integer B) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer B))) Equal to Purchasable
                  • (Item carried by (Triggering unit) in slot (Integer B)) Equal to (Item being manipulated)
            • Then - Actions
              • Game - Display to (All players) the text: 2.5
              • Unit Group - Remove (Triggering unit) from PlayerHeroes
              • Wait 0.10 seconds
              • Unit - Replace (Triggering unit) with a Gladiator Ranged using The old unit's relative life and mana
              • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
              • Set PlayerHero[(Player number of (Player((Player number of (Owner of (Triggering unit))))))] = (Last replaced unit)
              • Wait 0.10 seconds
              • Unit Group - Add PlayerHero[(Player number of (Owner of (Triggering unit)))] to PlayerHeroes
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Item-class of (Item carried by (Triggering unit) in slot (Integer B))) Equal to Purchasable
                      • (Item carried by (Triggering unit) in slot (Integer B)) Not equal to (Item being manipulated)
                • Then - Actions
                  • Game - Display to (All players) the text: 2.5
                  • Hero - Drop the item from slot (Integer B) of (Triggering unit)
                • Else - Actions
      • Game - Display to (All players) the text: 3


And here is one for Left Hand: (Two hand and right hand looks exactly the same.)
Trigger:
  • Pickup Left Hand
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Purchasable
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Permanent
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Miscellaneous
                  • And - All (Conditions) are true
                    • Conditions
                      • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
                      • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Hero - Drop the item from slot (Integer A) of (Triggering unit)
              • Wait 0.01 seconds
            • Else - Actions

The 0.01 wait actions were to prevent bugging, but it didn't work. Same result without them.
Does anyone here know what's wrong in the coding?
Help would be most appreciated. =)
 

Sgqvur

FullOfUltimateTruthsAndEt ernalPrinciples, i.e shi
Reaction score
62
In the second trigger Pickup Left Hand

Doesn't this droping every item?
Trigger:
  • Drop the item from slot (Integer A) of (Triggering unit)

slot 1 drop, slot 2 drop... is that correct?
 

Dest

New Member
Reaction score
26
Waiting seconds doesn't work in loops, sir. And I don't think it bugs, why don't you test without them?
 

Kazuga

Let the game begin...
Reaction score
110
It could be the Wait(0.10)
Nope, removed them and no difference.
In the second trigger Pickup Left Hand

Doesn't this droping every item?
Trigger:
  • Drop the item from slot (Integer A) of (Triggering unit)

slot 1 drop, slot 2 drop... is that correct?
No, only one item is dropped.

Waiting seconds doesn't work in loops, sir. And I don't think it bugs, why don't you test without them?
It does work in loops, however it can make them not MUI if you use global variables. Tested removing all the wait actions and got the same result.
 

Kazuga

Let the game begin...
Reaction score
110
Noone knows what's wrong? =/

Started working on a new solution, I store all of the weapon items in array variables, then I order the unit to drop all items that it's not supposed to be able to use in combination with the item it picks up. Though this will be a lot of work since I have to add every single weapon I create. =)
 

polo2005

Wana start playing LoL? http://tinyurl.com/369as27
Reaction score
97
here is the item drop trigger i used, maybe ont exactly what you wanted :O
Code:
Item Limit
    Events
        Unit - A unit Acquires an item
    Conditions
    Actions
        For each (Integer A) from 1 to 6, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-class of (Item being manipulated)) Equal to Permanent
                        (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Permanent
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-class of (Item being manipulated)) Equal to Artifact
                        (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Artifact
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop (Item being manipulated) from (Hero manipulating item)
                    Else - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Item-class of (Item being manipulated)) Equal to Purchasable
                        (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Purchasable
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Item - Set charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
                        Item - Remove (Item being manipulated)
                    Else - Actions
 

Yoshii

New Member
Reaction score
74
Trigger:
  • Pickup Left Hand
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Purchasable
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Permanent
                  • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Miscellaneous
                  • And - All (Conditions) are true
                    • Conditions
                      • (Item-class of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Campaign
                      • (Item carried by (Triggering unit) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Hero - Drop the item from slot (Integer A) of (Triggering unit)
              • Wait 0.01 seconds
            • Else - Actions
I personally dont think the wait is needed but thats up to you. I took this trigger as It caught my attention first.
Shoulnt it instead read And -All Conditions are true conditions if item carried in slot integer A is not equal to campaign then hero drop item from slot A since you want to drop everything but the item being manipulated.That "AND" condition part is the issue im pretty certain
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
a simple way is to divide the weapons in some valiable categories (bow[right-left hand to prevent bugs],sword L & R,etc...) and make when an item that belongs to [_bow_] variable to drop all sword type weapons and vice versa so don't bother making a 50 array trigger. I hope i helped you a little
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
ohohoh the weapon variable must be item group and then drop the item group not the item...
 

Kazuga

Let the game begin...
Reaction score
110
I personally dont think the wait is needed but thats up to you. I took this trigger as It caught my attention first.
Shoulnt it instead read And -All Conditions are true conditions if item carried in slot integer A is not equal to campaign then hero drop item from slot A since you want to drop everything but the item being manipulated.That "AND" condition part is the issue im pretty certain
I'm not using any waits in the triggers at the moment, if you read in the earlier posts you will see that I said that I got the same result with and without them.

It shouldn't matter if the condition checking if the item being manipulated equals to the current being in handled one, since it does not match up with the other types and it also has to match the other AND condition.

The problem with the trigger is that it drops 1 item, the item it drops is a correct one, randomly which of the other types. But there are somehow often 1 item left that it should not be able to wear while picking up this new item.

Edit:
Getting really tired at this. =/ Not even ordering the unit to drop every single item specifically that it's not supposed to be able to use works in some of the triggers... Once I pick up the bow he drops everything else, but it's the left+right hand that fools around... Would it ruin a lot of the gameplay fun if people were to pick up one item that serves as a two swords or one sword and one shield? What would you think if you were to play such a map?
 

Kazuga

Let the game begin...
Reaction score
110
Hmpf... I just thought of another way that's not even using loops, this system requires you to drop your weapon before trying to pick up a new one. (Unless they are dual wield able of course.) Using two booleans, one for the left hand one for the right hand, letting the bow and the two handed weapons take up both, I check weather the that hand is free to be used by the weapon I pick up or not.
___________________
Currently works for:
Bow
Two handed weapons
Buggs on:
One handed left
One handed right
___________________

Don't know why... (Conditions really isn't my thing, I always mess everything up no matter how simple it is...)

If you look at this image, you will see that the unit is carrying 3 things. Both a shield and a sword in it's right hand...
buggedweapons.png

I'm currently using these triggers:

Trigger:
  • Pickup Two Handed
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Permanent
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
              • WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffFF0000You can't...
        • Else - Actions
          • Set WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] = True
          • Set WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] = True


Trigger:
  • Pickup Bow
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Item-class of (Item being manipulated)) Equal to Purchasable
          • ((Triggering unit) is in PlayerHeroes) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
              • WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffFF0000You can't...
        • Else - Actions
          • Set WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] = True
          • Set WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] = True
          • Unit Group - Remove (Triggering unit) from PlayerHeroes
          • Unit - Replace (Triggering unit) with a Gladiator Ranged using The old unit's relative life and mana
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
          • Set PlayerHero[(Player number of (Player((Player number of (Owner of (Triggering unit))))))] = (Last replaced unit)
          • Unit Group - Add PlayerHero[(Player number of (Owner of (Triggering unit)))] to PlayerHeroes


Trigger:
  • Pickup Left Hand
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Campaign
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffFF0000You can't...
        • Else - Actions
          • Set WeaponLeftHandUsed[(Player number of (Owner of (Triggering unit)))] = True


Trigger:
  • Pickup Right Hand
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Miscellaneous
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: |cffFF0000You can't...
        • Else - Actions
          • Set WeaponRightHandUsed[(Player number of (Owner of (Triggering unit)))] = True


Anyone have any clue of what's going wrong? =/
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top