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

A One time use only warp :P EO V 2


SpiceyWolf
 Share

Recommended Posts

EDIT: Sorry this was not 100% bug free… the ini write and read would work... but u couldnt use that attribute more then once cuz it just wouldnt warp players even if u put another attribute down... so if u added this change the read and write ini code from the bottom in the server source handle data...(changing in the actual tut also) to this

```
If ReadINI(GetPlayerName(Index), "HasWarped" & GetPlayerMap(Index) & "," & GetPlayerX(Index) & "," & (GetPlayerY(Index)), App.Path & "\data\WarpEIT.Dat", "0") = "0" Then
            Call WriteINI(GetPlayerName(Index), "HasWarped" & GetPlayerMap(Index) & "," & GetPlayerX(Index) & "," & (GetPlayerY(Index)), "1", App.Path & "\data\WarpEvent.Dat")

```
Hey everybody, I promised when I finally made something 100% bug free I'd post it…
So without further A-do... Here is my first tutorial OUTSIDE OF ModText! (yaaaaay)

Ok I was inspired by events i saw in pokemon and cutscenes i wanted to have for my
zelda fan game...and im too lazy to put flash vids for all meh cutscenes, and who
wants ur players seeing these EVERY time
you re-enter a place?(id say if it crossed some peoples minds they just didnt add
anything like such because it would be a hassle... and i personally think mmo's
in stuff like this would be better with 'em!)

Ok so what this mod does... is similar to the Chest Attribute tutorial, except It's for warping...
(warp one time to a map with a flash or picture on it or something for ur own custom cutscenes!)

So we'll start off FIRST with the Client-Side.

First we wanna make the attribute which is pretty much a same tutorial for every attribute tutorial...

Looking for something and adding an attribute effect with the adding to attribute crap...

So Search these...

1.
```
                ' slide
                If frmEditor_Map.optSlide.Value Then
                    .Type = TILE_TYPE_SLIDE
                    .Data1 = MapEditorSlideDir
                    .Data2 = 0
                    .Data3 = 0
                End If

```
2.
```
                            Case TILE_TYPE_SLIDE
                                DrawText TexthDC, tX, tY, "S", QBColor(BrightCyan)

```
3.
```
Public Const TILE_TYPE_SLIDE As Byte = 14

```

Now we wanna put the Number post under the corresponding search up top…
(ex 1 goes to 1 2 goes to 2 ect...)

1.
```
'~SpiceyWolf~
                'WarpEvent for Cutscenes :P
                If frmEditor_Map.optWarpEvent.Value Then
                    .Type = TILE_TYPE_WARPEVENT
                    .Data1 = EditorWarpMap
                    .Data2 = EditorWarpX
                    .Data3 = EditorWarpY
                End If
'/~Spiceywolf~

```
2.
```
'~SpiceyWolf~
                            Case TILE_TYPE_WARPEVENT
                                DrawText TexthDC, tX, tY, "S", QBColor(BrightGreen)
'/~SpiceyWolf~

```
3.
```
Public Const TILE_TYPE_WARPEVENT As Byte = 15

```

Now go to your Map editor Form… Make a New OPTION Bubble thingy... its the circle one..
Place it wherever you like... and call it "optWarpEvent" without the quotes, and make the
caption whatever you want.

Double click the option box you just made and paist this in...

```
    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    ClearAttributeDialogue
    picAttributes.Visible = True
    fraMapWarp.Visible = True

    scrlMapWarp.Max = MAX_MAPS
    scrlMapWarp.Value = 1
    scrlMapWarpX.Max = MAX_BYTE
    scrlMapWarpY.Max = MAX_BYTE
    scrlMapWarpX.Value = 0
    scrlMapWarpY.Value = 0

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "optWarp_Click", "frmEditor_Map", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub

```

Now search SMSG and above the comment in the S list put

SWarpEvent

and in the C list do the same(can search CMSG)

CWarpEvent

In ModClientTCP at the bottom add

```
Sub WarpEvent(ByVal Index As Long)
Dim Buffer As clsBuffer

    Set Buffer = New clsBuffer
    Buffer.WriteLong CWarpEvent
    SendData Buffer.ToArray()
    Set Buffer = Nothing
End Sub

```
Search

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

```
and put under

```
HandleDataSub(SWarpEvent) = GetAddress(AddressOf HandleWarpEvent)

```

Now at the bottom of modHandleData add:

```
Private Sub HandleWarpEvent(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim X As Long
Dim Y As Long

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    X = Buffer.ReadLong
    Y = Buffer.ReadLong

    If Map.Tile(X, Y).Type = TILE_TYPE_WARPEVENT Then
        Call WarpEvent(Index)
    End If

End Sub

```

SERVER SIDE NOU!!! YAY!

Search for

```
Public Const TILE_TYPE_SLIDE As Byte = 14

```
and under put

```
Public Const TILE_TYPE_WARPEVENT As Byte = 15

```

At the bottom of the CMSG and SMSG lists right above the coment part that sais those in it…
add these

```
SWarpEvent
CWarpEvent

```
At the Bottom of ModServerTCP add

```
Sub SendWarpEvent(ByVal mapNum As Long, ByVal x As Long, ByVal y As Long)
Dim Buffer As clsBuffer

    Set Buffer = New clsBuffer
    Buffer.WriteLong SWarpEvent
    Buffer.WriteLong x
    Buffer.WriteLong y
    SendDataToMap mapNum, Buffer.ToArray()
    Set Buffer = Nothing
End Sub

```
Then look for Sub PlayerMove and at the bottom of the sub (just before End With) Add:

```
        If .Type = TILE_TYPE_WARPEVENT Then
            mapNum = .Data1
            x = .Data2
            y = .Data3
            Call PlayerWarp(Index, mapNum, x, y)
            Moved = YES
        End If

```
Add this to the bottom of modHandleData

```
Sub HandleWarpEvent(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    If Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Type = TILE_TYPE_WARPEVENT Then
If ReadINI(GetPlayerName(Index), "HasWarped" & GetPlayerMap(Index) & "," & GetPlayerX(Index) & "," & (GetPlayerY(Index)), App.Path & "\data\WarpEIT.Dat", "0") = "0" Then
            Call WriteINI(GetPlayerName(Index), "HasWarped" & GetPlayerMap(Index) & "," & GetPlayerX(Index) & "," & (GetPlayerY(Index)), "1", App.Path & "\data\WarpEvent.Dat")
        Call PlayerWarp(Index, Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data1, Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data2, Map(GetPlayerMap(Index)).Tile(GetPlayerX(Index), GetPlayerY(Index)).Data3)
        End If
    End If
End Sub

```

Search for

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

```
and under that put

```
HandleDataSub(CWarpEvent) = GetAddress(AddressOf HandleWarpEvent)

```
Some where near the top of modDatabase put

```
Public Sub WriteINI(INISection As String, INIKey As String, INIValue As String, INIFile As String)
    Call WritePrivateProfileString(INISection, INIKey, INIValue, INIFile)
End Sub

Public Function ReadINI(Section As String, KeyName As String, filename As String, Default As String) As String
    Dim sRet As String

    sRet = String$(255, Chr$(0))

    ReadINI = Left$(sRet, GetPrivateProfileString(Section, ByVal KeyName, Default, sRet, Len(sRet), filename))
End Function

```
THATS ALL! you are done and now u can use it :P if you have a problem lemme know i should know how to help ya fix it XD
Link to comment
Share on other sites

@ axis

Ahh… anyway... so this is the most complicated thing i have done bug free >.>
so lemme know when u added and to make sure its working test it and tell me the results... cuz i have added and removed from the notepad i was makin the tutorial on many times i mighta messed something up.. at least in the tutorial standard
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...