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.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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