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

tslusny

Members
  • Posts

    1878
  • Joined

  • Last visited

    Never

Everything posted by tslusny

  1. omg you cant just look at that code?? Use GetPlayerX and GetPlayerY look at mouse movement tutorial ( not that one with 4 triangles) and look how its getting player position
  2. Look to Sub Render_Graphics Here find ``` ' draw player names ```There is some codes for getting x,y
  3. Or you can just copy paste Block attribute and add when is enabled and when not (you must add that finished variable to quest data) I cant explain this now becouse im not on my pc so i dont have acces to source
  4. Try to implement this to quest system and add check to where it says checkdirection = true example If Quest(QuestNum).Finished = True then CheckDirection = True Else CheckDirection = False Its just example not real
  5. You mean this? ``` If MapOwner = 0 Then If FindHouse(HMapNum) Then Call PlayerMsg(index, "This house is already sold", White) Else ``` Its in Sub SendInitManager
  6. Nice :D I like that Crosshair :P
  7. Nice graphics (i like that sprites :cheesy:) and i like ur Wallpaper :P
  8. :DD But + 1 for Effort :cheesy:
  9. @John: > Here is the original tutorial: http://www.touchofdeathforums.com/smf2/index.php/topic,70502.560.html > took me some time to find it xD This is link for Alatars Quest System, i think original house system post is deleted already
  10. Ok tutorial finished :DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
  11. Yea of course i can :D Give me few minutes :D I cant find original post so i must redo tutorial
  12. Yea why is this in tutorial section? :cheesy: :P
  13. CS:DE Have DX8 graphic but if u dont know vb6 very good choose EO 2.0, EO 1.0 is old, dont use it
  14. Ok i fixed Alatars House System, i finnaly added tutorial ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons//biggrin.png) Default key for open house editor is: DELETE Default key for house teleport is: HOME Download this: [Download from Mediafire](http://www.mediafire.com/?530ip9wrd91ucpe) TUTORIAL SERVER SIDE modConstants Find: ``` Public Const MAP_MORAL_SAFE As Byte = 1 ``` Add: ``` Public Const MAP_MORAL_HOUSE As Byte = 2 ``` Find: ``` Public Const TILE_TYPE_SLIDE As Byte = 14 ``` Add: ``` Public Const TILE_TYPE_SIGN As Byte = 15 Public Const TILE_TYPE_THRESHOLD As Byte = 16 ``` Find: ``` Public Const NPC_BEHAVIOUR_GUARD As Byte = 4 ``` Add: ``` Public Const NPC_BEHAVIOUR_MANAGER As Byte = 5 ``` modDatabase Find: ``` Player(Index).Vital(Vitals.MP) = GetPlayerMaxVital(Index, Vitals.MP) ``` Add: ``` PutVar App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(Index).Name, 0 ``` modGameLogic Find: ``` If IsSpell Then ``` Replace with: ``` If IsSpell Then If Npc(NpcNum).Behaviour NPC_BEHAVIOUR_FRIENDLY And Npc(NpcNum).Behaviour NPC_BEHAVIOUR_SHOPKEEPER And Npc(NpcNum).Behaviour NPC_BEHAVIOUR_MANAGER Then CanAttackNpc = True Exit Function End If End If ``` Find: ``` Case DIR_RIGHT NpcX = MapNpc(MapNum).Npc(MapNpcNum).x - 1 NpcY = MapNpc(MapNum).Npc(MapNpcNum).y End Select ``` Below, replace the if sentence with this: ``` If NpcX = GetPlayerX(Attacker) Then If NpcY = GetPlayerY(Attacker) Then If Npc(NpcNum).Behaviour NPC_BEHAVIOUR_FRIENDLY And Npc(NpcNum).Behaviour NPC_BEHAVIOUR_SHOPKEEPER And Npc(NpcNum).Behaviour NPC_BEHAVIOUR_MANAGER Then 'House Editor CanPlayerAttackNpc = True Else 'House Editor If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_MANAGER Then Call SendInitManager(Attacker, CInt(GetVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(Attacker).Name)), Npc(NpcNum).HMapNum, Npc(NpcNum).HBuy, Npc(NpcNum).HSell) End If '/House Editor If Len(Trim$(Npc(NpcNum).AttackSay)) > 0 Then PlayerMsg Attacker, Trim$(Npc(NpcNum).Name) & ": " & Trim$(Npc(NpcNum).AttackSay), White End If End If End If End If ``` modHandleData At bottom of Sub InitMessages add: ``` HandleDataSub(CRequestEditHouse) = GetAddress(AddressOf HandleRequestEditHouse) HandleDataSub(CHouseManager) = GetAddress(AddressOf HandleHouseManager) HandleDataSub(CCheckGold) = GetAddress(AddressOf HandleCheckGold) HandleDataSub(CWarpToHouse) = GetAddress(AddressOf HandleWarpToHouse) ``` In Sub HandleWarpMeTo find: ``` If GetPlayerAccess(Index) < ADMIN_MAPPER Then Exit Sub End If ``` Replace it with this: ``` '[House Editor] If Not GetOwner(Index) = True Then If GetPlayerAccess(Index) < ADMIN_MAPPER Then Exit Sub End If End If '[/House Editor] ``` Find: ``` Map(MapNum).Tile(x, y).DirBlock = Buffer.ReadByte ``` Add: ``` Map(MapNum).Tile(x, y).Data4 = Buffer.ReadString 'House Editor ``` At botom of ModHandleData add: ``` 'Deathbeam - Alatar House system fix Sub HandleRequestEditHouse(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim Owner As Long Owner = GetVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(index).Name) Set Buffer = New clsBuffer Buffer.WriteLong SEditHouse Buffer.WriteLong Owner SendDataTo index, Buffer.ToArray() Set Buffer = Nothing End Sub Sub HandleHouseManager(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim HType As String Dim HMapNum As Long Dim HGold As Long Dim i As Long Dim GoldItemNum As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() HType = Buffer.ReadString HMapNum = Buffer.ReadLong HGold = Buffer.ReadLong Set Buffer = Nothing GoldItemNum = 1 'This works as the HOUSE_GOLD on server Select Case HType Case "Buy" If CheckGold(index, GoldItemNum, HGold) = True Then Call PutVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(index).Name, "" & HMapNum) Call AddHouse(HMapNum) TakeInvItem index, GoldItemNum, HGold Else HType = "Gold" End If Case "Sell" Call PutVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(index).Name, 0) Call DeleteHouse(HMapNum) GiveInvItem index, GoldItemNum, HGold End Select Set Buffer = New clsBuffer Buffer.WriteLong SSendHouse Buffer.WriteString HType Buffer.WriteLong HMapNum SendDataTo index, Buffer.ToArray() Set Buffer = Nothing End Sub Sub HandleCheckGold(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim GoldItemNum As Long Dim GoldAmount As Long Dim HCancel As Long Dim i As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() GoldItemNum = Buffer.ReadLong GoldAmount = Buffer.ReadLong HCancel = Buffer.ReadLong Set Buffer = Nothing If Not HCancel = 1 Then If CheckGold(index, GoldItemNum, GoldAmount) = True Then TakeInvItem index, GoldItemNum, GoldAmount Set Buffer = New clsBuffer Buffer.WriteLong SGoldChecked SendDataTo index, Buffer.ToArray() Set Buffer = Nothing Else PlayerMsg index, "Not enought gold", BrightRed End If Else GiveInvItem index, GoldItemNum, GoldAmount End If End Sub Sub HandleWarpToHouse(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim House As Long House = GetVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(index).Name) If House = 0 Then If GetPlayerAccess(index) < ADMIN_MAPPER Then Exit Sub End If ElseIf House < 0 Or House > MAX_MAPS Then Exit Sub End If Call PlayerWarp(index, House, GetPlayerX(index), GetPlayerY(index)) Call PlayerMsg(index, "You have been warped to your house.", BrightBlue) Call AddLog(GetPlayerName(index) & " warped to map #" & House & ", his/her house.", ADMIN_LOG) End Sub 'Deathbeam - Alatar House system fix ``` ModServerTCP Find: ``` Buffer.WriteByte .DirBlock ``` Add: ``` Buffer.WriteString .Data4 'House Editor ``` At bottom of ModServerTCP add: ``` 'Deathbeam - Alatar House system fix Sub SendInitManager(ByVal index As Long, ByVal MapOwner As Long, ByVal HMapNum As Long, ByVal HBuy As Long, ByVal HSell As Long) Dim Buffer As clsBuffer Dim HType As String Dim HGold As Long If MapOwner = 0 Then If FindHouse(HMapNum) Then Call PlayerMsg(index, "This house is already sold", White) Else HType = "Buy" HGold = HBuy End If Else If MapOwner = HMapNum Then HType = "Sell" HGold = HSell Else HType = "Nothing" HGold = 0 End If End If Set Buffer = New clsBuffer Buffer.WriteLong SInitManager Buffer.WriteLong HMapNum Buffer.WriteString HType Buffer.WriteLong HGold SendDataTo index, Buffer.ToArray() Set Buffer = Nothing End Sub 'Deathbeam - Alatar House system fix ``` ModTypes: Find type TileRec and add at bottom of it: ``` Data4 As String 'House Editor ``` Find Type NpcRec and add at bottom of it: ``` HMapNum As Long HBuy As Long HSell As Long ``` Find type ResourceRec and add at bottom of it: ``` Spot As Byte ``` modServerLoop In UpdateMapLogic, find the if cause below this: ``` ' Check to see if its time for the npc to walk ``` And replace it with: ``` If Npc(NpcNum).Behaviour NPC_BEHAVIOUR_SHOPKEEPER And Npc(NpcNum).Behaviour NPC_BEHAVIOUR_MANAGER Then 'House Editor ``` modEnumerations Find: ``` ' Make sure SMSG_COUNT is below everything else ``` Add above it: ``` 'House Editor: SEditHouse SInitManager SSendHouse SGoldChecked ``` Find: ``` ' Make sure CMSG_COUNT is below everything else ``` Add above it: ``` 'House Editor: CRequestEditHouse CHouseManager CCheckGold CWarpToHouse ``` Find: ``` Enum MapLayer ``` And add above Layer_Count: ``` Roof 'House Editor ``` modPlayer Find: ``` If .Type = TILE_TYPE_SLIDE Then ForcePlayerMove index, MOVING_WALKING, .Data1 Moved = YES End If ``` Add below it: ``` 'House Editor If .Type = TILE_TYPE_HOUSESIGN Then PlayerMsg index, "[Sign Reads]: " & .Data4, Yellow End If '/House Editor ``` Add at bottom of ModPlayer: ``` 'House Editor Function CheckGold(ByVal index As Long, ByVal GoldItemNum As Long, ByVal GoldAmount As Long) As Boolean Dim i As Long For i = 1 To MAX_INV If GetPlayerInvItemNum(index, i) = GoldItemNum Then If Item(GoldItemNum).Type = ITEM_TYPE_CURRENCY Then If GoldAmount MAX_PLAYERS Then Exit Function If GetVar(App.Path & "\data\accounts\houses.ini", "OPTIONS", "" & Player(index).Name) = GetPlayerMap(index) Then GetOwner = True End If End Function '/House Editor ``` ModDatabase Add this at bottom of ModDatabase: ``` 'Deathbeam - Alatar House system fix Sub DeleteHouse(ByVal HMapNum As Long) Dim f1 As Long Dim f2 As Long Dim s As String Call FileCopy(App.Path & "\data\accounts\houses.txt", App.Path & "\data\accounts\housestemp.txt") ' Destroy house from houses f1 = FreeFile Open App.Path & "\data\accounts\housestemp.txt" For Input As #f1 f2 = FreeFile Open App.Path & "\data\accounts\houses.txt" For Output As #f2 Do While Not EOF(f1) Input #f1, s If s HMapNum Then Print #f2, s End If Loop Close #f1 Close #f2 Call Kill(App.Path & "\data\accounts\housestemp.txt") End Sub Sub AddHouse(ByVal HMapNum As Long) Dim F As Long F = FreeFile Open App.Path & "\data\accounts\houses.txt" For Append As #F Print #F, HMapNum Close #F End Sub Function FindHouse(ByVal HMapNum As Long) As Boolean Dim F As Long Dim s As String F = FreeFile Open App.Path & "\data\accounts\houses.txt" For Input As #F Do While Not EOF(F) Input #F, s If s = HMapNum Then FindHouse = True Close #F Exit Function End If Loop Close #F End Function 'Deathbeam - Alatar House system fix ``` CLIENT SIDE In Private Sub picScreen_MouseDown find: ``` If InMapEditor Then Call MapEditorMouseDown(Button, x, y, False) Else ``` Replace it with this: ``` If InMapEditor Then '[House Editor] If InHouseEditor = True Then Call HouseEditorMouseDown(Button, X, Y, False) Exit Sub End If '[/House Editor] Call MapEditorMouseDown(Button, X, Y, False) Else ``` In the sub: picScreen_MouseMove find: ``` If InMapEditor Then frmEditor_Map.shpLoc.Visible = False If Button = vbLeftButton Or Button = vbRightButton Then Call MapEditorMouseDown(Button, x, y) End If End If ``` Replace it with this: ``` If InMapEditor Then '[House Editor] If InHouseEditor = True Then frmEditor_House.shpLoc.visible = False If Button = vbLeftButton Or Button = vbRightButton Then Call HouseEditorMouseDown(Button, X, Y) End If picItemDesc.visible = False Exit Sub End If '[/House Editor] frmEditor_Map.shpLoc.visible = False If Button = vbLeftButton Or Button = vbRightButton Then Call MapEditorMouseDown(Button, X, Y) End If End If ``` Find: ``` Case vbKeyInsert ``` Add this below it: ``` Case vbKeyDelete 'Deathbeam - Alatar House system fix SendRequestEditHouse Case vbKeyHome If Map.Moral = 1 Then WarpToHouse End If 'Deathbeam - Alatar House system fix ``` At bottom of frmMain add: ``` Private Sub lblHouseOk_Click() Call SendHouseManager(lblHouseAsk.Tag, CInt(picHouse.Tag), CInt(lblHouseOk.Tag)) End Sub Private Sub lblHouseCancel_Click() picHouse.visible = False lblHouseCancel = "Decline" End Sub Private Sub lblHouseGoTo_Click() picHouse.visible = False WarpToHouse End Sub '[/House Editor] ``` FrmEditor_Npc Find this: ``` NPC(EditorIndex).Behaviour = cmbBehaviour.ListIndex ``` Add this below it: ``` 'House Editor If (cmbBehaviour.ListIndex = NPC_BEHAVIOUR_MANAGER) Then fraHouse.visible = True Else fraHouse.visible = False End If '/House Editor ``` In Form Load, add: ``` scrlHouseMapNumber.Max = MAX_MAPS 'House Editor ``` At bottom of frmEditor_NPC add: ``` '/ALATAR 'House Editor Private Sub scrlHouseMapNumber_Change() lblHouseMapNumber = "Map Number: " & scrlHouseMapNumber.Value NPC(EditorIndex).HMapNum = scrlHouseMapNumber.Value End Sub Private Sub scrlHouseBuy_Change() lblHouseBuy = "House Buy: " & scrlHouseBuy.Value NPC(EditorIndex).HBuy = scrlHouseBuy.Value End Sub Private Sub scrlHouseSell_Change() lblHouseSell = "House Sell: " & scrlHouseSell.Value NPC(EditorIndex).HSell = scrlHouseSell.Value End Sub '/House Editor ``` ModClientTCP Find: ``` Buffer.WriteByte .DirBlock ``` Add: ``` Buffer.WriteString .Data4 ``` At bottom of ModClientTcp add this: ``` 'Deathbeam - Alatar House system fix Public Sub SendRequestEditHouse() Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CRequestEditHouse SendData Buffer.ToArray() Set Buffer = Nothing End Sub Public Sub SendHouseManager(ByVal HType As String, ByVal HMapNum As Long, ByVal HGold As Long) 'ByVal HBuy As Long, ByVal HSell As Long) Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CHouseManager Buffer.WriteString HType Buffer.WriteLong HMapNum Buffer.WriteLong HGold SendData Buffer.ToArray() Set Buffer = Nothing End Sub Public Sub SendCheckGold(ByVal GoldItemNum As Long, ByVal GoldAmount As Long, Optional HCancel As Long) Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CCheckGold Buffer.WriteLong GoldItemNum Buffer.WriteLong GoldAmount Buffer.WriteLong HCancel SendData Buffer.ToArray() Set Buffer = Nothing End Sub Public Sub WarpToHouse() Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CWarpToHouse SendData Buffer.ToArray() Set Buffer = Nothing End Sub 'Deathbeam - Alatar House system fix ``` modConstants Find this: ``` ' ******************************************************** ' * The values below must match with the server's values * ' ******************************************************** ``` Add this above: ``` 'House Editor Normal Constants Public Const HOUSE_TILESET As Integer = 3 Public Const HOUSE_MAX_X As Byte = 30 Public Const HOUSE_MAX_Y As Byte = 30 Public Const HOUSE_MUSIC As String = "\Data Files\music\" 'House Editor Attribute Constants Public Const HOUSE_GOLD As Long = 1 Public Const HOUSE_ATTR_B As Integer = 2 Public Const HOUSE_ATTR_B_UNDO As Integer = 1 Public Const HOUSE_ATTR_S As Integer = 2 Public Const HOUSE_ATTR_S_UNDO As Integer = 1 Public Const HOUSE_ATTR_U As Integer = 3 Public Const HOUSE_ATTR_U_UNDO As Integer = 1 Public Const HOUSE_ATTR_R As Integer = 400 Public Const HOUSE_ATTR_R_UNDO As Integer = 40 ``` Find: ``` Public Const MAP_MORAL_SAFE As Byte = 1 ``` Add: ``` Public Const MAP_MORAL_HOUSE As Byte = 2 'House Editor ``` Find: ``` Public Const TILE_TYPE_SLIDE As Byte = 14 ``` Add: ``` 'House Editor Public Const TILE_TYPE_SIGN As Byte = 15 Public Const TILE_TYPE_THRESHOLD As Byte = 16 ``` Find: ``` Public Const NPC_BEHAVIOUR_GUARD As Byte = 4 ``` Add: ``` Public Const NPC_BEHAVIOUR_MANAGER As Byte = 5 'House Editor ``` modGlobals Add this at the bottom: ``` 'House Editor Public InHouseEditor As Boolean Public HouseSign As String Public Threshold As Boolean Public SpotNum As Long ``` modGameEditors In NPCEditorInit find: ``` .txtEXP.text = Npc(EditorIndex).EXP ``` Add: ``` 'House Editor: .scrlHouseMapNumber.Value = Npc(EditorIndex).HMapNum .scrlHouseBuy.Value = Npc(EditorIndex).HBuy .scrlHouseSell.Value = Npc(EditorIndex).HSell ``` In ResourceEditorInit find: ``` frmEditor_Resource.scrlAnimation.Value = Resource(EditorIndex).Animation ``` Add this: ``` frmEditor_Resource.chkSpot.Value = Resource(EditorIndex).Spot 'House Editor ``` At bottom of ModGameEditors add this: ``` ' ////////////////// ' // House Editor // ' ////////////////// Public Sub HouseEditorInit() Dim i As Long InMapEditor = True frmEditor_House.Visible = True frmEditor_House.Caption = "House Editor - '" & Trim$(Map.Name) & "'" InHouseEditor = True Call InitDDSurf("misc", DDSD_Misc, DDS_Misc) Call EditorHouse_BltTileset frmEditor_House.scrlPictureY.Max = (frmEditor_House.picBackSelect.height \ PIC_Y) - (frmEditor_House.picBack.height \ PIC_Y) frmEditor_House.scrlPictureX.Max = (frmEditor_House.picBackSelect.width \ PIC_X) - (frmEditor_House.picBack.width \ PIC_X) If frmEditor_House.fMusic.Path App.Path & HOUSE_MUSIC Then frmEditor_House.fMusic.Path = App.Path & HOUSE_MUSIC With frmEditor_House .cmdSend.Enabled = True .cmdCancel.Enabled = True .txtName.text = Trim$(Map.Name) If .fMusic.ListIndex >= 0 Then .fMusic.ListIndex = 0 For i = 1 To .fMusic.ListIndex If .fMusic.List(i) = Trim$(Map.Music) Then .fMusic.ListIndex = i End If Next End If If Trim$(Map.Music) = vbNullString Then .chkMusic.Value = 1 End With End Sub Public Sub HouseEditorSetTile(ByVal X As Long, ByVal Y As Long, ByVal CurLayer As Long, Optional ByVal multitile As Boolean = False) Dim x2 As Long, y2 As Long If Not multitile Then With Map.Tile(X, Y) .Layer(CurLayer).X = EditorTileX .Layer(CurLayer).Y = EditorTileY .Layer(CurLayer).tileset = frmEditor_House.chkTileset.Caption End With Else y2 = 0 For Y = CurY To CurY + EditorTileHeight - 1 x2 = 0 For X = CurX To CurX + EditorTileWidth - 1 If X >= 0 And X = 0 And Y frmEditor_House.picBackSelect.width / PIC_X Then X = frmEditor_House.picBackSelect.width / PIC_X If Y < 0 Then Y = 0 If Y > frmEditor_House.picBackSelect.height / PIC_Y Then Y = frmEditor_House.picBackSelect.height / PIC_Y If X > EditorTileX Then EditorTileWidth = X - EditorTileX Else ' TO DO End If If Y > EditorTileY Then EditorTileHeight = Y - EditorTileY Else ' TO DO End If frmEditor_House.shpSelected.width = EditorTileWidth * PIC_X frmEditor_House.shpSelected.height = EditorTileHeight * PIC_Y End If End Sub Public Sub HouseEditorTileScroll() frmEditor_House.picBackSelect.top = (frmEditor_House.scrlPictureY.Value * PIC_Y) * 1 frmEditor_House.picBackSelect.Left = (frmEditor_House.scrlPictureX.Value * PIC_X) '* -1 End Sub Public Sub HouseEditorSend() Call SendMap InMapEditor = False frmEditor_House.Visible = False Set DDS_Misc = Nothing End Sub Public Sub HouseEditorCancel() Dim Buffer As clsBuffer Set Buffer = New clsBuffer Buffer.WriteLong CNeedMap Buffer.WriteLong 1 SendData Buffer.ToArray() InMapEditor = False frmEditor_House.Visible = False Set DDS_Misc = Nothing End Sub Public Sub HouseEditorClearLayer() Dim i As Long Dim X As Long Dim Y As Long Dim CurLayer As Long For i = 1 To MapLayer.Layer_Count - 1 If frmEditor_House.optLayer(i).Value Then CurLayer = i Exit For End If Next If CurLayer = 0 Then Exit Sub If MsgBox("Are you sure you wish to clear this layer?", vbYesNo, Options.Game_Name) = vbYes Then For X = 0 To Map.MaxX For Y = 0 To Map.MaxY Map.Tile(X, Y).Layer(CurLayer).X = 0 Map.Tile(X, Y).Layer(CurLayer).Y = 0 Map.Tile(X, Y).Layer(CurLayer).tileset = 0 Next Next End If End Sub Public Sub HouseEditorFillLayer() Dim i As Long Dim X As Long Dim Y As Long Dim CurLayer As Long For i = 1 To MapLayer.Layer_Count - 1 If frmEditor_House.optLayer(i).Value Then CurLayer = i Exit For End If Next If MsgBox("Are you sure you wish to fill this layer?", vbYesNo, Options.Game_Name) = vbYes Then For X = 0 To Map.MaxX For Y = 0 To Map.MaxY Map.Tile(X, Y).Layer(CurLayer).X = EditorTileX Map.Tile(X, Y).Layer(CurLayer).Y = EditorTileY Map.Tile(X, Y).Layer(CurLayer).tileset = frmEditor_House.chkTileset.Caption Next Next End If End Sub Public Sub HouseEditorClearAttribs() Dim X As Long Dim Y As Long If MsgBox("Are you sure you wish to clear the attributes on this house?", vbYesNo, Options.Game_Name) = vbYes Then For X = 0 To Map.MaxX For Y = 0 To Map.MaxY Map.Tile(X, Y).Type = 0 Next Next End If End Sub Public Sub HouseEditorLeaveMap() If InMapEditor Then If MsgBox("Save changes to current house?", vbYesNo) = vbYes Then Call HouseEditorSend Else Call HouseEditorCancel End If End If End Sub Public Sub HideHouseAttributes() With frmEditor_House .fraHSign.Visible = False .fraHSpot.Visible = False End With End Sub '[/HOUSE EDITOR] ``` ModDirectDraw7 At bottom add this: ``` 'House Editor Public Sub BltHouseRoof(ByVal X As Long, ByVal Y As Long) Dim rec As DxVBLib.RECT Dim i As Long With Map.Tile(X, Y) i = MapLayer.Roof If .Layer(i).tileset > 0 Then 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 If Not Threshold = True Then Call Engine_BltFast(ConvertMapX(X * PIC_X), ConvertMapY(Y * PIC_Y), DDS_Tileset(.Layer(i).tileset), rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY) End If End If End With End Sub '/House Editor '[House Editor] Public Sub EditorHouse_BltTileset() Dim height As Long Dim width As Long Dim tileset As Byte Dim sRECT As DxVBLib.RECT Dim dRECT As DxVBLib.RECT ' find tileset number tileset = frmEditor_House.chkTileset.Caption ' exit out if doesn't exist If tileset < 0 Or tileset > NumTileSets Then Exit Sub ' make sure it's loaded If DDS_Tileset(tileset) Is Nothing Then Call InitDDSurf("tilesets\" & tileset, DDSD_Tileset(tileset), DDS_Tileset(tileset)) End If height = DDSD_Tileset(tileset).lHeight width = DDSD_Tileset(tileset).lWidth dRECT.top = 0 dRECT.Bottom = height dRECT.Left = 0 dRECT.Right = width frmEditor_House.picBackSelect.height = height frmEditor_House.picBackSelect.width = width Call Engine_BltToDC(DDS_Tileset(tileset), sRECT, dRECT, frmEditor_House.picBackSelect) End Sub '[/House Editor] ``` Find this: ``` If NumTileSets > 0 Then For X = TileView.Left To TileView.Right For Y = TileView.top To TileView.Bottom If IsValidMapPoint(X, Y) Then Call BltMapFringeTile(X, Y) End If Next Next End If ``` Under: ``` Call BltMapFringeTile(X, Y) ``` Add this: ``` Call BltHouseRoof(X, Y) 'House Editor ``` Find this: ``` ' Blit out map attributes If InMapEditor Then Call BltMapAttributes End If ``` Replace it with this: ``` ' Blit out map attributes If InMapEditor Then Call BltMapAttributes Call BltHouseAttributes 'House Editor End If ``` ModEnumerations Find this: ``` ' Make sure SMSG_COUNT is below everything else ``` Add this above: ``` 'House Editor: SEditHouse SInitManager SSendHouse SGoldChecked ``` Find this: ``` ' Make sure CMSG_COUNT is below everything else ``` Add this above: ``` 'House Editor: CRequestEditHouse CHouseManager CCheckGold CWarpToHouse ``` Find Enum MapLayer and add above: ``` Layer_Count ``` this: ``` Roof 'House Editor ``` ModHandleData At bottom of sub InitMessages add: ``` 'House Editor: HandleDataSub(SEditHouse) = GetAddress(AddressOf HandleEditHouse) HandleDataSub(SInitManager) = GetAddress(AddressOf HandleInitManager) HandleDataSub(SSendHouse) = GetAddress(AddressOf HandleSendHouse) HandleDataSub(SGoldChecked) = GetAddress(AddressOf HandleGoldChecked) ``` Find: ``` Map.Tile(X, Y).DirBlock = Buffer.ReadByte ``` ``` Add this: Map.Tile(X, Y).Data4 = Buffer.ReadString 'House Editor ``` At bottom of ModHandleData add this: ``` '[House Editor] Private Sub HandleEditHouse(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim Owner As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() Owner = Buffer.ReadLong If Not Owner = GetPlayerMap(Index) Then Exit Sub Call HouseEditorInit End Sub Private Sub HandleInitManager(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim HMapNum As Long Dim HType As String Dim HGold As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() HMapNum = Buffer.ReadLong HType = Buffer.ReadString HGold = Buffer.ReadLong Set Buffer = Nothing With frmMain Select Case HType Case "Buy" .picHouse.Visible = True .lblHouseOk.Visible = True .lblHouseCancel.Visible = True .lblHouseGoTo.Visible = False .lblHouseAsk = "Buy this house for " & HGold & "?" .picHouse.Tag = HMapNum .lblHouseAsk.Tag = HType .lblHouseOk.Tag = HGold Case "Sell" .picHouse.Visible = True .lblHouseOk.Visible = True .lblHouseCancel.Visible = True .lblHouseGoTo.Visible = False .lblHouseAsk = "Sell your house for " & HGold & "?" .picHouse.Tag = HMapNum .lblHouseAsk.Tag = HType .lblHouseOk.Tag = HGold Case "Nothing" Exit Sub End Select End With End Sub Private Sub HandleSendHouse(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) Dim Buffer As clsBuffer Dim HType As String Dim HMapNum As Long Set Buffer = New clsBuffer Buffer.WriteBytes Data() HType = Buffer.ReadString HMapNum = Buffer.ReadLong Set Buffer = Nothing With frmMain Select Case HType Case "Buy" .lblHouseOk.Visible = False .lblHouseCancel.Visible = False .lblHouseGoTo.Visible = True .lblHouseAsk = "House bought!" .picHouse.Tag = HMapNum Case "Sell" .lblHouseOk.Visible = False .lblHouseCancel = "Close" .lblHouseAsk = "House sold!" .picHouse.Tag = 0 Case "Gold" .picHouse.Visible = False MsgBox "Not enought gold!", vbInformation, "" & Options.Game_Name End Select End With End Sub Private Sub HandleGoldChecked(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long) If InHouseEditor = True Then With Map.Tile(CurX, CurY) If frmEditor_House.optBlocked.Value Then .Type = TILE_TYPE_BLOCKED .Data1 = 0 .Data2 = 0 .Data3 = 0 ElseIf frmEditor_House.optSign.Value Then .Type = TILE_TYPE_SIGN .Data1 = 0 .Data2 = 0 .Data3 = 0 .Data4 = CStr(HouseSign) ElseIf frmEditor_House.optThreshold.Value Then .Type = TILE_TYPE_THRESHOLD .Data1 = 0 .Data2 = 0 .Data3 = 0 ElseIf frmEditor_House.optSpot.Value Then .Type = TILE_TYPE_RESOURCE .Data1 = SpotNum .Data2 = 0 .Data3 = 0 End If End With End If End Sub '[/House Editor] ``` frmEditor_Resource At the bottom, add: ``` 'House Editor: Private Sub chkSpot_Click() Resource(EditorIndex).Spot = chkSpot.Value End Sub ``` modText Add this: ``` '[House Editor] Public Function BltHouseAttributes() Dim X As Long Dim Y As Long Dim tX As Long Dim tY As Long If frmEditor_House.optAttributes.Value = True Then For X = TileView.Left To TileView.Right For Y = TileView.top To TileView.Bottom If IsValidMapPoint(X, Y) Then With Map.Tile(X, Y) tX = ((ConvertMapX(X * PIC_X)) - 4) + (PIC_X * 0.5) tY = ((ConvertMapY(Y * PIC_Y)) - 7) + (PIC_Y * 0.5) Select Case .Type Case TILE_TYPE_BLOCKED DrawText TexthDC, tX, tY, "B", QBColor(BrightRed) Case TILE_TYPE_SIGN DrawText TexthDC, tX, tY, "S", QBColor(Yellow) Case TILE_TYPE_THRESHOLD DrawText TexthDC, tX, tY, "T", QBColor(BrightCyan) Case TILE_TYPE_RESOURCE DrawText TexthDC, tX, tY, "S", QBColor(BrightGreen) End Select End With End If Next Next End If End Function '[/House Editor] ``` modTypes In TileRec, find DirBlock As Byte Add this: ``` Data4 As String 'House Editor ``` In NPCRec, find Animation As Long Add this: ``` 'House Editor: HMapNum As Long HBuy As Long HSell As Long ``` In ResourceRec, find Animation As Long Add this: ``` Spot As Byte 'House Editor ``` modGameLogic in Function CheckDirection, Find: ``` Case DIR_RIGHT X = GetPlayerX(MyIndex) + 1 Y = GetPlayerY(MyIndex) End Select ``` Add this below it: ``` 'House Editor If Map.Tile(X, Y).Type = TILE_TYPE_THRESHOLD Then Threshold = Not Threshold Exit Function End If '/House Editor ``` In Public Sub UpdateDrawMapName() find: ``` Case MAP_MORAL_SAFE DrawMapNameColor = QBColor(White) ``` Add this below it: ``` Case MAP_MORAL_HOUSE DrawMapNameColor = QBColor(BrightCyan) '/House Editor ``` FORM WORK: Copy picHouse with everything in it from House Speech.frm, what i added to attachments (its in file HouseFiles.rar) , to your frmMain (this pic is used for talking with npc manager). Add frmEditor_House.frm to your project (its located in HouseFiles.rar too) Add checkbox to frmEditor_Resource with: Name: chkSpot Caption: Spot? In frmEditor_NPC add to cmbBehavior list new item **Manager** add fraHouse with everything in it from House NPC Editor Frame.frm (included in HouseFiles.rar) to frmEditor_NPC (u must make some room for this) In frmEditor_MapProperties add to cmbMoral list new item **House** And now youre done ![:P](http://www.touchofdeathforums.com/community/public/style_emoticons//tongue.png) I think i dont forget anything. Please post any bugs u found.
  15. tslusny

    Dmg on screen

    You must change it on client and server side too
  16. tslusny

    Map size problem

    Yes i deleted all maps, WIDTH = 800, HEIGHT = 544, MaxX= 24, MaxY= 16
  17. Download WInrar from Rarlab.com
  18. tslusny

    Map size problem

    Hello i have problem… :P I resized my PicScreen and i set maxx and maxy correctly and everything is working fine. BUT My basic size is 24x16, if i set size to 24x17 or 25x16 or 25x17 i can go offscreen for 1 tile and when i moving my screen in game *shakes*. Other sizes work flawlessly. Pls help me
  19. UPDATED :cheesy: Added 2 new buttons for: Promoting to Guild Founder Opening Admin Panel :P WORKING ON: Guild invite accept/decline like Trade Request accept/decline
  20. So i fixed his House system…. So im asking, shall i post tutorial? :cheesy:
  21. yea you are right :D i fix it
  22. why you dont released tthis earlier :cheesy:, now i cant use this becouse im so far with my game :P
  23. Working on Guild House System :cheesy:
  24. Hello. kira423 inspired me with her tutorial to make more advanced metod of Exp Scalling (and is balanced too). kira423 tutorial [http://www.touchofdeathforums.com/smf2/index.php/topic,80478.0.html](http://www.touchofdeathforums.com/smf2/index.php/topic,80478.0.html) In ModCombat in Sub PlayerAttackNpc find ``` ' Make sure we dont get less then 0 If exp < 0 Then exp = 1 End If ``` Under add ``` If (GetPlayerLevel(attacker) - NPC(npcNum).Level) < -4 Then exp = Round((NPC(npcNum).exp * NPC(npcNum).Level) /5 ) ElseIf (GetPlayerLevel(attacker) - NPC(npcNum).Level) > 4 Then exp = Round((NPC(npcNum).exp / GetPlayerLevel(attacker)) *5 ) End If ```
×
×
  • Create New...