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

Battle Log!


Growlith1223
 Share

Recommended Posts

> ok so i know i haven't been making tutorials lately but here's one i JUST made xD
>
> Please note that it only tells how much you dealed to the enemy plus if it faints(dies)
>
> ok so in both Client and Server goto ModEnumerations and add
>
> ```
>
> SBattleMsg
>
> ```
>
> **Client Side**
>
> Go into frmMain and add a RichTextBox anywhere and name it txtBattleLog, make sure to set the Enabled value to false.
>
> Add this to that handleData sub thingy
>
> ```
>
> HandleDataSub(SBattleMsg) = GetAddress(AddressOf HandleBattleMsg)
>
> ```
> and add this sub at the bottom of ModHandleData
>
> ```
>
> Private Sub HandleBattleMsg(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
>
> Dim Buffer As clsBuffer
>
> Dim Name As String
>
> Dim message As String
>
> Dim saycolour As Long
>
> ' If debug mode, handle error then exit out
>
> If Options.Debug = 1 Then On Error GoTo errorhandler
>
> Set Buffer = New clsBuffer
>
> Buffer.WriteBytes Data()
>
> Name = Buffer.ReadString
>
> message = Buffer.ReadString
>
> saycolour = Buffer.ReadLong
>
> frmMain.txtBattleLog.SelStart = Len(frmMain.txtBattleLog.text)
>
> frmMain.txtBattleLog.SelColor = QBColor(saycolour)
>
> frmMain.txtBattleLog.SelText = vbNewLine & message
>
> frmMain.txtBattleLog.SelStart = Len(frmMain.txtBattleLog.text) - 1
>
> Set Buffer = Nothing
>
> ' Error handler
>
> Exit Sub
>
> errorhandler:
>
> HandleError "HandleSayMsg", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
>
> Err.Clear
>
> Exit Sub
>
> End Sub
>
> ```
>
> **Server Side**
>
> Go into modServerTCP and add this at the bottom
>
> ```
>
> Sub SayMsg_Battle(ByVal mapNum As Long, ByVal index As Long, ByVal message As String, ByVal saycolour As Long)
>
> Dim Buffer As clsBuffer
>
> Set Buffer = New clsBuffer
>
> Buffer.WriteLong SBattleMsg
>
> Buffer.WriteString GetPlayerName(index)
>
> Buffer.WriteString message
>
> Buffer.WriteLong saycolour
>
> SendDataToMap mapNum, Buffer.ToArray()
>
> Set Buffer = Nothing
>
> End Sub
>
> ```
>
> now goto Sub PlayerAttackNPC(so far) and add
>
> ```
>
> SayMsg_Battle mapNum, attacker, Trim$(Player(attacker).Name) & " has dealt " & Damage & " Damage To " & Trim$(Name), BrightRed
>
> ```
> Under
>
> ```
>
> Name = Trim$(Npc(npcNum).Name)
>
> ```
>
> and add
>
> ```
>
> SayMsg_Battle mapNum, attacker, Name & " has fainted!", White
>
> ```
> Under
>
> ```
>
> MapNpc(mapNum).Npc(mapNpcNum).Vital(Vitals.HP) = 0
>
> ```
>
> once all that's done, you should get a message in that new box saying that you have dealt damage to the npc
>
> Let me know if any errors come up

This is how it should come up.(this is a customized version of this tutorial.)

![](http://www.freemmorpgmaker.com/files/imagehost/pics/2f46f4778ce1253ccd73554751face2d.PNG)
Link to comment
Share on other sites

now i get what you got going on there, but to me, it seems like alot. im not saying its bad or wrong or anything but isnt using this the same thing? anyway i like this tut mainly for the sending packets. it clearly shows how to do it.

in the

Public Sub TryNpcAttackPlayer(ByVal mapNpcNum As Long, ByVal Index As Long)

```

Call PlayerMsg(Index, Trim$(NPC(MapNpc(mapnum).NPC(mapNpcNum).Num).Name) & " Hits you for " & Damage, BrightRed)

```

ok i guess you do have it going to a NEW location as well.
Link to comment
Share on other sites

From how this system is working it's just moving what it already sends to another window by calling a function to the other window instead of the chatbox. Personally this would be better if it was drawn along the side of the screen like Joyce's Loot sidebar was.
Link to comment
Share on other sites

  • 4 weeks 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...