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

Eclipse - Event System


jcsnider
 Share

Recommended Posts

  • Replies 512
  • Created
  • Last Reply

Top Posters In This Topic

Okay, guys, several updates….

I am releasing 1.9 but keeping my word that i would post the fixes as I edited the system so here we go!

First, the biggest change in this system is simply the event names are now an option. Here are screenshots!

![](http://www.freemmorpgmaker.com/files/imagehost/pics/08cb7112bce4a373c4baa226e7e96a70.png)

![](http://www.freemmorpgmaker.com/files/imagehost/pics/fa49b9a4e47d3a1a9f2fd1de6bd22022.png)

This also includes the move route fix ;)

Now, you can either….

>! [Eclipse Event System 1.9](http://www.mediafire.com/?8xbenv8c52lx1yp)

>! FIRST, a bug fix!
>! >! On the server in modGameLogic….
Find
```
                            .MoveType = Map(mapnum).Events(i).Pages(z).MoveType
                            If .MoveType = 2 Then
                                .MoveRouteCount = Map(mapnum).Events(i).Pages(z).MoveRouteCount
                                ReDim .MoveRoute(0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount)
                                For p = 0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount
                                    .MoveRoute(p) = Map(mapnum).Events(i).Pages(z).MoveRoute(p)
                                Next
                            End If
```
and replace with
>! ```
                            .MoveType = Map(mapnum).Events(i).Pages(z).MoveType
                            If .MoveType = 2 Then
                                .MoveRouteCount = Map(mapnum).Events(i).Pages(z).MoveRouteCount
                                ReDim .MoveRoute(0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount)
                                If Map(mapnum).Events(i).Pages(z).MoveRouteCount > 0 Then
                                    For p = 0 To Map(mapnum).Events(i).Pages(z).MoveRouteCount
                                        .MoveRoute(p) = Map(mapnum).Events(i).Pages(z).MoveRoute(p)
                                    Next
                                End If
                            End If
```
Secondly, we are going to make an optimization or two
>! >! I thank Scypher for pointing out this wrongly-placed code…
Find this line of code...
```
UpdateEventLogic
```
and move it 2 lines down below the "Next".
>! Now, for the actual code optimizations….
>! >! In Sub RemoveDeadEvents, replace this line…
```
Dim i As Long, mapnum As Long, buffer As clsBuffer
```with this…
```
Dim i As Long, mapnum As Long, buffer As clsBuffer,x As Long, id As Long, page As Long
```
In Sub SpawnNewEvents
Replace this line…
```
Dim buffer As clsBuffer, pageID As Long, id As Long, compare As Long
```with this…
```
Dim buffer As clsBuffer, pageID As Long, id As Long, compare As Long, i As Long, mapnum As Long, x As Long, z As Long, spawnevent As Boolean, p As Long
```
In Sub ProcessEventMovement…
replace this line...
```
Dim rand As Long, x As Long, i As Long, playerID As Long, eventID As Long, WalkThrough As Long, isglobal As Boolean, mapnum As Long, actualmovespeed As Long, buffer As clsBuffer
```with this…
```
Dim rand As Long, x As Long, i As Long, playerID As Long, eventID As Long, WalkThrough As Long, isglobal As Boolean, mapnum As Long, actualmovespeed As Long, buffer As clsBuffer, z As Long, sendupdate As Boolean
```
Next, in Sub ProcessLocalEventMovement
replace this line…
```
Dim rand As Long, x As Long, i As Long, playerID As Long, eventID As Long, WalkThrough As Long, isglobal As Boolean, mapnum As Long, actualmovespeed As Long, buffer As clsBuffer
```with this…
```
Dim rand As Long, x As Long, i As Long, playerID As Long, eventID As Long, WalkThrough As Long, isglobal As Boolean, mapnum As Long, actualmovespeed As Long, buffer As clsBuffer, z As Long, sendupdate As Boolean
```
In Sub ProcessEventCommands…
replace
```
Dim buffer As clsBuffer, i As Long
```with this line…
```
Dim buffer As clsBuffer, i As Long, x As Long, z As Long, removeeventprocess As Boolean, w As Long, v As Long, p As Long
```
Finally in Sub SendMapEventData…
replace
```
Dim buffer As clsBuffer, i As Long, x As Long, y As Long, z As Long, mapnum As Long
```with
```
Dim buffer As clsBuffer, i As Long, x As Long, y As Long, z As Long, mapnum As Long, w As Long
```
>! And finally, a new feature :D

>! >! First, add a chkbox to the event editor form on the client. The name will be shown/hidden per event PAGE so I simply put it in the options… **Name it chkShowName** you can reference this screenshot for guidance….
![](http://www.freemmorpgmaker.com/files/imagehost/pics/38be34c4420edc75a8678802d2f60cf4.png)
>! Next, double click on the chkbox and make your chkShowName_Click() sub look like this…
```
Private Sub chkShowName_Click()
    tmpEvent.Pages(curPageNum).ShowName = chkShowName.Value
End Sub
```
Now, find
```
WalkThrough As Byte
```Under it add
```
ShowName As Byte
```
Next, find
```
WalkThrough As Long
```Under it add
```
ShowName As Long
```
Next, find
```
Buffer.WriteLong .WalkThrough
```Under it Add
```
Buffer.WriteLong .ShowName
```
Next, find
```
frmEditor_Events.chkWalkThrough.Value = .WalkThrough
```Under it add
```
frmEditor_Events.chkShowName.Value = .ShowName
```
Next, find
```
.WalkThrough = Buffer.ReadLong
```Under it add
```
.ShowName = Buffer.ReadLong
```
Next, find
```
.WalkThrough = Buffer.ReadLong
```under it add
```
.ShowName = Buffer.ReadLong
```YES, we are doing this twice…
>! Next, find
```
' draw player names
    For i = 1 To Player_HighIndex
        If IsPlaying(i) And GetPlayerMap(i) = GetPlayerMap(MyIndex) Then
            Call DrawPlayerName(i)
        End If
    Next
```
Under it, add
```
    For i = 1 To Map.CurrentEvents
        If Map.MapEvents(i).Visible = 1 Then
            If Map.MapEvents(i).ShowName = 1 Then
                DrawEventName (i)
            End If
        End If
    Next
```
Next, find
```
Private Type MapEventRec
```Under it add
```
Name as String
```
Next, find
```
With Map.MapEvents(id)
        .Dir = Buffer.ReadLong
```Replace with…
```
With Map.MapEvents(id)
        .Name = Buffer.ReadString
        .Dir = Buffer.ReadLong
```
Finally, in modText add this sub….
```
Public Sub DrawEventName(ByVal Index As Long)
Dim TextX As Long
Dim TextY As Long
Dim color As Long
Dim Name As String
>!     ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler
    If InMapEditor Then Exit Sub
>!     color = QBColor(White)
>!     Name = Trim$(Map.MapEvents(Index).Name)

    ' calc pos
    TextX = ConvertMapX(Map.MapEvents(Index).x * PIC_X) + Map.MapEvents(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
    If Map.MapEvents(Index).GraphicType = 0 Then
        TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 16
    ElseIf Map.MapEvents(Index).GraphicType = 1 Then
        If Map.MapEvents(Index).GraphicNum < 1 Or Map.MapEvents(Index).GraphicNum > NumCharacters Then
            TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 16
        Else
            ' Determine location for text
            TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - (DDSD_Character(Map.MapEvents(Index).GraphicNum).lHeight / 4) + 16
        End If
    ElseIf Map.MapEvents(Index).GraphicType = 2 Then
        If Map.MapEvents(Index).GraphicY2 = 0 Then
            TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - ((Map.MapEvents(Index).GraphicY2 - Map.MapEvents(Index).GraphicY) * 32) + 16
        Else
            TextY = ConvertMapY(Map.MapEvents(Index).y * PIC_Y) + Map.MapEvents(Index).YOffset - 32 + 16
        End If
    End If
>!     ' Draw name
    Call DrawText(TexthDC, TextX, TextY, Name, color)

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "DrawEventName", "modText", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub
```
>!
>! Ok, server side WILL be easier ;)
First, find..
```
WalkThrough As Long
```under it add
```
ShowName As Long
```DO THIS
>! Then find,
```
buffer.WriteLong Map(mapnum).Events(id).Pages(page).WalkThrough
```Under it add…
```
buffer.WriteLong Map(mapnum).Events(id).Pages(page).ShowName
```
Then find,
```
buffer.WriteLong Map(mapnum).Events(id).Pages(z).WalkThrough
```under it add
```
buffer.WriteLong Map(mapnum).Events(id).Pages(z).ShowName
```
Then find,
```
buffer.WriteLong .WalkThrough
```under it add
```
buffer.WriteLong .ShowName
```
Find,
```
PutVar filename, "Event" & i & "Page" & x, "WalkThrough", Val(.WalkThrough)
```Under it Add
```
PutVar filename, "Event" & i & "Page" & x, "ShowName", Val(.ShowName)
```
Then Find,
```
.WalkThrough = Val(GetVar(filename, "Event" & i & "Page" & x, "WalkThrough"))
```Under it, add
```
.ShowName = Val(GetVar(filename, "Event" & i & "Page" & x, "ShowName"))
```
Now find,
```
buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).WalkThrough
```under it add
```
buffer.WriteLong Map(mapnum).Events(.eventID).Pages(.pageID).ShowName
```
Find this,
```
.WalkThrough = buffer.ReadLong
```under it add
```
.ShowName = buffer.ReadLong
```
Finally, find this
```
buffer.WriteLong SSpawnEvent
                            buffer.WriteLong id
                            With TempPlayer(i).EventMap.EventPages(x)
                                buffer.WriteLong .Dir
```
replace with
```
buffer.WriteLong SSpawnEvent
                            buffer.WriteLong id
                            With TempPlayer(i).EventMap.EventPages(x)
                                buffer.WriteString Map(GetPlayerMap(i)).Events(TempPlayer(i).EventMap.EventPages(x).eventID).Name
                                buffer.WriteLong .Dir
```
And,
```
buffer.WriteLong SSpawnEvent
                        buffer.WriteLong id
                        With TempPlayer(i).EventMap.EventPages(x)
                            buffer.WriteLong .Dir
```Replace with
```
buffer.WriteLong SSpawnEvent
                        buffer.WriteLong id
                        With TempPlayer(i).EventMap.EventPages(x)
                            buffer.WriteString Map(GetPlayerMap(i)).Events(.eventID).Name
                            buffer.WriteLong .Dir
```
And replace this
```
buffer.WriteLong SSpawnEvent
                                                buffer.WriteLong eventID
                                                With TempEventMap(i).Events(x)
                                                    buffer.WriteLong .Dir
```with this,
```
buffer.WriteLong SSpawnEvent
                                                buffer.WriteLong eventID
                                                With TempEventMap(i).Events(x)
                                                    buffer.WriteString Map(GetPlayerMap(i)).Events(eventID).Name
                                                    buffer.WriteLong .Dir
```
And again, find this..
```
buffer.WriteLong SSpawnEvent
                                                buffer.WriteLong eventID
                                                With TempPlayer(playerID).EventMap.EventPages(eventID)
                                                    buffer.WriteLong .Dir
```
Replace with
```
buffer.WriteLong SSpawnEvent
                                                buffer.WriteLong eventID
                                                With TempPlayer(playerID).EventMap.EventPages(eventID)
                                                    buffer.WriteString Map(GetPlayerMap(playerID)).Events(eventID).Name
                                                    buffer.WriteLong .Dir
```
Yet again…
Find this..
```
buffer.WriteLong SSpawnEvent
            buffer.WriteLong i
            With TempPlayer(index).EventMap.EventPages(i)
                buffer.WriteLong .Dir
```replace with
```
buffer.WriteLong SSpawnEvent
            buffer.WriteLong i
            With TempPlayer(index).EventMap.EventPages(i)
                buffer.WriteString Map(GetPlayerMap(index)).Events(i).Name
                buffer.WriteLong .Dir
```
And that is finally it!
Link to comment
Share on other sites

Damn, there is still that nasty bug were if i open 2 clients and talk to an event on 1 client, the evnt starts on the other client. It seems whoever is logged into the game or map gets the vent that someone else does.
Link to comment
Share on other sites

@daxterxx:

> Damn, there is still that nasty bug were if i open 2 clients and talk to an event on 1 client, the evnt starts on the other client. It seems whoever is logged into the game or map gets the vent that someone else does.

That was never reported to me XD
Download link taken down until I look at this bug.
Link to comment
Share on other sites

I DID forget to compile the client however there is no issue (as far as I can see) about events starting for multiple players on CTRL hit or joining maps with parallel processes… here, again, is 1.9 (With a compiled client.exe)

[Eclipse Event System 1.9](http://www.mediafire.com/?8xbenv8c52lx1yp)
Link to comment
Share on other sites

Create a new event and just add a show text box text command. The open 2 clients and have 1 of them talk to the event. watch wht happents to both clients
Link to comment
Share on other sites

@jcsnider:

> I DID forget to compile the client however there is no issue (as far as I can see) about events starting for multiple players on CTRL hit or joining maps with parallel processes… here, again, is 1.9 (With a compiled client.exe)
>
> [Eclipse Event System 1.9](http://www.mediafire.com/?8xbenv8c52lx1yp)

When I try to open the map editor I get a runtime error 7 "Out of memory". Its not me becuase im using this on a brand new PC!
Link to comment
Share on other sites

@daxterxx:

> Create a new event and just add a show text box text command. The open 2 clients and have 1 of them talk to the event. watch wht happents to both clients

It's probably because you're opening both clients on one computer.
Link to comment
Share on other sites

@daxterxx:

> Nope, I did try with 1 client and it still happens

Notice how I took the download link down, then I said I forgot to compile the client, and put it back up. Just re-download the thing and you will be fine. It may even fix your event but for the (2) clients.
Link to comment
Share on other sites

@Scypher:

> You can look at how I modified the MapEditorMouseDown sub in my edit Snider, I changed it to work like the regular map editor. :]

I know it is a very easy edit… I simply have mine the way it is, because when I got the editor from Robin at the time, that is how he had it :/
Link to comment
Share on other sites

Ok here is version 2.0!
This version changes the creation and deletion of events to work like standard map tiles. Left click to place/edit and right click to delete. It also includes a COMPILED server and client so the RTE 7's will stop.. sorry about that!

Anyways, here is the download!
[Eclipse - Event System 2.0](http://www.mediafire.com/?3du38elugrtb4h3)

Or, if you prefer doing this yourself then here is the tutorial…

>! All Client Sided..
First, I did [this](http://www.touchofdeathforums.com/smf2/index.php/topic,80819.msg865222/topicseen.html#msg865222) because it was driving me crazy during testing…
>! Second, In Sub MapEditorMouseDown, Find this....
```
If frmEditor_Map.optLayers.Value Then
            If EditorTileWidth = 1 And EditorTileHeight = 1 Then 'single tile
                MapEditorSetTile CurX, CurY, CurLayer
            Else ' multi tile!
                MapEditorSetTile CurX, CurY, CurLayer, True
            End If
```
and under it add…
```
ElseIf frmEditor_Map.optEvent.Value Then
            If frmEditor_Events.Visible = False Then
                AddEvent CurX, CurY
            End If
```
Now find,
```
If frmEditor_Map.optLayers.Value Then
            With Map.Tile(CurX, CurY)
                ' clear layer
                .Layer(CurLayer).x = 0
                .Layer(CurLayer).y = 0
                .Layer(CurLayer).Tileset = 0
            End With
```
under it add
```
ElseIf frmEditor_Map.optEvent.Value Then
            Call DeleteEvent(CurX, CurY)
```
>! Finally, in order to make it so the event editor does no appear behind the main form, find this line in picScreen_Mousedown
```
Call SetFocusOnChat
```Under it add
```
If frmEditor_Events.Visible Then frmEditor_Events.SetFocus
```
Finally, if so desired you can delete…
```
' handles delete events
    If KeyCode = vbKeyDelete Then
        If InMapEditor Then DeleteEvent CurX, CurY
    End If
```
and
```
Private Sub picScreen_DblClick()
    If InMapEditor Then
        If frmEditor_Map.optEvent.Value Then
            If frmEditor_Events.Visible = False Then
                AddEvent CurX, CurY
            End If
        End If
    End If
End Sub
```
Which was the old way to delete and add events.
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...