kibbelz Posted April 4, 2011 Author Share Posted April 4, 2011 Hey, This is just a conversion of the chest attribute system from [ES]. Most of you know what it does already. It it is a chest attribute for the map editor and when you press enter on it (like items on the ground) it picks it up. But chests can only be opened once. So this stops players picking up a special prize from a cave or somethingĀ ;)Anyway lets start with the **Client side**Form work:The only form work you will need here is to add an option button called "OptChest" to frmeditor_mapDouble click on OptChest and add:```Private Sub OptChest_Click()Ā Ā ClearAttributeDialogueĀ Ā picAttributes.Visible = TrueĀ Ā fraMapItem.Visible = TrueĀ Ā scrlMapItem.Max = MAX_ITEMSĀ Ā scrlMapItem.Value = 1Ā Ā lblMapItem.Caption = Trim$(Item(scrlMapItem.Value).Name) & " x" & scrlMapItemValue.ValueĀ Ā EditorMap_BltMapItemEnd Sub```Now for the code:In modConstants find:```Public Const TILE_TYPE_SLIDE As Byte = 14```And add under:```Public Const TILE_TYPE_CHEST As Byte = 15```Then, in modgameeditors Find:```Ā Ā Ā Ā ' slideĀ Ā Ā Ā Ā Ā Ā Ā If frmEditor_Map.optSlide.Value ThenĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Type = TILE_TYPE_SLIDEĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data1 = MapEditorSlideDirĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data2 = 0Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data3 = 0Ā Ā Ā Ā Ā Ā Ā Ā End If```And underneath add:```Ā Ā Ā Ā Ā Ā Ā Ā 'ChestĀ Ā Ā Ā Ā Ā Ā Ā If frmEditor_Map.OptChest.Value ThenĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Type = TILE_TYPE_CHESTĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data1 = ItemEditorNumĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data2 = ItemEditorValueĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā .Data3 = 0Ā Ā Ā Ā Ā Ā Ā Ā End If```Next, in modtext Find:```Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Case TILE_TYPE_SLIDEĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)```and then add underneath:```Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Case TILE_TYPE_CHESTĀ Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā Ā DrawText TexthDC, tX, tY, "C", QBColor(Brown)```Thats it for client side!Now for **Server Side**In ModConstants find:```Public Const TILE_TYPE_SLIDE As Byte = 14```And after that add:```Public Const TILE_TYPE_CHEST As Byte = 15```Next in ModHandleData find: Sub HandleMapGetItem And replace the entire sub with:```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)Ā Ā Ā Ā Ā Ā ' Fixed by Yami, the main issue here was that he was simply assigning the value the chest should give, not adding it to the existing value.Ā Ā Ā Ā Ā Ā 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 IfEnd Sub ```Be sure to add a new folder in your Server\Data folder called Chests, this is where the INI files will be stored!-Added the fixed sub and removed his personal bullcrap INI commands. Guys, GetVar does NOT error on empty values unless you screw it over sideways. Currencies will now properly stack, instead of being replaced.-Yami Link to comment Share on other sites More sharing options...
damian666 Posted April 4, 2011 Share Posted April 4, 2011 the usage of inifiles is very much outdated man, why not make it a rec like the playerrec, and store the info there?top that with a clientside editor, and your good to go.Nice conversion though ^^Dami*edit for spelling Link to comment Share on other sites More sharing options...
kibbelz Posted April 5, 2011 Author Share Posted April 5, 2011 This is only the basic stuff. I could make it into a rec easily but the person who asked me to make this wanted it in a .ini file. If you want youĀ can edit it i don't care. Anyway glad you like it! Link to comment Share on other sites More sharing options...
shadowwulf Posted April 5, 2011 Share Posted April 5, 2011 the nice thing about INI or dat files is the info is saved when server is restarted.I believe the recs are reset. Link to comment Share on other sites More sharing options...
Robin Posted April 5, 2011 Share Posted April 5, 2011 Anyone talking about recs like that is misusing the term and is simply talking about UDT dumping in to binary. Link to comment Share on other sites More sharing options...
WatTheWaffles... Posted April 11, 2011 Share Posted April 11, 2011 Hey it works good for me. Link to comment Share on other sites More sharing options...
Link Posted April 11, 2011 Share Posted April 11, 2011 Nice release kibbz, I would say you should release the source for making animation in EO but that's entirely your choice, just a suggestion as to I know you're a great coder and all. Link to comment Share on other sites More sharing options...
Death Knight Posted April 12, 2011 Share Posted April 12, 2011 Nice job with this one. I have seen this in a lot of eclipse games before, I have just never seen it in a tutorial. Link to comment Share on other sites More sharing options...
Carim123 Posted April 14, 2011 Share Posted April 14, 2011 @Tousen:> Nice release kibbz, I would say you should release the source for making animation in EO but that's entirely your choice, just a suggestion as to I know you're a great coder and all.Go leech elsewhere.Anyway, nice source :D Link to comment Share on other sites More sharing options...
kibbelz Posted June 7, 2011 Author Share Posted June 7, 2011 @Hamster:> Go leech elsewhere.> > Anyway, nice source :D*off topic* I love that quote <3\. Anyway thanks for the comments guys ^^ Link to comment Share on other sites More sharing options...
Ansonla Posted June 24, 2011 Share Posted June 24, 2011 code didn't work. i tried placing the attribute but it don't work. Link to comment Share on other sites More sharing options...
kibbelz Posted June 24, 2011 Author Share Posted June 24, 2011 You must have missed somthing out. It works for me and everyone else. Link to comment Share on other sites More sharing options...
BugSICK Posted June 25, 2011 Share Posted June 25, 2011 this is a stupid questionkibbelz i have a chest sprite [close and the open one] how should i use it? Link to comment Share on other sites More sharing options...
kibbelz Posted June 25, 2011 Author Share Posted June 25, 2011 hmm well at the moment all this does is give you the item once. It doesn't make the chest open and close etc. So just do a closed chest for now untill i or someone else can be botherd to ad opening and closing chests. Link to comment Share on other sites More sharing options...
BugSICK Posted June 25, 2011 Share Posted June 25, 2011 @kibbelz:> hmm well at the moment all this does is give you the item once. It doesn't make the chest open and close etc. So just do a closed chest for now untill i or someone else can be botherd to ad opening and closing chests.ahh ok thanks, i will add this on my game. Link to comment Share on other sites More sharing options...
MrKris Posted June 25, 2011 Share Posted June 25, 2011 Looks pretty cool. Nice job on this. Link to comment Share on other sites More sharing options...
BeCoolHero Posted July 4, 2011 Share Posted July 4, 2011 Ehi guys. I have a problem, i can't see behind Slide Botton .. the Chest bottom why? I'm using VB6 Portable.. :\ someone can help me? Link to comment Share on other sites More sharing options...
RaiKalGames Posted July 4, 2011 Share Posted July 4, 2011 what do you mean behind the slide button you just have to make a button under the slide button in your map editor using the tool box Link to comment Share on other sites More sharing options...
BeCoolHero Posted July 4, 2011 Share Posted July 4, 2011 I can't see the Chest buttonĀ :(http://i56.tinypic.com/2i6idtx.pngEDIT: In Vb there is the button :huh: Link to comment Share on other sites More sharing options...
erkro1 Posted July 4, 2011 Share Posted July 4, 2011 @Be:> I can't see the Chest buttonĀ :(> > http://i56.tinypic.com/2i6idtx.png> Form work:> The only form work you will need here is to add an option button called "OptChest" to frmeditor_map Link to comment Share on other sites More sharing options...
BeCoolHero Posted July 4, 2011 Share Posted July 4, 2011 Yes.. The optChest there is in the VB.. Why isn't in the game? Link to comment Share on other sites More sharing options...
RaiKalGames Posted July 4, 2011 Share Posted July 4, 2011 @Raiko.:> what do you mean behind the slide button you just have to make a button under the slide button in your map editor using the tool boxLike i say you have to add it to the frm Map Editor using the vb6 tool box and check if your button visible = true Link to comment Share on other sites More sharing options...
BeCoolHero Posted July 4, 2011 Share Posted July 4, 2011 http://i52.tinypic.com/2dvivrt.pngLook this Screen.. is right? Link to comment Share on other sites More sharing options...
RaiKalGames Posted July 4, 2011 Share Posted July 4, 2011 yes and in name be shure to say OptChest Link to comment Share on other sites More sharing options...
BeCoolHero Posted July 4, 2011 Share Posted July 4, 2011 Ok but in the game there isn't that buttonĀ :mad: Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now