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

[eo] Chest Attribute


kibbelz
 Share

Recommended Posts

  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Whoops, I see what I missed there.. I wrote the + portion in the middle of an array.

```
Sub HandleMapGetItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddR As Long, ByVal ExtraVar As Long)
    Dim b As Long

    If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_CHEST Then
        If Val(GetVar("data\chests\" & Trim(GetPlayerName(index)) & ".ini", "Chests_Map_" & Trim(STR(GetPlayerMap(index))), Trim(STR(GetPlayerX(index))) & "_" & Trim(STR(GetPlayerY(index))))) = 0 Then
            b = FindOpenInvSlot(index, Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1)
            Call PlayerMsg(index, "You opened the chest and found " & Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data2 & " " & Item(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1).Name, White)
            Call SetPlayerInvItemNum(index, b, Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1)
            Call SetPlayerInvItemValue(index, b, GetPlayerInvItemValue(index, b) + Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data2)
            Call PutVar("data\chests\" & Trim(GetPlayerName(index)) & ".ini", "Chests_Map_" & Trim(STR(GetPlayerMap(index))), Trim(STR(GetPlayerX(index))) & "_" & Trim(STR(GetPlayerY(index))), "1")
            Call SendInventoryUpdate(index, b)
        Else
            Call PlayerMsg(index, "You have already looted this chest!", BrightRed)
        End If
    Else
        Call PlayerMapGetItem(index)
    End If
End Sub
```
Try this instead.
Link to comment
Share on other sites

@Growlith1223:

> ok now it's saying Compile error: Expected variable or procedure, not project.
> and then it's highlighting
> Call SetPlayerInvItemValue(index, VB, GetPlayerInvItemValue(index, b) + Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Data2)

Same thing happened here. I just changed VB to b.
Link to comment
Share on other sites

I'm sorting out four or five things at once, and I was working with projects in another screen, so I blindly wrote down vb over there instead of b. :P

But if you can't figure that out, how on earth are you going to make your entire game?  :confused:
Link to comment
Share on other sites

Just make sure to make a new folder in Data\ called Chests so your chest data gets stored ;]

edit: Updated the original post with my new sub, and removed the useless INI commands. Seriously, GetVar does NOT error unless you're an idiot and screwed it over.
Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

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...