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

Shop Folder Not Working

Status
Not open for further replies.
Level 2
Joined
Jun 24, 2018
Messages
13
I have a shop system set up on my map and created multiple "folders" which are actually shop based units, but the problem is one of the folders will not work. (The Recipes folder). Here is what I am using. Does this trigger not allow for more than two folders?

  • Green Store
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • -------- Recipes --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Recipes
        • Then - Actions
          • Set Temp_Point = (Position of (Selling unit))
          • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Recipes))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Selection - Select (Picked unit) for (Owner of (Buying unit))
          • Custom script: call DestroyGroup (udg_Temp_Group)
          • Custom script: call RemoveLocation (udg_Temp_Point)
          • -------- The Custom scripts are necessary to remove memory leaks. --------
        • Else - Actions
          • -------- Armor --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to Armor Items
            • Then - Actions
              • Set Temp_Point = (Position of (Selling unit))
              • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Armor Items))
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • Selection - Select (Picked unit) for (Owner of (Buying unit))
              • Custom script: call DestroyGroup (udg_Temp_Group)
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • -------- The Custom scripts are necessary to remove memory leaks. --------
            • Else - Actions
              • -------- Damage --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Sold Item)) Equal to Damage Items
                • Then - Actions
                  • Set Temp_Point = (Position of (Selling unit))
                  • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Damage Items))
                  • Unit Group - Pick every unit in Temp_Group and do (Actions)
                    • Loop - Actions
                      • Selection - Select (Picked unit) for (Owner of (Buying unit))
                  • Custom script: call DestroyGroup (udg_Temp_Group)
                  • Custom script: call RemoveLocation (udg_Temp_Point)
                  • -------- The Custom scripts are necessary to remove memory leaks. --------
                • Else - Actions
 
Level 2
Joined
Jun 24, 2018
Messages
13
Well, it all looks the same, so it should work. Try making debug messages and see what's working and what's not. Try to pin point the exact line, where it goes wrong.
How do I do this? Sorry kinda new to editor :/
 
Level 9
Joined
Jul 30, 2018
Messages
445
Do something like this:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Item-type of (Sold Item)) Equal to Recipes
    • Then - Actions
      • Game - Send to (All Players) a message: "Clicked Recipes"
      • Set Temp_Point = (Position of (Selling unit))
      • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Recipes))
      • Game - Send to (All Players) a message: "Units in Temp_Group: " + (Count unit in (Temp_Group)) //this is to check if the game even finds the unit you are supposed to pick
      • Unit Group - Pick every unit in Temp_Group and do (Actions)
        • Loop - Actions
          • Selection - Select (Picked unit) for (Owner of (Buying unit))
      • Custom script: call DestroyGroup (udg_Temp_Group)
      • Custom script: call RemoveLocation (udg_Temp_Point)
      • -------- The Custom scripts are necessary to remove memory leaks. --------
    • Else - Actions
      • -------- Armor --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Armor Items
        • Then - Actions
          • Game - Send to (All Players) a message: "Clicked Armor Items"
          • Set Temp_Point = (Position of (Selling unit))
          • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Armor Items))
          • Unit Group - Pick every unit in Temp_Group and do (Actions)
            • Loop - Actions
              • Selection - Select (Picked unit) for (Owner of (Buying unit))
          • Custom script: call DestroyGroup (udg_Temp_Group)
          • Custom script: call RemoveLocation (udg_Temp_Point)
          • -------- The Custom scripts are necessary to remove memory leaks. --------
        • Else - Actions
          • -------- Damage --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Sold Item)) Equal to Damage Items
            • Then - Actions
              • Game - Send to (All Players) a message: "Clicked Damage Items"
              • Set Temp_Point = (Position of (Selling unit))
              • Set Temp_Group = (Units within 512.00 of Temp_Point matching ((Unit-type of (Matching unit)) Equal to Damage Items))
              • Unit Group - Pick every unit in Temp_Group and do (Actions)
                • Loop - Actions
                  • Selection - Select (Picked unit) for (Owner of (Buying unit))
              • Custom script: call DestroyGroup (udg_Temp_Group)
              • Custom script: call RemoveLocation (udg_Temp_Point)
              • -------- The Custom scripts are necessary to remove memory leaks. --------
            • Else - Actions
And anything like this you can think of. That way you can investigate if all the results are what you expected them to be and you can check if the trigger even runs long enough.
 
Level 2
Joined
Jun 24, 2018
Messages
13
So I tested out all of the added triggers (Except 1 get to that in a sec) and they all showed the message in chat that the button was clicked. Now that we know that is there anything we can infer from it? Or was this a dead end?

The trigger that I did not add was:
game.gif
Game - Send to (All Players) a message: "Units in Temp_Group: " + (Count unit in (Temp_Group)) //this is to check if the game even finds the unit you are supposed to pick

I couldnt figure out how to get "Send Message" Instead of "Display Message'
 
Level 9
Joined
Jul 30, 2018
Messages
445
It is the Display Message. What I wrote was just from memory. Try to think for yourself. "Send a message" and "display message" basically mean the same thing, so just try out things. You computer is not going to explode if you make an error.
 
Level 8
Joined
May 21, 2019
Messages
435
I ran the recipe and armor sections through a diff checker and confirmed that they are identical except for the condition. So this trigger doesn't appear to be the issue.
This means that the only plausible reason is that it isn't finding the recipe shop for 1 reason or another. The thing that Sabe posted should help confirm that.
An alternative method to what you are doing is to store the shops in arrays based on the player number index, then you don't have to use groups to find them dynamically, but can instead just refer to them directly. It's not a good approach if you have multiple versions of this shop, but if you only have 1, then this trigger could run with just 1 action line per shop tab, and wouldn't need to create, process, and memory clean all of the associated objects.
 
Level 2
Joined
Jun 24, 2018
Messages
13
It is the Display Message. What I wrote was just from memory. Try to think for yourself. "Send a message" and "display message" basically mean the same thing, so just try out things. You computer is not going to explode if you make an error.

I was unsure if they were because of how technical triggers can be. Thank you for the clarification though. I would also like to add that I have never tried to create a trigger like this and am unaware of much of how editor works. Because of this I was unable to create the line that was earlier questioned:

Game - Display to (All players) the text: Units in Temp_Group +...

EDIT: I should be clear that I don't know how to get the formula part of the trigger

This website is here to assist people struggling with triggers such as myself. It is possible to ask a question/for clarification, and be thinking for yourself still. Though I do agree that I should have figured that out.


I ran the recipe and armor sections through a diff checker and confirmed that they are identical except for the condition. So this trigger doesn't appear to be the issue.
This means that the only plausible reason is that it isn't finding the recipe shop for 1 reason or another. The thing that Sabe posted should help confirm that.
An alternative method to what you are doing is to store the shops in arrays based on the player number index, then you don't have to use groups to find them dynamically, but can instead just refer to them directly. It's not a good approach if you have multiple versions of this shop, but if you only have 1, then this trigger could run with just 1 action line per shop tab, and wouldn't need to create, process, and memory clean all of the associated objects.

Would this work with multiple instances of this same shop though? I don't see why it wouldn't, but out of curiosity.
 
Last edited:
Level 2
Joined
Jun 24, 2018
Messages
13
I have been attempting to create the trigger that was mentioned and the closest I came up with is this


  • Game - Display to (All players) the text: (Load (Number of units in Temp_Group) of ((Number of units in Temp_Group) + 0) from (Last created hashtable))
Im sorry if this isnt what you meant. I am trying to create it without any experience of this kind of trigger.

EDIT: I came up with this?

  • Game - Display to (All players) the text: (Units in Temp_Group: + (String((Number of units in Temp_Group))))
 
Last edited:
Level 9
Joined
Jul 30, 2018
Messages
445
Yeah, just like I guessed. So, as you can see, the unit group Temp_Group is empty (there's 0 units), therefore it means that the trigger doesn't find your Recipes Shop. You know, they are different buildings so that they all sell different things (there's already three buildings, I guess: (probably) the main shop, then there's the Armor Item shop and Damage Item shop). Have you made the Recipe Shop and placed it near the other shops? You can't make more pages with only that trigger alone; it needs the actual building that sells the recipes.
 
Level 8
Joined
May 21, 2019
Messages
435
Would this work with multiple instances of this same shop though? I don't see why it wouldn't, but out of curiosity.
Yes, but you'd need an array for each instance of the shop.
This isn't anywhere near as development efficient as the dynamic system you're trying to create, but in terms of computation, it's lighter to execute, and it makes a decent amount of sense if you only have 1-2 shops. All things considered, if you could figure out why it isn't finding the recipe page, that's a more solid implementation if you plan on having multiple of these shops across the map.
 
Level 2
Joined
Jun 24, 2018
Messages
13
I AM SO SORRY FOR THE DELAY THANK YOU FOR ALL OF YOUR RESPONSES


Yeah, just like I guessed. So, as you can see, the unit group Temp_Group is empty (there's 0 units), therefore it means that the trigger doesn't find your Recipes Shop. You know, they are different buildings so that they all sell different things (there's already three buildings, I guess: (probably) the main shop, then there's the Armor Item shop and Damage Item shop). Have you made the Recipe Shop and placed it near the other shops? You can't make more pages with only that trigger alone; it needs the actual building that sells the recipes.

I have a tiny skinless building placed very close to the main shop to seem as if you are only shopping from one shop.
One tiny shop for Damage items, One for Armor Items, And finally one for Recipes. (Though if this method does work I hope to add more folders)



Yes, but you'd need an array for each instance of the shop.
This isn't anywhere near as development efficient as the dynamic system you're trying to create, but in terms of computation, it's lighter to execute, and it makes a decent amount of sense if you only have 1-2 shops. All things considered, if you could figure out why it isn't finding the recipe page, that's a more solid implementation if you plan on having multiple of these shops across the map.

That sounds like a great alternative! Thank you! The only issue is that I have no idea how to do that XD
So I'm going to attempt to see if this way works out first



Do the units have the locust ability by any chance?

Ummm... Not all the units? There may be one unit (Not the one I am using to test the shop) that has the ability or an ability based from it. Why do you ask?
 

Uncle

Warcraft Moderator
Level 63
Joined
Aug 10, 2018
Messages
6,457
I don't really understand the system. You should post your other Shop related triggers.

Also, if you have multiple triggers using the "A unit sells an Item from Shop" Event these could be interfering with one another. You should add a condition to differentiate between the different shops. Or maybe I'm just misunderstanding this.
 
Level 2
Joined
Jun 24, 2018
Messages
13
I apologize for the extensive delay of this response i had PC issues for awhile.


Well, if you are sure the shop is there and the trigger should find it, I don't think what else could be wrong. You have to post the map.
Im not too sure how that works but here is this download for the map download
The only triggers related to buying items I have is in merchant folder of the triggers
Fanmade DOTA 0.16b



I don't really understand the system. You should post your other Shop related triggers.

Also, if you have multiple triggers using the "A unit sells an Item from Shop" Event these could be interfering with one another. You should add a condition to differentiate between the different shops. Or maybe I'm just misunderstanding this.

There are'nt any other shop related triggers im pretty sure. Ill double check though
 
Status
Not open for further replies.
Top