[EO 2.0]Hospital System

Hey Guys,
this is my first post in this forum :).
Short description :
This system shows a GUI if you died, where you have to stay for “x” seconds.
While you are in the hospital you can’t move. It’s just usefull if you want to make your game more realistic.

Scripting :
Serverside
modEnumerations
In Serverpackets over SMSG_Count insert:

hospitalEnter

modCombat
Search for :

If Damage >= GetPlayerVital(victim, Vitals.HP) Then
```_After this insert :_

Dim Buffer2 As clsBuffer
            Set Buffer2 = New clsBuffer
            Buffer2.WriteLong hospitalEnter
            Buffer2.WriteString “isinhospital”
            SendDataTo victim, Buffer2.ToArray
          Set Buffer = Nothing


Clientside
modConstants
_Insert this at the bottom :_

Public isInHospital As Boolean

modHandleData
_Insert this below Initmessages_

HandleDataSub(hospitalEnter) = GetAddress(AddressOf HandleHospital)

_Insert this at the bottom :_

Private Sub HandleHospital(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim Msg As String
    ’ If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    Msg = Buffer.ReadString
    frmHospital.Show

’ Error handler
    Exit Sub
errorhandler:
    HandleError “HandleHospital”, “modHandleData”, Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

modInput
_In checkInputKeys insert after_```
If GetKeyState(vbKeyUp) < 0 Then
```_this_

If isInHospital = False Then

End If


*   Create a new form called 'frmHospital'
*   Create a timer called Timer1
*   Create a label called lblTimer

**Now you have to _view the code_ of frmHospital.**
_Just insert this :_

Dim TimeH As Integer

Private Sub Form_Activate()
TimeH = 30 'Here you can set the duration
Timer1.Enabled = True
lblTimer.Caption = “You are in the Hospital for : 30s”
End Sub

Private Sub Timer1_Timer()
If TimeH > 0 Then
TimeH = TimeH - 1
lblTimer.Caption = "You are in the Hospital for : " & TimeH & “s”
isInHospital = True
Else
isInHospital = False
Me.Hide
End If

End Sub


Credits :

*   Robin - Should be clear why
*   Me - For creating the script + posting

I hope you can use it

Very simple to do something like this yourself but hey good first post 😛

More complicated than it needs to be.

Look at how spells handle stunning and it’s stun timer, create your own form of that (Or even use it), and then not only is it server side, and can’t be edited client-side, it also doesn’t need a timer. Find a way to adapt that with sending the packet to open the GUI, and then you’ve got something more efficient.

Another little tip, is that whenever you’re using a timer, try to figure out a way to use GetTickCount instead. Generally, it’d be

If GetTickCount > Timer Then
    FunctionHere
    Timer = GetTickCount + Time in milliseconds here
End If

Alright thanks.

I’m pretty new to VB6, before that I always used VB.NET/LUA and C++(#) in MySQL/XML/DirectX and XNA uses.
I never really had something with connections between client/server.

I think it would be nicer if instead of creating a new form you just added a picture box on frmMain. Anyway nice job, its always nice to see people are making more unique tutorials than making about 30 odd different types of quest systems etc.

~Kibbelz

I like the idea. One thing though you should really remove the words script and scripting.  It may confuse some poeple since this is a source code edit and not a script.

@all Thanks for the feedback.

I’ll remove them/replace them later.

Set The timer interval to 1000

U forgot it ?

Timer
Interval = 1000


ok so just in Client side

find

PublicEnum ServerPackets

below add

hospitalEnter

it works for me

also Dont forget timer interval 1000

sry for bumping this

Fixed it

Log in to reply