Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EO] Shop Improvements


Matt
 Share

Recommended Posts

> Of course, ignore the crippled man.
>
> Just kidding, but I still wait for a usefull reply. ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)
>
> Thank you

I apologize for answering so late. Does the cmd exist and is it properly named?
Link to comment
Share on other sites

  • 1 year later...
I'm having an issue where, whenever a user requests the price of an item by left-clicking on it, the chat message displays one of the blank fields as well as the price.

For example, if I have it set up so that one Bronze Ingot costs 100 Gold, the chat message will say "You can buy this item for 100 Gold and 1"

It also does this in the shop editor, when it displays the trades.

However, if I fill all four of the "Price" item slots, then I don't have this issue, which leads me to believe that it's just displaying the next field instead of cutting it off.

Any clues on how to solve this?

Edit: All items are unbuyable as well, due to this. (It wants the player to have the None item on them)

Second Edit: For the time being, I have reverted the changes made by this tutorial. Running debug on the client revealed that the issue was with the .CostItem2 and .CostValue2 (and so forth), but I didn't continue after that.
Link to comment
Share on other sites

> Keep in mind that this edit assumes there are always two costs!

Stupid me back then went the lazy way and wrote the tutorial in a way that assumes there's always two costs. It wouldn't be too difficult to fix though. I apologize.

```

frmEditor_Shop.lstTradeItem.AddItem i & ": " & .ItemValue & "x " & Trim$(Item(.Item).Name) & " for " & .CostValue & "x " & Trim$(Item(.CostItem).Name) & " and " & .CostValue2 & "x " & Trim$(Item(.CostItem2).Name)

```
This is the line that's causing trouble. All you'd have to do is make a simple check to see how many item costs there are. I might just re-do the tutorial, seeing as I know of a better way to accomplish this entire system. Sit tight!
Link to comment
Share on other sites

> Stupid me back then went the lazy way and wrote the tutorial in a way that assumes there's always two costs. It wouldn't be too difficult to fix though. I apologize.
>
> ```
>
> frmEditor_Shop.lstTradeItem.AddItem i & ": " & .ItemValue & "x " & Trim$(Item(.Item).Name) & " for " & .CostValue & "x " & Trim$(Item(.CostItem).Name) & " and " & .CostValue2 & "x " & Trim$(Item(.CostItem2).Name)
>
> ```
> This is the line that's causing trouble. All you'd have to do is make a simple check to see how many item costs there are. I might just re-do the tutorial, seeing as I know of a better way to accomplish this entire system. Sit tight!

Alright, thank you so much!
Link to comment
Share on other sites

Alright, I think I'm done. I made the tutorial while I was coding, and the result went well. There's still a small chance I missed something, but I'll be happy to fix it. The tutorial will make your shop system support multiple shop item costs, as well as free items in the shop. I also added a nice bit of code that makes developing shops a bit easier.
Link to comment
Share on other sites

I just made all the changes, and there seems to be no issue! I'll let you know if I notice anything amiss.

(Also, while it isn't that important, is there any way to get the shop cost text to use commas and "and"?)

Edit: Alright, I found an issue. The shop editor seems to carry over the previous price to the next item slot.

[http://i.imgur.com/2sVOD2X.png](http://i.imgur.com/2sVOD2X.png)

All the prices are correct (display as 10 Gold and cost 10 Gold) in the shops, just not the editor.
Link to comment
Share on other sites

I'll look into it. Give me a moment!

EDIT: Found it, and fixed it, and updated the tutorial.

Replace

```

For i = 1 To MAX_TRADES
With Shop(EditorIndex).TradeItem(i)
' if none, show as none
If .Item = 0 Then
Text = "Empty Trade Slot"
CostText = vbNullString
Else
Text = i & ": " & .ItemValue & "x " & Trim$(Item(.Item).Name) & " for "
For x = 1 To MAX_SHOP_ITEM_COSTS
If .CostItem(x) > 0 Then
CostText = CostText & .CostValue(x) & "x " & Trim$(Item(.CostItem(x)).Name)
End If
Next
if CostText = vbNullString Then CostText = " free"
End If
End With
frmEditor_Shop.lstTradeItem.AddItem Text & CostText
Next

```
with

```

For i = 1 To MAX_TRADES
CostText = vbNullString
With Shop(EditorIndex).TradeItem(i)
' if none, show as none
If .Item = 0 Then
Text = "Empty Trade Slot"
Else
Text = i & ": " & .ItemValue & "x " & Trim$(Item(.Item).Name) & " for"
For x = 1 To MAX_SHOP_ITEM_COSTS
If .CostItem(x) > 0 Then
CostText = CostText & " " & .CostValue(x) & "x " & Trim$(Item(.CostItem(x)).Name)
End If
Next
If CostText = vbNullString Then CostText = " free"
End If
End With
frmEditor_Shop.lstTradeItem.AddItem Text & CostText
Next

```
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...