[General] Weird Vendor problem

Status
Not open for further replies.
Level 9
Joined
Feb 20, 2014
Messages
409
Hi, I will try to explain quickly :

In my map my vendor sells items but they dissapear.
what could the problem be?

If someone wants it I can upload the map.

Here is the trigger,maybe it failed here :

  • Evenements
    • Unit - A unit Vendre un objet (du magasin)
  • Conditions
    • (Item-type of (Sold Item)) Egal to Wind boots lvl1
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • Si - Conditions
        • (Owner of (Buying unit)) Egal to Joueur 1 (Rouge)
        • stoneP1 Superieur ou egal to 2
      • Alors - Actions
        • Son - Play sounditemblacksmith <gen> at 100.00% volume, attached to (Triggering unit)
        • Set stoneP1 = (stoneP1 - 2)
        • Multitable - Set the text for (Last created multiboard) item in column 2, row 3 to (String(stoneP1))
      • Sinon - Actions
        • Heros - Drop (Sold Item) from Myhero[1]
        • Wait 0.01 seconds
        • Objet - Remove (Sold Item)
(Because they are several vendor (same unit type) I have to precise the Player buyer)
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
You can use If/Then/Else statements instead of multiple triggers with different conditions. Does the item have a stock replenish interval in the OE? What’s is maximum in stock?

Do you mean the sold item never appears or the item disappears from the shop stock?
 
Level 9
Joined
Feb 20, 2014
Messages
409
You can use If/Then/Else statements instead of multiple triggers with different conditions. Does the item have a stock replenish interval in the OE? What’s is maximum in stock?

Do you mean the sold item never appears or the item disappears from the shop stock?

It takes my gold so the item is sold but it dissapear. I don't even see it in my inventory. nothing happens
 
Level 14
Joined
Nov 17, 2010
Messages
1,266
It looks like it is acting like you don't meet the requirements and so it is using the "else' function where it drops the item and removes it.

I'm not sure why that would happen if you are using the right player, you have enough of stoneP1 and you are trying to buy the boots
 
Level 9
Joined
Feb 20, 2014
Messages
409
It looks like it is acting like you don't meet the requirements and so it is using the "else' function where it drops the item and removes it.

I'm not sure why that would happen if you are using the right player, you have enough of stoneP1 and you are trying to buy the boots
If you want I can send you the map.
-Yes I don't understand cause it takes my "stone" and play the sound so this part works.
I don't understand why the item is still removed.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Alors j'ai découvert le problem... mais tu ne l'aimeras pas. (Thought I'd flex my french muscles, it's been years and that was harder than it should have been.) The issue is that a lot of your triggers dealing with items have this same sort of basic structure:
  • Events
    • Unit - A unit sells an item (from shop)
  • Conditions
    • -------- there may be conditions here that are ultimately 'true' when the trigger is fired --------
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • -------- there are conditions here of which one or more is ultimately 'false' when the trigger is fired --------
      • Then - Actions
        • -------- something happens --------
      • Else - Actions
        • Item - Remove (Sold Item)
The problem is that the conditions are going to fail so the else actions will be performed... removing the item. Even if the item wasn't even supposed to be relevant to the trigger that removed it. You have a number of triggers that work in this way, and you will have to correct the error in each of them. To prove that this is the case, you can get item purchasing to work properly for player 1 only if you disable all triggers in the categories Items buy with minerals lvl 1 P2 and Upgrade BlackSmith P1. You will have to fix all such triggers to get item purchasing to work for all players.

A general note: the way you have structured your triggers is extremely inefficient. There's no need to have (literally) 20*2*4 = 160 different triggers for upgrading a single item (up to 20 times, to be fair) in the Horadric Cube. You can use If statements and variables to easily do different things depending on what upgrade level a player is at, which player triggered the event, which item was bought, etc. This will save you massive amounts of time in the future trying to debug why something isn't working properly. Also if you have 20 different versions of the same trigger that's 20 different triggers you could mess something up in or make a small error with.
 
Level 9
Joined
Feb 20, 2014
Messages
409
Alors j'ai découvert le problem... mais tu ne l'aimeras pas. (Thought I'd flex my french muscles, it's been years and that was harder than it should have been.) The issue is that a lot of your triggers dealing with items have this same sort of basic structure:
  • Events
    • Unit - A unit sells an item (from shop)
  • Conditions
    • -------- there may be conditions here that are ultimately 'true' when the trigger is fired --------
  • Actions
    • If (All conditions are true) then do (Then actions) else do (Else actions)
      • If - Conditions
        • -------- there are conditions here of which one or more is ultimately 'false' when the trigger is fired --------
      • Then - Actions
        • -------- something happens --------
      • Else - Actions
        • Item - Remove (Sold Item)
The problem is that the conditions are going to fail so the else actions will be performed... removing the item. Even if the item wasn't even supposed to be relevant to the trigger that removed it. You have a number of triggers that work in this way, and you will have to correct the error in each of them. To prove that this is the case, you can get item purchasing to work properly for player 1 only if you disable all triggers in the categories Items buy with minerals lvl 1 P2 and Upgrade BlackSmith P1. You will have to fix all such triggers to get item purchasing to work for all players.

A general note: the way you have structured your triggers is extremely inefficient. There's no need to have (literally) 20*2*4 = 160 different triggers for upgrading a single item (up to 20 times, to be fair) in the Horadric Cube. You can use If statements and variables to easily do different things depending on what upgrade level a player is at, which player triggered the event, which item was bought, etc. This will save you massive amounts of time in the future trying to debug why something isn't working properly. Also if you have 20 different versions of the same trigger that's 20 different triggers you could mess something up in or make a small error with.

Well first thanks.
Then I don't see what I can change...
I mean the first condition about the sold item will always be true so I don't need to change it.
And I still have to check the owner of buying unit and the a mount of stone of owner of buying unit...
Don't understant how I could fix it.

What about putting all conditions in the "IF/Then/Else" ?
 
Level 1
Joined
Mar 4, 2017
Messages
6
upload_2019-3-30_22-15-8.png


you need to check this trigger ,the conditions of the actions will be false when you play as player 1
 
Level 1
Joined
Mar 4, 2017
Messages
6
Dude, you just told the OP literally exactly the same thing I already did except you only found one trigger that it affects instead of noticing there are entire categories of triggers that have the same error.
for me i totally agree you have provided best answer ,but may be hard to understand for him, he need to step by step he cant recieve so much imformation.
 
Level 1
Joined
Mar 4, 2017
Messages
6
here is my edition for you use integer array for stoneP, you can modify other variables(knowledge...) like this one
 

Attachments

  • Tropical Template 1.3.w3x
    3.3 MB · Views: 41
Status
Not open for further replies.
Top