Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Quest System (Updated to use tiles)
#1
Okay, I've possessed myself to expand on this a bit.

Difficulty: 4/5 Requires knowledge of VB/MSE programming :evil:

Original Post can be found here: http://ms.shannaracorp.com/forums/viewtopic.php?t=174

The flag idea and quest was taken from Unkown_raven

This version of the code uses tile, which you can set with the Mapeditor. I'll give an example of how to set up each quest at the end of this tutorial. There are probably easier ways to do what I have but this works for me Smile.

Let's do the client side first:

Open up frmMirage

On picMapEditor add an option button to your attributes frame, name it optQuest.

Double click it and add this to the code:
Code:
Private Sub optQuest_Click()
    frmQuest.Show vbModal
End Sub

Now, Open up modGameLogic and in the Sub GameLoop find:

Code:
If .Type = TILE_TYPE_KEYOPEN Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "O", QBColor(White))

Under it add:

Code:
If .Type = TILE_TYPE_QUEST Then Call DrawText(TexthDC, x * PIC_X + 8, y * PIC_Y + 8, "Q", QBColor(BrightRed))

Then in Sub EditorMouseDown find:

Code:
If frmMirage.optKeyOpen.Value = True Then
                        .Type = TILE_TYPE_KEYOPEN
                        .Data1 = KeyOpenEditorX
                        .Data2 = KeyOpenEditorY
                        .Data3 = 0
                    End If

Under it, add:

Code:
If frmMirage.optQuest.Value = True Then
                        .Type = TILE_TYPE_QUEST
                        .Data1 = QuestEditorNum
                        .Data2 = 0
                        .Data3 = 0
                    End If

Now, open modConstants and find:

Code:
Public Const TILE_TYPE_KEYOPEN = 6

And under it, add:

Code:
Public Const TILE_TYPE_QUEST = 7

Now open modGlobals:

Anywhere in that module, add:
Code:
' Used for Quest Chooser
Public QuestEditorNum As Long

Okay, now we're going to create the form that will be used to choose which quest we want to start when the player walks over the specified tile.

So, add a new form and name it frmQuest

Add a scroll bar:
Name: scrlQuestNum
Max: 250

Add a Label:
Name: lblQuestNum

Add a command button:
Name: cmdOK
Caption: Okay

Add a command button:
Name: cmdCancel
Caption: Cancel

Double click the form and add the following:
Code:
Private Sub cmdOk_Click()
    QuestEditorNum = scrlQuestNum.Value
    Unload Me
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub scrlQuestNum_Change()
    lblQuestnum.Caption = STR(scrlQuestNum.Value)
End Sub

That's all for the client side. Now on to the server.

Open frmServer and add a new timer to it.
Name: QuestMapNotice
Enabled: False
Interval: 5000

Double click on it and add the following to its sub routine:
Code:
CHECKQUEST = True

Open modGameLogic and in the PlayerWarp sub find:
Code:
' Sets it so we know to process npcs on the map
    PlayersOnMap(MapNum) = YES

Under it, add:
Code:
frmServer.tmrQuestMapNotice.Enabled = True
    
    If CHECKQUEST = True Then
        If Dir(App.Path & "\Quest Maps\" & GetPlayerName(index) & ".ini")  "" Then
            If GetQuestMap(index, GetPlayerMap(index)) = 1 Then
                Call QuestMapData(index)
                frmServer.tmrQuestMapNotice.Enabled = False
            Else
                frmServer.tmrQuestMapNotice.Enabled = False
            End If
        End If
    End If

Now find:
Code:
' They tried to hack
    If Moved = NO Then
        Call HackingAttempt(index, "Position Modification")
    End If

And under it add:
Code:
If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_QUEST Then
        Call CheckQuestTile(index)
    End If

In Sub JoinGame, find:
Code:
' Warp the player to his saved location
    Call PlayerWarp(index, GetPlayerMap(index), GetPlayerX(index), GetPlayerY(index))

and under it add:

[code]
filename = App.Path & "\Flags\" & GetPlayerName(index) & ".ini"
If Dir(filename) = "" Then
Num = 1
'Change the 3 to number of flags you want per player
Do While Num
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)