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

E.O 2.0/EclipseEvent 2.3 Duel System


Zopto
 Share

Recommended Posts

Baisic Duel System 1vs1

**Client Side ~**

Create a picture in frmMain

Rename the picture for "picPVPRequest" add label raname it "lblPVPplayer."

now make two lbels Accept and Decline…

click on accept lbl and put this in:

```
picPVPRequest.Visible = False

SendAcceptPVP
```

And the same thing, but the label 'Reject':

```
picPVPRequest.Visible = False

SendDeclinePVP

```

Look for:

```
Case "/ debug"
```

Below this case add:

```
Case "/fight"

If Len (MyText)> 7 Then

ChatText = Mid (MyText, 8, Len (MyText) - 7)

SendPVPRequest ChatText

Else

AddText "Useage: / fight," HelptColor

End If
```

Look for:

```
Sub SendDeclineParty ( )
```

Add Below:

```

Sub SendPVPRequest (ByVal Name As String)

Dim Buffer As clsBuffer

If Options.Debug = 1 Then On Error GoTo ErrorHandler

Set Buffer = New clsBuffer

Buffer.WriteLong CPvp

Buffer.WriteString Name

SendData Buffer.ToArray ()

Set Buffer = Nothing

'Error Handler

Exit Sub

ErrorHandler:

HandleError "SendPVPRequested", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Sub SendDeclinePVP ()

Dim Buffer As clsBuffer

If Options.Debug = 1 Then On Error GoTo ErrorHandler

Set Buffer = New clsBuffer

Buffer.WriteLong CDPvp

SendData Buffer.ToArray ()

Set Buffer = Nothing

'Error Handler

Exit Sub

ErrorHandler:

HandleError "SendDeclinePVP", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

Sub SendAcceptPVP ()

Dim Buffer As clsBuffer

If Options.Debug = 1 Then On Error GoTo ErrorHandler

Set Buffer = New clsBuffer

Buffer.WriteLong PAPVC

SendData Buffer.ToArray ()

Set Buffer = Nothing

'Error Handler

Exit Sub

ErrorHandler:

HandleError "SendAcceptPVP", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Search For:

```
'Make sure CMSG_COUNT is below everything else

CMSG_COUNT
```

Above that add:

```

CPvp

CDPvp

PAPVC

```

**~ Server Side**

Go to the Type PlayerRec

and below:

```
Pk as byte
```

Add:

```
PVPPlayer As Long
```

Search For:

```
'Make sure CMSG_COUNT is below everything else

CMSG_COUNT
```

Add Up:

```
CPvp

CDPvp

PAPVC
```

Now Look for:

```
HandleDataSub (CPartyLeave) = GetAddress (AddressOf HandlePartyLeave)
```

Below add:

```
HandleDataSub (CPvp) = GetAddress (AddressOf HandlePvp)

HandleDataSub (PAPVC) = GetAddress (AddressOf HandleAcceptPvp)

HandleDataSub (CDPvp) = GetAddress (AddressOf HandleDeclinePVP)
```

Now add this at the end of modHandleData:

FIX BY SOUL!!!

```
Sub HandlePvp (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim N As Byte

Dim Buffer As clsBuffer

Set Buffer = New clsBuffer

N = FindPlayer (Buffer.ReadString) 'Parse (1))

If N <1 Then

PlayerMsg index, N & "is not online.", White

Exit Sub

End If

If N = index Then

Exit Sub

End If

PlayerMsg index, "The request was sent to fight" & GetPlayerName (N) & ".", Pink

PlayerMsg N, GetPlayerName (index) & "wants to fight you.", Pink

Player(N).PVPPlayer = index

Player(index).PVPPlayer = N

PVPRequestWindow N, Index

End Sub

Sub HandleAcceptPvp (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim N As Byte

N = Player (index). PVPPlayer

If N> 0 Then

PlayerWarp N, 1, 10, 10 'Map of the "arena"

PlayerWarp index, 1, 11, 10 'Map of the "arena"

GlobalMsg GetPlayerName (index) & "and" & GetPlayerName (N) & "will fight in the arena. Good luck!", Pink

Else

PlayerMsg index, "Player no longer online.", White

Exit Sub

End If

End Sub

Sub HandleDeclinePVP (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim N As Byte

N = Player (index). PVPPlayer

If N> 0 Then

PlayerMsg index, "The request was rejected in the fight.", Pink

PlayerMsg N, GetPlayerName (index) & "rejected his request to fight.", Pink

End If

End Sub

```

Search For:

```
Sub SendSpawnItemToMap (ByVal mapNum As Long, ByVal Index As Long)
```

Below this sub add:

```
Sub PVPRequestWindow (ByVal Index As Long, ByVal Inviter As Long)

Dim Buffer As clsBuffer

Set Buffer = New clsBuffer

Buffer.WriteLong SPvpWindow

Buffer.WriteByte Inviter

SendDataTo Index, Buffer.ToArray ()

Set Buffer = Nothing

End Sub

```

Search For:

```
'Make sure SMSG_COUNT is below everything else

SMSG_COUNT
```

Add up:

```

SPvpWindow
```

**i forgot this**

**Client Side**

and search for:

```

'Make sure SMSG_COUNT is below everything else

SMSG_COUNT
```

Add Up:

```
SPvpWindow
```

Now Look For:

```
HandleDataSub (SPartyVitals) = GetAddress (AddressOf HandlePartyVitals)
```

Add Below:

```
HandleDataSub (SPvpWindow) = GetAddress (AddressOf HandlePvpWindow)
```

Now the end of modHandleData Add:

```
Sub HandlePvpWindow (ByVal Index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

'If debug mode, then handle error exit in October

If Options.Debug = 1 Then On Error GoTo ErrorHandler

frmMain.lblPVPplayer.Caption = "%% Player"

frmMain.picPVPRequest.Visible = True

'Error handler

Exit Sub

ErrorHandler:

HandleError "HandlePvpWindow", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```

Ready to give the system using example:

how to start dueling simple put this in chat

**/fight (player name)**

not tested on eo 3.0
Link to comment
Share on other sites

@Sinnix803:

> Whats wrong with this code?
> I attempted to change it to see if it will work, on the client side.
> I get a compile error : Case else ousite of select case.
> heres a screeny

```
Case "/fight"
    If Len (MyText)> 7 Then
    ChatText = Mid (MyText, 8, Len (MyText) - 7)
    SendPVPRequest ChatText
    Else
    AddText "Useage: /fight", HelptColor
    End If
```try this
Link to comment
Share on other sites

There are a couple flaws with this system, for one i didn't see a check anywhere to make sure you are actually fighting your opponent in the arena, and you also need to figure out a way to get oneself out of the arena when the fighting ends.

Also stop using 'EE 2.3' it will confuse some people with Eclipse Evolution 2.7\.
Link to comment
Share on other sites

@General:

> There are a couple flaws with this system, for one i didn't see a check anywhere to make sure you are actually fighting your opponent in the arena, and you also need to figure out a way to get oneself out of the arena when the fighting ends.
>
> Also stop using 'EE 2.3' it will confuse some people with Eclipse Evolution 2.7.

```
Sub HandleAcceptPvp (ByVal index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim N As Byte
    N = Player (index). PVPPlayer

    If N> 0 Then
    PlayerWarp N, 1, 10, 10 'Map of the "arena"
    PlayerWarp index, 1, 11, 10 'Map of the "arena"
    GlobalMsg GetPlayerName (index) & "and" & GetPlayerName (N) & "will fight in the arena. Good luck!",
```this sub send players to arena so if some one went to get out i will make somting like dors and attribut wrap ??
Link to comment
Share on other sites

Your system is flawed. Here is how i would do it.

Player sends duel request, other player accepts -> creates a instanced arena map and warps them to it -> they fight, one player wins -> warp the players back to their previous location after the duel finishes.
Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
> How to change " [background=rgb(248, 248, 248)]frmMain.lblPVPplayer.Caption = "%% Player" "[/background] To Player Opponent Name?

[background=rgb(248, 248, 248)]frmMain.lblPVPplayer.Caption = [/background]GetPlayerName(Index of the Opponent)

Basically change

```

Sub HandlePvpWindow (ByVal Index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

'If debug mode, then handle error exit in October

If Options.Debug = 1 Then On Error GoTo ErrorHandler

frmMain.lblPVPplayer.Caption = "%% Player"

frmMain.picPVPRequest.Visible = True

'Error handler

Exit Sub

ErrorHandler:

HandleError "HandlePvpWindow", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```
to

```

Sub HandlePvpWindow (ByVal Index As Long, ByRef Data () As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim buffer as clsBuffer

Dim Inviter as Byte

Set Buffer = New clsBuffer

Buffer.WriteBytes Data()

Inviter = Buffer.ReadByte

'If debug mode, then handle error exit in October

If Options.Debug = 1 Then On Error GoTo ErrorHandler

frmMain.lblPVPplayer.Caption = GetPlayerName(Inviter)

frmMain.picPVPRequest.Visible = True

'Error handler

Exit Sub

ErrorHandler:

HandleError "HandlePvpWindow", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext

Err.Clear

Exit Sub

End Sub

```
That ought to do it. I didn't use my compiler to edit that. I free handed it, so I apologize if there's any misspellings.
Link to comment
Share on other sites

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...