kibbelz Posted June 30, 2011 Author Share Posted June 30, 2011 I made this a few years back, I never use it so thats why i am releasing it for the eclipse comunity. What it does is as the topic says. it slashes through the grass and sometimes you can find items.Client Side:Form work:In frmeditor_map add a new option called "OptGrass" and on "fraMapItem" add a new checkbox called "ChkItem" and make its visible = false.Now double click on OptGrass and add in this code:``` 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_BltMapItem ChkItem.Visible = True```Also find this sub:Private Sub optItem_Click() and at the bottom of the sub add:```ChkItem.Visible = False```Now double click on ChkItem and add:```GItem = ChkItem.Value```Now at the bottom of ModGlobals add:```'used for grassPublic GItem As Long'Key/Grass TimerPublic kgtime As LongPublic kgx As LongPublic kgy As Long```Then find:``` ' slide If frmEditor_Map.optSlide.Value Then .Type = TILE_TYPE_SLIDE .Data1 = MapEditorSlideDir .Data2 = 0 .Data3 = 0 End If```Add underneath:``` 'grass If frmEditor_Map.OptGrass.Value Then .Type = TILE_TYPE_GRASS .Data1 = GItem .Data2 = ItemEditorNum .Data3 = ItemEditorValue End If```Then find:``` Case TILE_TYPE_SLIDE DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)```Add underneath:``` Case TILE_TYPE_GRASS DrawText TexthDC, tX, tY, "GS", QBColor(BrightGreen)```Then go into ModConstants and find:```Public Const TILE_TYPE_SLIDE As Byte = 14```Add underneath:```Public Const TILE_TYPE_GRASS As Byte = 15```Then into sub bltmaptile and replace it with:```Public Sub BltMapTile(ByVal x As Long, ByVal Y As Long)Dim rec As DxVBLib.RECTDim i As Long ' If debug mode, handle error then exit out If Options.Debug = 1 Then On Error GoTo errorhandler With Map.Tile(x, Y) For i = MapLayer.Ground To MapLayer.Mask2 'If the door or grass isnt open then draw tile If TempTile(x, Y).DoorOpen = NO Or 0 Then ' skip tile? If (.Layer(i).Tileset > 0 And .Layer(i).Tileset <= NumTileSets) And (.Layer(i).x > 0 Or .Layer(i).Y > 0) Then ' sort out rec rec.top = .Layer(i).Y * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = .Layer(i).x * PIC_X rec.Right = rec.Left + PIC_X ' render Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Tileset(.Layer(i).Tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If Else 'If Map layer ground or mask 2 still draw it If i = MapLayer.Mask2 Or MapLayer.Ground Then 'Skip tile If (.Layer(i).Tileset > 0 And .Layer(i).Tileset <= NumTileSets) And (.Layer(i).x > 0 Or .Layer(i).Y > 0) Then ' sort out rec rec.top = .Layer(i).Y * PIC_Y rec.Bottom = rec.top + PIC_Y rec.Left = .Layer(i).x * PIC_X rec.Right = rec.Left + PIC_X ' render Call Engine_BltFast(ConvertMapX(x * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Tileset(.Layer(i).Tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) Exit Sub End If End If kgx = x kgy = Y TempTile(x, Y).DoorTimer = GetTickCount End If Next End With ' Error handler Exit Suberrorhandler: HandleError "BltMapTile", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext Err.Clear Exit SubEnd Sub```Now go into modenumerations and add to the right place:```SGrass```Then into ModHandleData add in the right place:```HandleDataSub(SGrass) = GetAddress(AddressOf HandleGrass)```Then at the very bottom of ModHandleData add:```Private Sub HandleGrass(ByVal Index As Long, ByRef Data() As Byte, ByVal EditorIndex As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)Dim Buffer As clsBufferDim x As LongDim Y As LongDim v As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() x = Buffer.ReadLong Y = Buffer.ReadLong v = Buffer.ReadLong If v = 1 Then TempTile(x, Y).DoorOpen = YES Else TempTile(x, Y).DoorOpen = NO End If Set Buffer = NothingEnd Sub```Now to the server:In ModConstants find:```Public Const TILE_TYPE_SLIDE As Byte = 14```Add underneath:```Public Const TILE_TYPE_GRASS As Byte = 15```Then find Sub HandleAttack and just before it calls checkresource add:```CheckGrass Index, x, y```And then at the bottom of ModPlayer add:```Sub CheckGrass(ByVal Index As Long, ByVal x As Long, ByVal y As Long)Dim i As Long If Map(GetPlayerMap(Index)).Tile(x, y).Type = TILE_TYPE_GRASS Then If Map(GetPlayerMap(Index)).Tile(x, y).Data1 > 0 Then Call SpawnItem(Map(GetPlayerMap(Index)).Tile(x, y).Data2, Map(GetPlayerMap(Index)).Tile(x, y).Data3, GetPlayerMap(Index), x, y) End If Call SendAnimation(GetPlayerMap(Index), 1, x, y) TempTile(GetPlayerMap(Index)).DoorOpen(x, y) = NO TempTile(GetPlayerMap(Index)).DoorTimer = GetTickCount For i = 1 To MAX_PLAYERS If GetPlayerMap(i) = GetPlayerMap(Index) Then Call SendGrass(i, x, y, 1) End If Next End IfEnd Sub```Then at the bottom of ModServerTCP add:```Sub SendGrass(ByVal Index As Long, ByVal x As Long, ByVal y As Long, ByVal s As Long)Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong SGrass Buffer.WriteLong x Buffer.WriteLong y Buffer.WriteLong s SendDataTo Index, Buffer.ToArray() Set Buffer = NothingEnd Sub```And finally in Modenumerations add in the right place:```SGrass```I beive that is it, If i have missed anything out post.Note: The current cutting animation is 1 and the layer that becomes invisible is mask. Link to comment Share on other sites More sharing options...
Fragment Posted June 30, 2011 Share Posted June 30, 2011 Looks good, however, i dont see the reason you would use this over (instead of) the resource system as it does the same. unless i am missing something. Link to comment Share on other sites More sharing options...
kibbelz Posted June 30, 2011 Author Share Posted June 30, 2011 This does not go over the resource system. It just goes before the call. It runs both depending on the map attribute. Link to comment Share on other sites More sharing options...
shado360 Posted June 30, 2011 Share Posted June 30, 2011 I think he meant "instead of." Link to comment Share on other sites More sharing options...
kibbelz Posted June 30, 2011 Author Share Posted June 30, 2011 Well he can change it to the resource system idk. Just be happy with what you have :/ i made this like a year ago. Link to comment Share on other sites More sharing options...
Justn Posted July 12, 2011 Share Posted July 12, 2011 Is it possible to make it where a player can't walk on the grass until its cut or would that require a whole different kind of map attribute and nothing to do with this tutorial? Link to comment Share on other sites More sharing options...
viciousdead Posted July 12, 2011 Share Posted July 12, 2011 @Justn:> Is it possible to make it where a player can't walk on the grass until its cut or would that require a whole different kind of map attribute and nothing to do with this tutorial?Agreed with Justn, that would be a nice addition to this feature. /Personal OpinionAlso, I like this. (: Link to comment Share on other sites More sharing options...
adr990 Posted July 13, 2011 Share Posted July 13, 2011 Yes and it's very easy to do so. :PI suggest figuring this out yourself.Just look for a code in EO that makes the player block (already told to much eh) , and the rest should be easy enough to figure yourself also.Tutorials ain't make to just copy and paste and let others customize the code to your needs.Unless you think the code actually has a problem, you should do things like this yourself.Adr990Hint:You don't add another attribute for this, just change the code of kibbelz. Link to comment Share on other sites More sharing options...
Justn Posted July 13, 2011 Share Posted July 13, 2011 ok thanks for the help man I was just wondering if it was possible without messing up his code.. will work on it now =) Link to comment Share on other sites More sharing options...
Justn Posted July 13, 2011 Share Posted July 13, 2011 Ok I think I figured out the blocking thing but I'm confused about how I define the variable For ChkItem? Link to comment Share on other sites More sharing options...
SpiceyWolf Posted August 3, 2011 Share Posted August 3, 2011 how would i go about making this so if you cut the grass when its not there another item doesnt spawn? Link to comment Share on other sites More sharing options...
judoka Posted August 28, 2011 Share Posted August 28, 2011 Is there any possibility to send more than 3 datas to the server?``` 'grass If frmEditor_Map.OptGrass.Value Then .Type = TILE_TYPE_GRASS .Data1 = GItem .Data2 = ItemEditorNum .Data3 = ItemEditorValue End If```I wanna do that:``` 'grass If frmEditor_Map.OptGrass.Value Then .Type = TILE_TYPE_GRASS .Data1 = GItem .Data2 = ItemEditorNum .Data3 = ItemEditorValueMax .Data4 = ItemEditorValueMin End If```I tried to do that but… the map was wrong (the tiles went crazy).. Link to comment Share on other sites More sharing options...
Thunderbird Posted September 4, 2011 Share Posted September 4, 2011 Could someone confirm if this system works or not? (in EO 2.0) Link to comment Share on other sites More sharing options...
kibbelz Posted September 5, 2011 Author Share Posted September 5, 2011 it should. Link to comment Share on other sites More sharing options...
SpiceyWolf Posted September 5, 2011 Share Posted September 5, 2011 it does but u might as well use resource… it does the same thing and with this u can stand in front of it and keep cutting when nothing is there and it will still drop items Link to comment Share on other sites More sharing options...
kibbelz Posted September 6, 2011 Author Share Posted September 6, 2011 @SpiceyWolf:> it does but u might as well use resource… it does the same thing and with this u can stand in front of it and keep cutting when nothing is there and it will still drop itemsAs i said, i made this over a year ago and I know this code isn't very good. I will not fix any bugs you find and since you don't like it piss off, there is no point in you posting here and wasting my time.@SpiceyWolf:> uDon't write chat speak on forums, it is a foul language and it shows how crap your writing skills are. Link to comment Share on other sites More sharing options...
SpiceyWolf Posted September 10, 2011 Share Posted September 10, 2011 i wasnt waisting "your" time… i was telling someone about the bugs so if they dislike then ur not waisting THEIR time Link to comment Share on other sites More sharing options...
Ruins of Hell Posted September 10, 2011 Share Posted September 10, 2011 @kibbelz:> As i said, i made this over a year ago and I know this code isn't very good. I will not fix any bugs you find and since you don't like it piss off, there is no point in you posting here and wasting my time.If you're going to insult someone: get some basis. No point in trying to make people use something that has no value. If there are bugs, fix them. Don't yell at someone who simply points them out. 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