Help With This Trigger!

comparami

New Member
Reaction score
4
is there such an event or a way to detect when a player moves an item from any of his inventory slots, to another inventory slot?

lets say, i have Gloves of Haste in inventory slot 1, and i decide to move it to inventory slot 2, is there a possible event in which it detects this action?

i'm currently trying to make a "-ii" command found in DotA in which the multiboard shows the inventory slots of your allies, and each item carried in each specified slot, i've done all of that using periodic events.. but it ends up lagging.. dropping the fps to 59 or 58.. every second..

here's the trigger:

Trigger:
  • Update Inventory List
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempPlayerGroup = (All players)
      • -------- EVERY PLAYER'S MULTIBOARD --------
      • Player Group - Pick every player in TempPlayerGroup and do (Actions)
        • Loop - Actions
          • -------- EACH INVENTORY SLOT CHECK --------
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • -------- ITEM TYPE IN INVENTORY SLOT (INTEGER A) CHECK --------
              • For each (Integer B) from 1 to Item_TypeCount, do (Actions)
                • Loop - Actions
                  • -------- ASSIGN ITEM CARRIED IN INVENTORY SLOT (INTEGER A) --------
                  • Set Item_Carried = (Item-type of (Item carried by Player_Hero[(Player number of (Picked player))] in slot (Integer A)))
                  • -------- IF ITEM CARRIED = ITEM TYPE (INTEGER B) --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Item_Carried Equal to Item_Type[(Integer B)]
                    • Then - Actions
                      • -------- DISPLAYS ITEM ICON PATH --------
                      • Multiboard - Set the icon for MB[(Player number of (Picked player))] item in column ((Integer A) + 6), row ((Player number of (Picked player)) + 2) to Item_TypeIconPath[(Integer B)]
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • (Item carried by Player_Hero[(Player number of (Picked player))] in slot (Integer A)) Equal to No item
                        • Then - Actions
                          • -------- IF NO ITEM IN INVENTORY SLOT (INTEGER A).... DISPLAY DEFAULT ICON --------
                          • Multiboard - Set the icon for MB[(Player number of (Picked player))] item in column ((Integer A) + 6), row ((Player number of (Picked player)) + 2) to ReplaceableTextures\CommandButtonsDisabled\DISundead-inventory-slotfiller.blp
                        • Else - Actions


please anybody? is there a way around this? in which it doesnt lag? :confused:
 

tommerbob

Minecraft. :D
Reaction score
110
First of all, you probably don't need a periodic of one second if all you're doing is updating a multiboard to display items of players. A 5 second or even a 10 second periodic is probably plenty fast.

Also, it lags because player groups cause memory leaks. At the end of your trigger you want to put in this custom script:

Code:
custom script: call DestroyForce(udg_TempPlayerGroup)
 

vypur85

Hibernate
Reaction score
803
> is there a possible event in which it detects this action?

Yeah.

Code:
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_order = GetIssuedOrderId()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                order Equal to 852002
            Then - Actions
                -[I]This will be item in slot 1[/I]-
            Else - Actions

Code:
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_order = GetIssuedOrderId()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                order Equal to 852003
            Then - Actions
                -[I]This will be item in slot 2[/I]-
            Else - Actions

Etc (between order ID of 852002 to 852007)... Use this to get some inspiration.
 

comparami

New Member
Reaction score
4
First of all, you probably don't need a periodic of one second if all you're doing is updating a multiboard to display items of players. A 5 second or even a 10 second periodic is probably plenty fast.

Also, it lags because player groups cause memory leaks. At the end of your trigger you want to put in this custom script:

Code:
custom script: call DestroyForce(udg_TempPlayerGroup)

after adding the "custom script: call DestroyForce(udg_TempPlayerGroup)" below.. the icons will only display once.. its like the player group TempPlayerGroup will never work..


> is there a possible event in which it detects this action?

Yeah.

Code:
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_order = GetIssuedOrderId()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                order Equal to 852002
            Then - Actions
                -[I]This will be item in slot 1[/I]-
            Else - Actions

Code:
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
    Actions
        Custom script:   set udg_order = GetIssuedOrderId()
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                order Equal to 852003
            Then - Actions
                -[I]This will be item in slot 2[/I]-
            Else - Actions

Etc (between order ID of 852002 to 852007)... Use this to get some inspiration.

okay.. i tried using it, the icons displayed.. no lag, but.. something's wrong.. lets say i have an item Gloves of Haste in inventory slot 1, after moving it to inventory slot 2, the multiboard still displays that it's in inventory slot 1, then after moving the gloves of haste to slot 3, the multiboard shows its in slot 2.. there is a delay in the display.. weird..
 

tommerbob

Minecraft. :D
Reaction score
110
after adding the "custom script: call DestroyForce(udg_TempPlayerGroup)" below.. the icons will only display once.. its like the player group TempPlayerGroup will never work..

Probably because you put it in the wrong place in your trigger, and TempPlayerGroup is still trying to be referenced.
 

tommerbob

Minecraft. :D
Reaction score
110
Post the trigger as you have it now. You can use
Trigger:
  • tags if you want, but personally I think its easier to read with
    • <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code">
      • <div class="bbCodeBlock-title">
        • Code:
      • </div>
      • <div class="bbCodeBlock-content" dir="ltr">
        • <pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang=""><code> tags.</code></pre>
      • </div>
    • </div>
 

comparami

New Member
Reaction score
4
Code:
Update Inventory List
    Events
        Time - Every 1.00 seconds of game time
    Conditions
    Actions
        Set TempPlayerGroup = (All players)
        -------- EVERY PLAYER'S MULTIBOARD --------
        Player Group - Pick every player in TempPlayerGroup and do (Actions)
            Loop - Actions
                -------- EACH INVENTORY SLOT CHECK --------
                For each (Integer A) from 1 to 6, do (Actions)
                    Loop - Actions
                        -------- ITEM TYPE IN INVENTORY SLOT (INTEGER A) CHECK --------
                        For each (Integer B) from 1 to Item_TypeCount, do (Actions)
                            Loop - Actions
                                -------- ASSIGN ITEM CARRIED IN INVENTORY SLOT (INTEGER A) --------
                                Set Item_Carried = (Item-type of (Item carried by Player_Hero[(Player number of (Picked player))] in slot (Integer A)))
                                -------- IF ITEM CARRIED = ITEM TYPE (INTEGER B) --------
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        Item_Carried Equal to Item_Type[(Integer B)]
                                    Then - Actions
                                        -------- DISPLAYS ITEM ICON PATH --------
                                        Multiboard - Set the icon for MB[(Player number of (Picked player))] item in column ((Integer A) + 6), row ((Player number of (Picked player)) + 2) to Item_TypeIconPath[(Integer B)]
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Item carried by Player_Hero[(Player number of (Picked player))] in slot (Integer A)) Equal to No item
                                            Then - Actions
                                                -------- IF NO ITEM IN INVENTORY SLOT (INTEGER A).... DISPLAY DEFAULT ICON --------
                                                Multiboard - Set the icon for MB[(Player number of (Picked player))] item in column ((Integer A) + 6), row ((Player number of (Picked player)) + 2) to ReplaceableTextures\CommandButtonsDisabled\DISundead-inventory-slotfiller.blp
                                            Else - Actions
Custom script:   call DestroyForce(udg_TempPlayerGroup)
 

vypur85

Hibernate
Reaction score
803
=.= Seriously, if it lags because of 'leaks' in this trigger then nobody will ever play WC3 again.

It probably lags because there are 3 loops stacking together. I'm not too sure if the changing icon function lags the performance or not, though. Haven't tried before.

Edit: Oh and yeah, it depends on the value of 'Item_TypeCount'. Not such a good idea to have it a huge number, considering the number of loop stacks.

On a related note, All players do not leak. Do not attempt to destroy it, in any way possible.
 
General chit-chat
Help Users
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • 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 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