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

[EO] Alatar's Quest System v1.2


Alatar
 Share

Recommended Posts

@Alatar:

> Oh that, if I remember well it's not coded.
>
> PS: I'm starting in my spare time to try to reproduce the bugs and find solutions to them.

Yay, also, can you put this in the main post :
@Erwin:

> I see, and its ok, I'll continue to find and fix bugs. ;)
>
> Alright, I've found the player killing bug, this should fix it:
>
> **Server side -> modCombat -> PlayerAttackPlayer**
> Change:
> ```
> 'ALATAR
> Call CheckTasks(attacker, QUEST_TYPE_GOKILL, 0)
> '/ALATAR
> ```
> To:
> ```
> 'ALATAR
> Call CheckTasks(attacker, QUEST_TYPE_GOKILL, victim)
> '/ALATAR
> ```
Link to comment
Share on other sites

  • Replies 703
  • Created
  • Last Reply

Top Posters In This Topic

:) Yep that's is the bug I think.

On the other hand, PEOPLE OF ECLIPSE, i will have some spare time tomorrow morning so I will program and launch the next version! Stay tuned (?)

EDIT: A little update, i've fixed almost everything that was reported, anyway there are some things that i'm not going to look now but I think its now working fine. I still have to do some work over here and then I'll upload the new version :)
Link to comment
Share on other sites

Version 1.1:

>! **Alatar's Quest System v1.1**
>! ![](http://i53.tinypic.com/2jfgbd5.jpg)
>! * * *
>! Hello and welcome. This is a tutorial for EO 2.0, and also includes the entire project if you wan't to use it right away without the need of following the tutorial. I've started with the idea of this system months ago, and although I abandon it a few times and moved to other things, finally in the past few days I've manage to finish it. I'm just learning to program like many here, so this was my first 'big' personal challenge. So please report any error or suggestion and I will try to do my best ^^
Ok, let's go to the important. (And please forgive me, English is not my main language)
>! **Features**
>! This quest system is a bit different to others due to the fact that it allow developers to create dinamyc quests with different purpose and itinerary, like "_go talk to X npc, then kill X amount of X npc, then talk to Y npc and gather X amount of X item, finally come back and talk to me_".
Each quest can have several tasks to do, each of one fully customizable. The quest system also has a fully working QuestLog and QuestSpeech window.
>! **Types of Tasks**
>! * **GoSlay**: Kill **X** amount of **X** npc's.
* **GoGather**: Gather **X** amount of **X** item.
* **GoTalk**: Interact with **X** npc.
* **GoTravel**: Reach **X** map.
* **GoGive**: Give **X** amount of **X** item to **X** npc.
* **GoKill**: Kill **X** amount of players.
* **GoTrain**: Hit **X** amount of times **X** resource.
* **GoGet**: Get **X** amount of **X** item from **X** npc.
>! **To-Do List**
>! * Fix a currency issue.
* Multiple rewards.
* Add "?" and "!" symbols.
>! **How it Works**
Temporary, it's working this way, but you could add buttons if you wish, and edit the ugly GUI forms and stuff. To open the Quest Editor type /editquest, to open the QuestLog press the white button.
>! **Changelog from v1.0 to v1.1**
>!
>! * New Quest Form.
* New QuestLog and QuestDialogue Form (still ugly, but works better).
* Fixed the GoGather Task that allowed an exploit by dropping and taking the item. Also re-coded the entire task to make it work better and fix other minor bugs.
* Fixed a GoTrain Task micro bug.
* Fixed and re-coded the GoGive Task.
* Fixed the GoKill bug that when a player kill another player the quests gets completed.
* Fixed the QuestLog issue that counts only for the first connected player.
* Fixed that when accepting a quest the questlog fails to update.
* Remove the NPC BEHAVIOUR QUEST, now handled with the friendly ones.
* Fixed a bug that wont allow to restart a quest if it was completed and then saved as repeatitive.
* Added the "Give-on-Start" and "Remove-on-the-end" item stuff.
* Fixed the GoSlay bug when counting enemies for quests.
* Added EXP reward.
>! Ok, let's go with the code.  :huh:
>! There are two ways to use this.
>! **Way 1**
[Download the full system](http://www.mediafire.com/?8oq70z4cq2qik26) already added to a blank EO and go test it. That's all, you don't need to follow the steps.
>! **Way 2**
Install the system on your own EO manually, following the steps below and **remember** to [download the extra files](http://www.mediafire.com/?g1gn1bosic8aan1) and add them to your project:
>! **Server Side**
>! **Add the modSvQuest to your project.**
>! **modCombat**
>! Find:
```
If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
```Above, after the Else, put
```
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            Call CheckTasks(attacker, QUEST_TYPE_GOTALK, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGIVE, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGET, npcNum)

                            If NPC(npcNum).Quest = YES Then
                                If CanStartQuest(attacker, NPC(npcNum).QuestNum) Then
                                    'if can start show the request message (chat1)
                                    QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(1)), NPC(npcNum).QuestNum
                                    Exit Function
                                End If
                                If QuestInProgress(attacker, NPC(npcNum).QuestNum) Then
                                    'if the quest is in progress show the meanwhile message (chat2)
                                    PlayerMsg attacker, Trim$(NPC(npcNum).Name) + ": " + Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), BrightGreen
                                    'QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), 0
                                    Exit Function
                                End If
                            End If
                        End If
```
Sub PlayerAttackNpc, find:
```
' send death to the map
```Above place this:
```
Call CheckTasks(attacker, QUEST_TYPE_GOSLAY, npcNum)
```
Sub PlayerAttackNpc, find:
```
Call OnDeath(victim)
```Above place this:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, victim)
```
**modGeneral**
>! In InitServer find:
```
ChkDir App.Path & "\Data\", "spells"
```past this below:
```
ChkDir App.Path & "\Data\", "quests"
```
In ClearGameData find:
```
Call ClearAnimations
```past this below:
```
Call SetStatus("Clearing quests...")
Call ClearQuests
```
In LoadGameData find:
```
Call LoadAnimations
```past this below:
```
Call SetStatus("Loading quests...")
Call LoadQuests
```
**modHandleData**
>! Find:
```
HandleDataSub(CPartyLeave) = GetAddress(AddressOf HandlePartyLeave)
```Paste:
```
HandleDataSub(CRequestEditQuest) = GetAddress(AddressOf HandleRequestEditQuest)
    HandleDataSub(CSaveQuest) = GetAddress(AddressOf HandleSaveQuest)
    HandleDataSub(CRequestQuests) = GetAddress(AddressOf HandleRequestQuests)
    HandleDataSub(CPlayerHandleQuest) = GetAddress(AddressOf HandlePlayerHandleQuest)
    HandleDataSub(CQuestLogUpdate) = GetAddress(AddressOf HandleQuestLogUpdate)
```
At the end of the module add this:
>! ```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
>!     ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If
>!     Set Buffer = New clsBuffer
    Buffer.WriteLong SQuestEditor
    SendDataTo Index, Buffer.ToArray()
    Set Buffer = Nothing
End Sub
>! Sub HandleSaveQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    Dim Buffer As clsBuffer
    Dim QuestSize As Long
    Dim QuestData() As Byte
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
>!     ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If
>!     n = Buffer.ReadLong 'CLng(Parse(1))
>!     If n < 0 Or n > MAX_QUESTS Then
        Exit Sub
    End If

    ' Update the Quest
    QuestSize = LenB(Quest(n))
    ReDim QuestData(QuestSize - 1)
    QuestData = Buffer.ReadBytes(QuestSize)
    CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
    Set Buffer = Nothing

    ' Save it
    Call SendUpdateQuestToAll(n)
    Call SaveQuest(n)
    Call AddLog(GetPlayerName(Index) & " saved Quest #" & n & ".", ADMIN_LOG)
End Sub
>! Sub HandleRequestQuests(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    SendQuests Index
End Sub
>! Sub HandlePlayerHandleQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim QuestNum As Long, Order As Long, i As Long

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    QuestNum = Buffer.ReadLong
    Order = Buffer.ReadLong '1 = accept, 2 = cancel

    If Order = 1 Then
        Player(Index).PlayerQuest(QuestNum).Status = QUEST_STARTED '1
        Player(Index).PlayerQuest(QuestNum).ActualTask = 1
        Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
        PlayerMsg Index, "New quest accepted: " & Trim$(Quest(QuestNum).Name) & "!", BrightGreen
        'Add item on start
        If Quest(QuestNum).QuestGiveItem > 0 And Quest(QuestNum).QuestGiveItem < MAX_ITEMS Then
            If Quest(QuestNum).QuestGiveItemValue > 0 And Quest(QuestNum).QuestGiveItemValue < MAX_INV Then 'ToDo: stuff with currency
                GiveInvItem Index, Quest(QuestNum).QuestGiveItem, Quest(QuestNum).QuestGiveItemValue
            End If
        End If

    ElseIf Order = 2 Then
        Player(Index).PlayerQuest(QuestNum).Status = QUEST_NOT_STARTED '2
        Player(Index).PlayerQuest(QuestNum).ActualTask = 1
        Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
        PlayerMsg Index, Trim$(Quest(QuestNum).Name) & " has been canceled!", BrightGreen
    End If

    SavePlayer Index
    SendPlayerData Index
    SendPlayerQuests Index

    Set Buffer = Nothing
End Sub
>! Sub HandleQuestLogUpdate(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    SendPlayerQuests Index
End Sub
```
**modTypes**
>! In Private Type PlayerRec, find:
```
Dir As Byte
```Paste:
```
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec
```
In Private Type NpcRec, find:
```
Level As Long
```Paste:
```
Quest As Byte
    QuestNum As Long
```
**modEnumerations**
>! Find:
```
SPartyVitals
```Paste:
```
    SQuestEditor
    SUpdateQuest
    SPlayerQuest
    SQuestMessage
```
Find:
```
CPartyLeave
```Paste:
```
    CRequestEditQuest
    CSaveQuest
    CRequestQuests
    CPlayerHandleQuest
    CQuestLogUpdate
```
**modPlayer**
>! Find:
```
Call SendHotbar(Index)
```Paste:
```
Call SendQuests(Index)
```
In PlayerWarp, find:
```
TempPlayer(Index).GettingMap = YES
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOREACH, mapNum)
```
In PlayerMapGetItem, find:
```
SendActionMsg GetPlayerMap(Index), Msg, White, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOGATHER, GetItemNum(Trim$(Item(GetPlayerInvItemNum(Index, n)).Name)))
```
In CheckResource find:
```
SendMapSound Index, rX, rY, SoundEntity.seResource, Resource_index
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOTRAIN, Resource_index)
```
>! **Client Side**
>! **Add the modQuests to your project.
Add the frmEditor_Quest to your project.
Replace your frmEditor_NPC and frmMain with the ones that I provide you.**
>! **modGameEditors**
>! In NpcEditorInit find:
```
.txtDamage.text = NPC(EditorIndex).Damage
```Paste:
```
.chkQuest.Value = NPC(EditorIndex).Quest
        .scrlQuest.Value = NPC(EditorIndex).QuestNum
```
**modEnumerations**
>! Find:
```
SPartyVitals
```Paste:
```
    SQuestEditor
    SUpdateQuest
    SPlayerQuest
    SQuestMessage
```
Find:
```
CPartyLeave
```Paste:
```
    CRequestEditQuest
    CSaveQuest
    CRequestQuests
    CPlayerHandleQuest
    CQuestLogUpdate
```
**modHandleData**
>! Find:
```
HandleDataSub(SPartyVitals) = GetAddress(AddressOf HandlePartyVitals)
```Paste:
```
    HandleDataSub(SQuestEditor) = GetAddress(AddressOf HandleQuestEditor)
    HandleDataSub(SUpdateQuest) = GetAddress(AddressOf HandleUpdateQuest)
    HandleDataSub(SPlayerQuest) = GetAddress(AddressOf HandlePlayerQuest)
    HandleDataSub(SQuestMessage) = GetAddress(AddressOf HandleQuestMessage)
```
At the end of the module, past this:
```
Private Sub HandleQuestEditor()
    Dim i As Long

    With frmEditor_Quest
        Editor = EDITOR_TASKS
        .lstIndex.Clear
>!         ' Add the names
        For i = 1 To MAX_QUESTS
            .lstIndex.AddItem i & ": " & Trim$(Quest(i).Name)
        Next
>!         .Show
        .lstIndex.ListIndex = 0
        QuestEditorInit
    End With
>! End Sub
>! Private Sub HandleUpdateQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    Dim Buffer As clsBuffer
    Dim QuestSize As Long
    Dim QuestData() As Byte
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    n = Buffer.ReadLong
    ' Update the Quest
    QuestSize = LenB(Quest(n))
    ReDim QuestData(QuestSize - 1)
    QuestData = Buffer.ReadBytes(QuestSize)
    CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
    Set Buffer = Nothing
End Sub
>! Private Sub HandlePlayerQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim i As Long
>!     Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()

    For i = 1 To MAX_QUESTS
        Player(MyIndex).PlayerQuest(i).Status = Buffer.ReadLong
        Player(MyIndex).PlayerQuest(i).ActualTask = Buffer.ReadLong
        Player(MyIndex).PlayerQuest(i).CurrentCount = Buffer.ReadLong
    Next

    RefreshQuestLog

    Set Buffer = Nothing
End Sub
>! Private Sub HandleQuestMessage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim i As Long, QuestNum As Long, QuestNumForStart As Long
    Dim Message As String

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    QuestNum = Buffer.ReadLong
    Message = Trim$(Buffer.ReadString)
    QuestNumForStart = Buffer.ReadLong

    frmMain.lblQuestName = Trim$(Quest(QuestNum).Name)
    frmMain.lblQuestSay = Message
    frmMain.picQuestDialogue.Visible = True

    If QuestNumForStart > 0 And QuestNumForStart <= MAX_QUESTS Then
        frmMain.lblQuestAccept.Visible = True
        frmMain.lblQuestAccept.Tag = QuestNumForStart
    End If

    Set Buffer = Nothing
End Sub
```
**modInput**
>! Find:
```
SendRequestEditSpell
```Paste:
```
                Case "/editquest"
                    If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue
                    SendRequestEditQuest
```
**modTypes**
>! In Private Type PlayerRec, find:
```
Step As Byte
```Paste:
```
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec
```
In Private Type NpcRec, find:
```
Level As Long
```Paste:
```
    Quest As Byte
    QuestNum As Long
```
>! * * *
>! And that's all! Tell me if anything goes wrong. I hope that this system could be useful to your project, and if you use it please give credits  ;)
>! **_- Alatar_**
>! * * *
>! Special thanks to Erwin and people who help here bugfixing while I was inactive. :)
And to the people who reported bugs ^^
>! * * *
>! **All Versions**
>! * Alatar's Quest System v1.1: [Link](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809248.html#msg809248)
* Alatar's Quest System v1.0: [Link](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg758371.html#msg758371).
>! * * *
>! **Extras**
>! * [Convert quests from v1.0 to v1.1](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809345.html#msg809345)
* [Update your whole system from v1.0 to v1.1](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809347.html#msg809347)

**Changelog**:

* New Quest Form.
* New QuestLog and QuestDialogue Form (still ugly, but works better).
* Fixed the GoGather Task that allowed an exploit by dropping and taking the item. Also re-coded the entire task to make it work better and fix other minor bugs.
* Fixed a GoTrain Task micro bug.
* Fixed and re-coded the GoGive Task.
* Fixed the GoKill bug that when a player kill another player the quests gets completed.
* Fixed the QuestLog issue that counts only for the first connected player.
* Fixed that when accepting a quest the questlog fails to update.
* Remove the NPC BEHAVIOUR QUEST, now handled with the friendly ones.
* Fixed a bug that wont allow to restart a quest if it was completed and then saved as repeatitive.
* Added the "Give-on-Start" and "Remove-on-the-end" item stuff.
* Fixed the GoSlay bug when counting enemies for quests.
* Added EXP reward.
Link to comment
Share on other sites

so i tested the demo out.  seems to work.  looks like me and anyone else will have to take the old tut out and put the new one in its place.  not just 1 section you can replace.  also i belive all quests will have to be deleted to use this.  if im wrong please say so because i really dont want to redo all mine if i dont have to.
Link to comment
Share on other sites

nice work alatar :) thank you, here are a few questions/concerns that i have tho.

1) is there a way that we would be able to use the same NPC for different quests? like we get done with one quest and then we go back to that NPC that gave us the quest, can we get a new quest from that NPC? (if you dont understand i can explain it more in detail.

2) is there a way that we can put a ! or a ? over the NPC to let us know that there is a quest available or already in progress?

Thanks again
Link to comment
Share on other sites

Hmm, now i'm thinking on making a small tut to port the v1.0 to v1.1.

On the other hand, i've changed a few stuff on how the data is stored so yep, you people are going to re-do the quests/npc's or make a converter.

@Chukillz:

> nice work alatar :) thank you, here are a few questions/concerns that i have tho.
>
> 1) is there a way that we would be able to use the same NPC for different quests? like we get done with one quest and then we go back to that NPC that gave us the quest, can we get a new quest from that NPC? (if you dont understand i can explain it more in detail.
>
> 2) is there a way that we can put a ! or a ? over the NPC to let us know that there is a quest available or already in progress?
>
> Thanks again

1) No in the way the system is coded, for now each npc can only give one quest.

2) Hmm looks nice. I will add it to the to-do list.
Link to comment
Share on other sites

**IMPORTANT**:

I made a converter that transfers the files from v1.0 to the new format in v1.1
**Download here**: http://www.mediafire.com/?s1npryuo6hganio
(I'm also including the source in case you've done source edit to the UDT).

**How it works?**
Simple, first paste in the correct folders the files you want to convert (example, you have Quest1.dat, Quest2.dat and Quest3.dat from your v0.1, copy+paste them in the "quests_1_0" folder).
Open the program then select if you wan't to convert NPCs or Quests from the v0.1, now select the starting value (in this case will be 1) and the limit value (in this case 3) and run. If everything goes okay, open the _1_1 folder (in this case the "quests_1_1") and you will have there the converted files. Copy+paste them in the proper folder in your server/data and that's it :)
Link to comment
Share on other sites

**Update your Quest System from v1.0 to v1.1**

Some people asked for a simple tutorial that update their previous version without having to restart all of that stuff :)

**First of all**:
Download the **Extra Files** and past them in the correct places. [modSvQuest -> [b]Server] [modQuest + frmEditor_Quest + (replace frmEditor_NPC & frmMain) -> [b]Client]

**Server**

**modCombat**

In Sub CanPlayerAttackNpc find:
```
If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_QUEST Then
```Replace with:
```
If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
```Note: there are 2 of this, replace both!

Find:
If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
Replace the:
```
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then
                            Call ShowQuest(attacker, NPC(npcNum).QuestNum)
                            Exit Function
                        End If
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            Call CheckTasks(attacker, QUEST_TYPE_GOTALK, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGIVE, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGET, npcNum)
                        End If
```With this:
```
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            Call CheckTasks(attacker, QUEST_TYPE_GOTALK, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGIVE, npcNum)
                            Call CheckTasks(attacker, QUEST_TYPE_GOGET, npcNum)

                            If NPC(npcNum).Quest = YES Then
                                If CanStartQuest(attacker, NPC(npcNum).QuestNum) Then
                                    'if can start show the request message (chat1)
                                    QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(1)), NPC(npcNum).QuestNum
                                    Exit Function
                                End If
                                If QuestInProgress(attacker, NPC(npcNum).QuestNum) Then
                                    'if the quest is in progress show the meanwhile message (chat2)
                                    PlayerMsg attacker, Trim$(NPC(npcNum).Name) + ": " + Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), BrightGreen
                                    'QuestMessage attacker, NPC(npcNum).QuestNum, Trim$(Quest(NPC(npcNum).QuestNum).Chat(2)), 0
                                    Exit Function
                                End If
                            End If
                        End If
```
Sub PlayerAttackNpc, find:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, 0)
```Replace with:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, victim)
```
**modHandleData**

Go to the end of the sub, delete everything from this line to the bottom:
```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
```And paste this:
```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    Set Buffer = New clsBuffer
    Buffer.WriteLong SQuestEditor
    SendDataTo Index, Buffer.ToArray()
    Set Buffer = Nothing
End Sub

Sub HandleSaveQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    Dim Buffer As clsBuffer
    Dim QuestSize As Long
    Dim QuestData() As Byte
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()

    ' Prevent hacking
    If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
        Exit Sub
    End If

    n = Buffer.ReadLong 'CLng(Parse(1))

    If n < 0 Or n > MAX_QUESTS Then
        Exit Sub
    End If

    ' Update the Quest
    QuestSize = LenB(Quest(n))
    ReDim QuestData(QuestSize - 1)
    QuestData = Buffer.ReadBytes(QuestSize)
    CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
    Set Buffer = Nothing

    ' Save it
    Call SendUpdateQuestToAll(n)
    Call SaveQuest(n)
    Call AddLog(GetPlayerName(Index) & " saved Quest #" & n & ".", ADMIN_LOG)
End Sub

Sub HandleRequestQuests(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    SendQuests Index
End Sub

Sub HandlePlayerHandleQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim QuestNum As Long, Order As Long, i As Long

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    QuestNum = Buffer.ReadLong
    Order = Buffer.ReadLong '1 = accept, 2 = cancel

    If Order = 1 Then
        Player(Index).PlayerQuest(QuestNum).Status = QUEST_STARTED '1
        Player(Index).PlayerQuest(QuestNum).ActualTask = 1
        Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
        PlayerMsg Index, "New quest accepted: " & Trim$(Quest(QuestNum).Name) & "!", BrightGreen
        'Add item on start
        If Quest(QuestNum).QuestGiveItem > 0 And Quest(QuestNum).QuestGiveItem < MAX_ITEMS Then
            If Quest(QuestNum).QuestGiveItemValue > 0 And Quest(QuestNum).QuestGiveItemValue < MAX_INV Then 'ToDo: stuff with currency
                GiveInvItem Index, Quest(QuestNum).QuestGiveItem, Quest(QuestNum).QuestGiveItemValue
            End If
        End If

    ElseIf Order = 2 Then
        Player(Index).PlayerQuest(QuestNum).Status = QUEST_NOT_STARTED '2
        Player(Index).PlayerQuest(QuestNum).ActualTask = 1
        Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
        PlayerMsg Index, Trim$(Quest(QuestNum).Name) & " has been canceled!", BrightGreen
    End If

    SavePlayer Index
    SendPlayerData Index
    SendPlayerQuests Index

    Set Buffer = Nothing
End Sub

Sub HandleQuestLogUpdate(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    SendPlayerQuests Index
End Sub
```
**modTypes**

In Private Type NpcRec, find:
```
QuestNum As Long
```Replace with:
```
Quest As Byte
    QuestNum As Long
```

**Client**

**modGameEditors**

Find:
```
.scrlQuest.Value = NPC(EditorIndex).QuestNum
```Replace with:
```
.chkQuest.Value = NPC(EditorIndex).Quest
        .scrlQuest.Value = NPC(EditorIndex).QuestNum
```
**modHandleData**

Go to the end of the sub, delete everything from this line to the bottom:
```
Private Sub HandleQuestEditor()
```And paste this:
```
Private Sub HandleQuestEditor()
    Dim i As Long

    With frmEditor_Quest
        Editor = EDITOR_TASKS
        .lstIndex.Clear

        ' Add the names
        For i = 1 To MAX_QUESTS
            .lstIndex.AddItem i & ": " & Trim$(Quest(i).Name)
        Next

        .Show
        .lstIndex.ListIndex = 0
        QuestEditorInit
    End With

End Sub

Private Sub HandleUpdateQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim n As Long
    Dim Buffer As clsBuffer
    Dim QuestSize As Long
    Dim QuestData() As Byte
    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    n = Buffer.ReadLong
    ' Update the Quest
    QuestSize = LenB(Quest(n))
    ReDim QuestData(QuestSize - 1)
    QuestData = Buffer.ReadBytes(QuestSize)
    CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
    Set Buffer = Nothing
End Sub

Private Sub HandlePlayerQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim i As Long

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()

    For i = 1 To MAX_QUESTS
        Player(MyIndex).PlayerQuest(i).Status = Buffer.ReadLong
        Player(MyIndex).PlayerQuest(i).ActualTask = Buffer.ReadLong
        Player(MyIndex).PlayerQuest(i).CurrentCount = Buffer.ReadLong
    Next

    RefreshQuestLog

    Set Buffer = Nothing
End Sub

Private Sub HandleQuestMessage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
    Dim Buffer As clsBuffer
    Dim i As Long, QuestNum As Long, QuestNumForStart As Long
    Dim Message As String

    Set Buffer = New clsBuffer
    Buffer.WriteBytes Data()
    QuestNum = Buffer.ReadLong
    Message = Trim$(Buffer.ReadString)
    QuestNumForStart = Buffer.ReadLong

    frmMain.lblQuestName = Trim$(Quest(QuestNum).Name)
    frmMain.lblQuestSay = Message
    frmMain.picQuestDialogue.Visible = True

    If QuestNumForStart > 0 And QuestNumForStart <= MAX_QUESTS Then
        frmMain.lblQuestAccept.Visible = True
        frmMain.lblQuestAccept.Tag = QuestNumForStart
    End If

    Set Buffer = Nothing
End Sub
```
**modTypes**

In Private Type NpcRec, find:
```
QuestNum As Long
```Replace with:
```
    Quest As Byte
    QuestNum As Long
```

And that's all. I think :P,  I haven't test it but I think it will work.
Link to comment
Share on other sites

=o OH i remembered something important =D

I wrote a snipit of code that lets pets from lightning's pet system do the killing of stuff for you and your still get the rewards XD

PM me if your interested.

* * *

PS.

>.> ALATAR… I should slap you.

you STILL haven't ever gotten past using MAX_BYTE for rewards, USE MAX_INTEGER YOU TWIT!

I NO ONE WANTS TO TOP OUT AT 255 FOR EXP REWARDS!
Link to comment
Share on other sites

@Ryoku:

> >.> ALATAR… I should slap you.
>
> you STILL haven't ever gotten past using MAX_BYTE for rewards, USE MAX_INTEGER YOU TWIT!
>
> I NO ONE WANTS TO TOP OUT AT 255 FOR EXP REWARDS!

Oh you're right! lol my bad
I wasn't focusing too much on the reward stuff for this release :P
Link to comment
Share on other sites

hey alatar do you have the post for v1.0 still? maybe you can email it to me or something? also what do i do if i have added things to my frmMain? i would have to go and re add everything wouldnt i? would you be able to show the code and stuff that you did to it? or would i have to go through and try to find it my self?
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...