Universo Games
Ola , Convidado



Você ainda não e cadastrado então cadastre-se e veja todas as atualizações no mundo rpg!!!
Universo Games

Suporte e Desenvolvimento só no Universo Games

Ola Convidado, Seja Bem vindo a equipe lhe deseja boa sorte no seu projeto!

Você não está conectado. Conecte-se ou registre-se

Quest Editor

Ver o tópico anterior Ver o tópico seguinte Ir em baixo  Mensagem [Página 1 de 1]

1Tutorial Quest Editor em Dom 12 Set 2010, 20:13

Thales12


Membro
Membro
Esse tutorial vai mostrar como instalar o editor de quest do EP em outra engine.
É NECESSÁRIO UM PRÉVIO ENTENDIMENTO DE PROGRAMAÇÃO!

Iremos começar pelo Client~Side

FrmQuest
FrmQuestEditor

1) Baixe e instale as duas forms do editor.
2) Cole esse código no final modGeneral.

Código:
Public Sub QuestEditorOk()
    Quest(EditorIndex).Name = frmQuestEditor.txtName.Text
    Quest(EditorIndex).After = frmQuestEditor.txtafter.Text
    Quest(EditorIndex).Before = frmQuestEditor.txtbefore.Text
    Quest(EditorIndex).ClassIsReq = frmQuestEditor.chkcls.Value
    Quest(EditorIndex).ClassReq = frmQuestEditor.lstclass.ListIndex
    Quest(EditorIndex).During = frmQuestEditor.txtduring.Text
    Quest(EditorIndex).End = frmQuestEditor.txtend.Text
    Quest(EditorIndex).ItemReq = frmQuestEditor.scrlquestitem.Value
    Quest(EditorIndex).NPCTarget = frmQuestEditor.scrlnpc.Value
    Quest(EditorIndex).NPCTargetValue = frmQuestEditor.scrlnpcqt.Value
    If Item(frmQuestEditor.scrlquestitem.Value).Type = 12 Then
        Quest(EditorIndex).ItemVal = frmQuestEditor.scrlquestvalue.Value
    Else
        Quest(EditorIndex).ItemVal = 1
    End If
    Quest(EditorIndex).LevelIsReq = frmQuestEditor.chklvl
    Quest(EditorIndex).LevelReq = frmQuestEditor.scrllvl.Value
    Quest(EditorIndex).NotHasItem = frmQuestEditor.txtnotitem.Text
    Quest(EditorIndex).RewardNum = frmQuestEditor.scrlrewitem.Value
    Quest(EditorIndex).RewardVal = frmQuestEditor.scrlrewval.Value
    Quest(EditorIndex).Start = frmQuestEditor.txtstart.Text
    Quest(EditorIndex).StartItem = frmQuestEditor.scrlstartnum.Value
    Quest(EditorIndex).StartOn = frmQuestEditor.chkstart.Value
    Quest(EditorIndex).Startval = frmQuestEditor.scrlstartval
 
    Call SendSaveQuest(EditorIndex)
    Call QuestEditorCancel
 
End Sub

Public Sub QuestEditorInit()
On Error Resume Next
Dim I As Long

    frmQuestEditor.txtName.Text = Trim(Quest(EditorIndex).Name)
    frmQuestEditor.chkcls.Value = Quest(EditorIndex).ClassIsReq
    frmQuestEditor.chklvl.Value = Quest(EditorIndex).LevelIsReq
    frmQuestEditor.txtafter.Text = Quest(EditorIndex).After
    frmQuestEditor.txtbefore.Text = Quest(EditorIndex).Before
    frmQuestEditor.txtduring.Text = Quest(EditorIndex).During
    frmQuestEditor.txtend.Text = Quest(EditorIndex).End
    frmQuestEditor.txtstart.Text = Quest(EditorIndex).Start
    frmQuestEditor.txtnotitem.Text = Quest(EditorIndex).NotHasItem
    frmQuestEditor.scrlnpcqt.Value = Quest(EditorIndex).NPCTargetValue
    frmQuestEditor.scrlnpc.Value = Quest(EditorIndex).NPCTarget
 
    If Quest(EditorIndex).NPCTarget > 0 Then
    frmQuestEditor.lblnpc.Caption = Npc(Quest(EditorIndex).NPCTarget).Name
    Else
    frmQuestEditor.lblnpc.Caption = "Nenhum"
    End If
 
    If Quest(EditorIndex).LevelIsReq = 1 Then
        frmQuestEditor.scrllvl.Value = Quest(EditorIndex).LevelReq
        frmQuestEditor.lblLevel.Caption = frmQuestEditor.scrllvl.Value
        frmQuestEditor.chklvl.Value = 1
        frmQuestEditor.scrllvl.Enabled = True
    Else
        'frmQuestEditor.scrllvl.value = 1
        frmQuestEditor.lblLevel.Caption = "1"
        frmQuestEditor.scrllvl.Enabled = False
        frmQuestEditor.chklvl.Value = 0
    End If
 
    For I = 0 To Max_Classes
    frmQuestEditor.lstclass.addItem (I & ":" & Class(I).Name)
    Next I
 
    If Quest(EditorIndex).ClassIsReq = 1 Then
        frmQuestEditor.lstclass.ListIndex = Quest(EditorIndex).ClassReq
        frmQuestEditor.chkcls.Value = 1
        frmQuestEditor.lstclass.Enabled = True
    Else
        frmQuestEditor.chkcls.Value = 0
        frmQuestEditor.lstclass.Enabled = False
        frmQuestEditor.lstclass.ListIndex = 0
    End If
 
    If Quest(EditorIndex).StartOn = 1 Then
        frmQuestEditor.scrlstartnum.Value = Quest(EditorIndex).StartItem
        frmQuestEditor.scrlstartval.Value = Quest(EditorIndex).Startval
        frmQuestEditor.lblstartitem = Quest(EditorIndex).StartItem & ":" & Item(Quest(EditorIndex).StartItem).Name
        frmQuestEditor.lblstartval = Quest(EditorIndex).Startval
        frmQuestEditor.chkstart.Value = 1
        If Item(frmQuestEditor.scrlstartnum.Value).Type = 12 Then
            frmQuestEditor.scrlstartval.Enabled = True
            frmQuestEditor.lblstartval.Caption = frmQuestEditor.scrlstartval.Value
        Else
            frmQuestEditor.scrlstartval.Enabled = False
            frmQuestEditor.lblstartval.Caption = "1"
        End If
    Else
        frmQuestEditor.scrlstartnum.Value = 1
        frmQuestEditor.scrlstartval.Value = 1
        frmQuestEditor.scrlstartnum.Enabled = False
        frmQuestEditor.scrlstartval.Enabled = False
        frmQuestEditor.lblstartitem = "Disabled"
        frmQuestEditor.lblstartval = "Disabled"
        frmQuestEditor.chkstart.Value = 0
    End If

        frmQuestEditor.scrlquestitem.Value = Quest(EditorIndex).ItemReq
        frmQuestEditor.scrlquestvalue.Value = Quest(EditorIndex).ItemVal
        frmQuestEditor.lblquestitem.Caption = Quest(EditorIndex).ItemReq & ":" & Item(Quest(EditorIndex).ItemReq).Name
        frmQuestEditor.lblquestval.Caption = Quest(EditorIndex).ItemVal

        If Item(frmQuestEditor.scrlquestitem.Value).Type = 12 Then
            frmQuestEditor.scrlquestvalue.Enabled = True
            frmQuestEditor.lblquestval.Caption = frmQuestEditor.scrlstartval.Value
        Else
            frmQuestEditor.scrlquestvalue.Enabled = False
            frmQuestEditor.lblquestval.Caption = "1"
        End If
 
        frmQuestEditor.scrlrewitem.Value = Quest(EditorIndex).RewardNum
        frmQuestEditor.scrlrewval.Value = Quest(EditorIndex).RewardVal
        frmQuestEditor.lblrewitem.Caption = Quest(EditorIndex).RewardNum & ":" & Item(Quest(EditorIndex).RewardNum).Name
        frmQuestEditor.lblrewval.Caption = Quest(EditorIndex).RewardVal

        If Item(frmQuestEditor.scrlrewitem.Value).Type = 12 Then
            frmQuestEditor.scrlrewval.Enabled = True
            frmQuestEditor.lblrewval.Caption = frmQuestEditor.scrlrewval.Value
        Else
            frmQuestEditor.scrlrewval.Enabled = False
            frmQuestEditor.lblrewval.Caption = "1"
        End If
 
    frmQuestEditor.Show vbModeless, frmMirage
End Sub
Sub SendRequestEditQuest()
    Call SendData("requesteditquest" & END_CHAR)
End Sub
Public Sub QuestEditorCancel()
    InQuestEditor = False
    Unload frmQuestEditor
End Sub

No topo desse mod, adicione:

Código:
Public InQuestEditor As Boolean
Public Quest(0 To MAX_QUESTS) As QuestRec
Public Const MAX_QUESTS = 500

3) Abra frmadimin e ponha um command box escrito: Editor de Quest
Dentro dele, ponha o código:

Código:
If GetPlayerAccess(MyIndex) >= ADMIN_DEVELOPER Then
Call SendRequestEditQuest
Else: Call AddText("You are not authorized to carry out that action", BRIGHTRED)
End If

4) No modHandleData, vá para sub HandleData. Nele, adicione esses packets:

Código:
If (casestring = "questeditor") Then
        InQuestEditor = True

        frmIndex.Show
        frmIndex.lstIndex.Clear

        ' Add the names
        For I = 1 To MAX_QUESTS
            frmIndex.lstIndex.addItem I & ": " & Trim(Quest(I).Name)
        Next I

        frmIndex.lstIndex.ListIndex = 0
        Exit Sub
    End If
    ' :::::::::::::::::::::::::
    ' :: Update quest packet ::
    ' :::::::::::::::::::::::::
    If (casestring = "updatequest") Then
        n = Val(parse(1))

        'Update the quest
        Quest(n).Name = parse(2)
        Quest(n).After = parse(3)
        Quest(n).Before = parse(4)
        Quest(n).ClassIsReq = Val(parse(5))
        Quest(n).ClassReq = Val(parse(6))
        Quest(n).During = parse(7)
        Quest(n).End = parse(8)
        Quest(n).ItemReq = Val(parse(9))
        Quest(n).ItemVal = Val(parse(10))
        Quest(n).LevelIsReq = Val(parse(11))
        Quest(n).LevelReq = Val(parse(12))
        Quest(n).NotHasItem = parse(13)
        Quest(n).RewardNum = Val(parse(14))
        Quest(n).RewardVal = Val(parse(15))
        Quest(n).Start = parse(16)
        Quest(n).StartItem = Val(parse(17))
        Quest(n).StartOn = Val(parse(18))
        Quest(n).Startval = Val(parse(19))
        Quest(n).NPCTarget = Val(parse(20))
        Quest(n).NPCTargetValue = Val(parse(21))
    End If

    ' :::::::::::::::::::::::
    ' :: Edit quest packet :: <- Used for quest editor admins only
    ' :::::::::::::::::::::::
    If (casestring = "editquest") Then
        n = Val(parse(1))

        'Update the quest
        Quest(n).Name = parse(2)
        Quest(n).After = parse(3)
        Quest(n).Before = parse(4)
        Quest(n).ClassIsReq = Val(parse(5))
        Quest(n).ClassReq = Val(parse(6))
        Quest(n).During = parse(7)
        Quest(n).End = parse(8)
        Quest(n).ItemReq = Val(parse(9))
        Quest(n).ItemVal = Val(parse(10))
        Quest(n).LevelIsReq = Val(parse(11))
        Quest(n).LevelReq = Val(parse(12))
        Quest(n).NotHasItem = parse(13)
        Quest(n).RewardNum = Val(parse(14))
        Quest(n).RewardVal = Val(parse(15))
        Quest(n).Start = parse(16)
        Quest(n).StartItem = Val(parse(17))
        Quest(n).StartOn = Val(parse(18))
        Quest(n).Startval = Val(parse(19))
        Quest(n).NPCTarget = Val(parse(20))
        Quest(n).NPCTargetValue = Val(parse(21))

        ' Initialize the item editor
        QuestEditorInit

        Exit Sub
    End If
    If (casestring = "questmsg") Then
    Call AddQuestText(parse(1), Val(parse(2)))
    frmQuest.Show
    Exit Sub
    End If
 
    If casestring = "questprompt" Then
        Dim Awnser2 As Variant
     
        Awnser2 = MsgBox(Quest(parse(1)).During, vbYesNo, Quest(parse(1)).Name)
        If Awnser2 = 7 Then
         
        Else
            If HasItem(Quest(parse(1)).ItemReq, Quest(parse(1)).ItemVal) Then
                If Quest(parse(1)).NPCTarget > 0 Then
                  If Val(parse(3)) = Quest(parse(1)).NPCTargetValue Then
                      Call SendData("questdone" & SEP_CHAR & parse(1) & SEP_CHAR & MyIndex & SEP_CHAR & parse(2) & SEP_CHAR & END_CHAR)
                      Exit Sub
                  Else
                      Call MsgBox(Quest(parse(1)).NotHasItem, vbInformation, Quest(parse(1)).Name)
                      Exit Sub
                  End If
                End If
              Call SendData("questdone" & SEP_CHAR & parse(1) & SEP_CHAR & MyIndex & SEP_CHAR & parse(2) & SEP_CHAR & END_CHAR)
            Else
              Call MsgBox(Quest(parse(1)).NotHasItem, vbInformation, Quest(parse(1)).Name)
            End If
        End If
    End If

5) Abra frmIndex
No cmdOk_Click, adicione:

Código:
    If InQuestEditor = True Then
        Call SendData("EDITQUEST" & SEP_CHAR & EditorIndex & SEP_CHAR & END_CHAR)
    End If

No cmdCancel_Click, adicione:

Código:
InQuestEditor = False

6) No modTypes, adicione:

Código:
Type QuestRec
    Name As String
    LevelIsReq As Byte
    ClassIsReq As Byte
    StartOn As Byte
    LevelReq As Integer
    ClassReq As Integer

    StartItem As Long
    Startval As Long
    ItemReq As Long
    ItemVal As Long
    RewardNum As Long
    RewardVal As Long
    Start As String
    End As String
    During As String
    NotHasItem As String
    Before As String
    After As String
    NPCTarget As Long
    NPCTargetValue As Long
End Type

7) vá ao editor de NPCs, crie uma scroll e chame-a de scrlquest
Cool Procure por NpcEditorOk. Nele adicione:

Código:
Npc(EditorIndex).Quest = frmNpcEditor.scrlquest.Value

9) Vá té SendSaveNPC. Adicione no final da primeira linha, que determina o packet

Código:
& SEP_CHAR & Npc(NpcNum).Quest

10) Procure por:

Código:
If (casestring = "editnpc") Then

Abaixo de:

Código:
Npc(n).SpriteSize = Val(parse(17))

Adicione:

Código:
Npc(n).Quest = Val(parse(18))

Terminamos o Client

agora o Server~Side

1) Adicione no modServerTCP:

Código:
Sub SendQuest(ByVal index As Long)
'Dim Packet As String
Dim i As Long

    For i = 1 To MAX_QUESTS
        If Trim(Quest(i).Name) <> "" Then
            Call SendUpdateQuestTo(index, i)
        End If
    Next i
End Sub

Sub SendUpdateQuestToAll(ByVal questnum As Long)
Dim Packet As String

    Packet = "UPDATEQUEST" & SEP_CHAR & questnum & SEP_CHAR & Trim(Quest(questnum).Name) & SEP_CHAR & Trim(Quest(questnum).After) & SEP_CHAR & Trim(Quest(questnum).Before) & SEP_CHAR & Quest(questnum).ClassIsReq & SEP_CHAR & Quest(questnum).ClassReq & SEP_CHAR & Trim(Quest(questnum).During) & SEP_CHAR & Trim(Quest(questnum).End) & SEP_CHAR & Quest(questnum).ItemReq & SEP_CHAR & Quest(questnum).ItemVal & SEP_CHAR & Quest(questnum).LevelIsReq & SEP_CHAR & Quest(questnum).LevelReq & SEP_CHAR & Trim(Quest(questnum).NotHasItem) & SEP_CHAR & Quest(questnum).RewardNum & SEP_CHAR & Quest(questnum).RewardVal & SEP_CHAR & Trim(Quest(questnum).Start) & SEP_CHAR & Quest(questnum).StartItem & SEP_CHAR & Quest(questnum).StartOn & SEP_CHAR & Quest(questnum).Startval & SEP_CHAR & Quest(questnum).NPCTarget & SEP_CHAR & Quest(questnum).NPCTargetValue & SEP_CHAR & END_CHAR
    Call SendDataToAll(Packet)
End Sub

Sub SendUpdateQuestTo(ByVal index As Long, ByVal questnum As Long)
Dim Packet As String

    Packet = "UPDATEQUEST" & SEP_CHAR & questnum & SEP_CHAR & Trim(Quest(questnum).Name) & SEP_CHAR & Trim(Quest(questnum).After) & SEP_CHAR & Trim(Quest(questnum).Before) & SEP_CHAR & Quest(questnum).ClassIsReq & SEP_CHAR & Quest(questnum).ClassReq & SEP_CHAR & Trim(Quest(questnum).During) & SEP_CHAR & Trim(Quest(questnum).End) & SEP_CHAR & Quest(questnum).ItemReq & SEP_CHAR & Quest(questnum).ItemVal & SEP_CHAR & Quest(questnum).LevelIsReq & SEP_CHAR & Quest(questnum).LevelReq & SEP_CHAR & Trim(Quest(questnum).NotHasItem) & SEP_CHAR & Quest(questnum).RewardNum & SEP_CHAR & Quest(questnum).RewardVal & SEP_CHAR & Trim(Quest(questnum).Start) & SEP_CHAR & Quest(questnum).StartItem & SEP_CHAR & Quest(questnum).StartOn & SEP_CHAR & Quest(questnum).Startval & SEP_CHAR & Quest(questnum).NPCTarget & SEP_CHAR & Quest(questnum).NPCTargetValue & SEP_CHAR & END_CHAR
    Call SendDataTo(index, Packet)
End Sub

Sub SendEditQuestTo(ByVal index As Long, ByVal questnum As Long)
Dim Packet As String

    Packet = "EDITQUEST" & SEP_CHAR & questnum & SEP_CHAR & Trim(Quest(questnum).Name) & SEP_CHAR & Trim(Quest(questnum).After) & SEP_CHAR & Trim(Quest(questnum).Before) & SEP_CHAR & Quest(questnum).ClassIsReq & SEP_CHAR & Quest(questnum).ClassReq & SEP_CHAR & Trim(Quest(questnum).During) & SEP_CHAR & Trim(Quest(questnum).End) & SEP_CHAR & Quest(questnum).ItemReq & SEP_CHAR & Quest(questnum).ItemVal & SEP_CHAR & Quest(questnum).LevelIsReq & SEP_CHAR & Quest(questnum).LevelReq & SEP_CHAR & Trim(Quest(questnum).NotHasItem) & SEP_CHAR & Quest(questnum).RewardNum & SEP_CHAR & Quest(questnum).RewardVal & SEP_CHAR & Trim(Quest(questnum).Start) & SEP_CHAR & Quest(questnum).StartItem & SEP_CHAR & Quest(questnum).StartOn & SEP_CHAR & Quest(questnum).Startval & SEP_CHAR & Quest(questnum).NPCTarget & SEP_CHAR & Quest(questnum).NPCTargetValue & SEP_CHAR & END_CHAR
    Call SendDataTo(index, Packet)
End Sub

Sub QuestMsg(ByVal index As Long, ByVal Msg As String, ByVal Color As Byte)
Dim Packet As String

    Packet = "QUESTMSG" & SEP_CHAR & Msg & SEP_CHAR & Color & SEP_CHAR & END_CHAR
    Call SendDataTo(index, Packet)
End Sub

2) Adicione esses cases no sub HandleData:

Código:
 Case "editquest"
        If GetPlayerAccess(index) < ADMIN_DEVELOPER Then
            Call HackingAttempt(index, "Admin Cloning")
            Exit Sub
        End If
        n = Val(Parse(1))
        If n < 0 Or n > MAX_QUESTS Then
            Call HackingAttempt(index, "Invalid Quest Index")
            Exit Sub
        End If
        Call AddLog(GetPlayerName(index) & " editing quest #" & n & ".", ADMIN_LOG)
        Call SendEditQuestTo(index, n)
        Exit Sub

    Case "savequest"
        If GetPlayerAccess(index) < ADMIN_DEVELOPER Then
            Call HackingAttempt(index, "Admin Cloning")
            Exit Sub
        End If
        n = Val(Parse(1))
        If n < 0 Or n > MAX_QUESTS Then
            Call HackingAttempt(index, "Invalid Quests Index")
            Exit Sub
        End If
        Debug.Print Parse(5) & Parse(6)
        Quest(n).Name = Parse(2)
        Quest(n).After = Parse(3)
        Quest(n).Before = Parse(4)
        Quest(n).ClassIsReq = Val(Parse(5))
        Quest(n).ClassReq = Val(Parse(6))
        Quest(n).During = Parse(7)
        Quest(n).End = Parse(8)
        Quest(n).ItemReq = Val(Parse(9))
        Quest(n).ItemVal = Val(Parse(10))
        Quest(n).LevelIsReq = Val(Parse(11))
        Quest(n).LevelReq = Val(Parse(12))
        Quest(n).NotHasItem = Parse(13)
        Quest(n).RewardNum = Val(Parse(14))
        Quest(n).RewardVal = Val(Parse(15))
        Quest(n).Start = Parse(16)
        Quest(n).StartItem = Val(Parse(17))
        Quest(n).StartOn = Val(Parse(18))
        Quest(n).Startval = Val(Parse(19))
        Quest(n).NPCTarget = Val(Parse(20))
        Quest(n).NPCTargetValue = Val(Parse(21))
        Call SendUpdateQuestToAll(n)
        Call SaveQuest(n)
        Call AddLog(GetPlayerName(index) & " saved quest #" & n & ".", ADMIN_LOG)
        Exit Sub

    Case "questdone"
      Call GiveRewardItem(index, Quest(Val(Parse(1))).RewardNum, Quest(Val(Parse(1))).RewardVal, Val(Parse(3)))
            Exit Sub
        Case "requesteditquest"
            Call callrequstedEditQuest(index)
            Exit Sub

3) Adicione no final desse módulo:

Código:
Public Sub Packet_RequestEditQuest(ByVal index As Long)
    If GetPlayerAccess(index) < ADMIN_DEVELOPER Then
        Call HackingAttempt(index, "Admin Cloning")
        Exit Sub
    End If

    Call SendDataTo(index, "questeditor" & END_CHAR)
End Sub

4) Adicione no modConstants:

Código:
Public Const MAX_QUESTS = 250
Public Const NPC_BEHAVIOR_QUEST = 6

5) No modGlobals:

Código:
Public Quest(1 To MAX_QUESTS) As QuestRec

6) Crie um novo módulo, e adicione nele:

Código:
Option Explicit

Function DoQuest(ByVal questnum As Long, ByVal index As Long, ByVal npcnum As Long)
Dim BoB

If Not NPC(npcnum).Behavior = 6 Then
Exit Function
End If

If ReadINI(GetPlayerName(index), "QUEST" & NPC(npcnum).Quest, App.Path + "\QuestSysten.ini", vbNullString) = 0 Then
If MeetReq(questnum, index) Then
    If Quest(questnum).StartOn = 0 Then
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, "1", App.Path + "\QuestSysten.ini")
        Call QuestMsg(index, "----Quest Recieved----", BRIGHTGREEN)
        Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).Start) & "'", SayColor)
            If Quest(questnum).NPCTarget > 0 Then
            Call WriteINI(GetPlayerName(index), "QuestNum", Val(questnum), App.Path + "/QuestSysten.ini")
            Call WriteINI(GetPlayerName(index), "NPCNum", Val(Quest(questnum).NPCTarget), App.Path + "/QuestSysten.ini")
            Else
            Call WriteINI(GetPlayerName(index), "QuestNum", "0", App.Path + "/QuestSysten.ini")
            Call WriteINI(GetPlayerName(index), "NPCNum", Val(Quest(questnum).NPCTarget), App.Path + "/QuestSysten.ini")
            End If
    ElseIf Quest(questnum).StartOn = 1 Then
        Call GiveQuestItem(index, Quest(questnum).StartItem, Quest(questnum).Startval, npcnum)
    End If
Else
If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, App.Path + "\QuestSysten.ini", vbNullString) = 2 Then
Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).After) & "'", SayColor)
Exit Function
End If
    Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).Before) & "'", SayColor)
End If
Exit Function
End If

If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, App.Path + "\QuestSysten.ini", vbNullString) = 1 Then
    Call SendDataTo(index, "questprompt" & SEP_CHAR & questnum & SEP_CHAR & npcnum & SEP_CHAR & Val(GetVar(App.Path & "/QuestSysten.ini", GetPlayerName(index), "NPCSKilled")) & SEP_CHAR & END_CHAR)
End If

If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, App.Path + "\QuestSysten.ini", vbNullString) = 2 Then
Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).After) & "'", SayColor)
Exit Function
End If

End Function
Sub SaveLine(File As Integer, Header As String, Var As String, Value As String)
    Print #File, Var & "=" & Value
End Sub

Function MeetReq(questnum As Long, index As Long) As Boolean
If Quest(questnum).ClassIsReq = 0 And Quest(questnum).LevelIsReq = 0 Then
    MeetReq = True
    Exit Function
ElseIf Quest(questnum).ClassIsReq = 1 And Quest(questnum).LevelIsReq = 0 Then
    If Player(index).Char(Player(index).CharNum).Class = Quest(questnum).ClassReq Then
        MeetReq = True
        Exit Function
    Else
        MeetReq = False
        Exit Function
    End If
ElseIf Quest(questnum).ClassIsReq = 0 And Quest(questnum).LevelIsReq = 1 Then
    If Player(index).Char(Player(index).CharNum).LEVEL >= Quest(questnum).LevelReq Then
        MeetReq = True
        Exit Function
    Else
        MeetReq = False
        Exit Function
    End If
ElseIf Quest(questnum).ClassIsReq = 1 And Quest(questnum).LevelIsReq = 1 Then
    If Player(index).Char(Player(index).CharNum).Class = Quest(questnum).ClassReq And Player(index).Char(Player(index).CharNum).LEVEL >= Quest(questnum).LevelReq Then
        MeetReq = True
        Exit Function
    Else
        MeetReq = False
        Exit Function
    End If
End If

End Function

Sub GiveQuestItem(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long, ByVal npcnum As Long)
Dim i As Long
Dim Curr As Boolean
Dim Has As Boolean
    ' Check for subscript out of range
    If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
        Exit Sub
    End If
 
    If Item(ItemNum).Type = 12 Then Curr = True Else Curr = False
 
    For i = 1 To MAX_INV
        If Curr = True Then
            If GetPlayerInvItemNum(index, i) = ItemNum Then
                Call SetPlayerInvItemValue(index, i, GetPlayerInvItemValue(index, i) + ItemVal)
                Call SendInventoryUpdate(index, i)
                Has = True
                Exit For
            End If
        Else
            If GetPlayerInvItemNum(index, i) = 0 Then
                Call SetPlayerInvItemNum(index, i, ItemNum)
                Call SetPlayerInvItemValue(index, i, 1)
                If (Item(ItemNum).Type = ITEM_TYPE_ARMOR) Or (Item(ItemNum).Type = ITEM_TYPE_WEAPON) Or (Item(ItemNum).Type = ITEM_TYPE_HELMET) Or (Item(ItemNum).Type = ITEM_TYPE_SHIELD) Then
                    Call SetPlayerInvItemDur(index, i, Item(ItemNum).Data1)
                End If
                Call SendInventoryUpdate(index, i)
                Has = True
                Exit For
            End If
        End If
    Next i
 
    If Has = False Then
        Call PlayerMsg(index, "Your inventory is full. Please come back when it is not", BRIGHTRED)
        Exit Sub
    Else
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, "1", App.Path + "\QuestSysten.ini")
        Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).Start) & "'", SayColor)
    End If

End Sub
Sub GiveRewardItem(ByVal index As Long, ByVal ItemNum As Long, ByVal ItemVal As Long, ByVal npcnum As Long)
Dim i As Long
Dim Curr As Boolean
Dim Has As Boolean
Dim questnum As Long
    ' Check for subscript out of range
    If IsPlaying(index) = False Or ItemNum <= 0 Or ItemNum > MAX_ITEMS Then
        Exit Sub
    End If
 
    If ReadINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, App.Path + "\QuestSysten.ini", vbNullString) = 2 Then
Call QuestMsg(index, "A " & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).After) & "'", SayColor)
Exit Sub
End If
 
    If Item(ItemNum).Type = 12 Then Curr = True Else Curr = False
 
    For i = 1 To MAX_INV
        If Curr = True Then
            If GetPlayerInvItemNum(index, i) = ItemNum Then
                Call SetPlayerInvItemValue(index, i, GetPlayerInvItemValue(index, i) + ItemVal)
                Call SendInventoryUpdate(index, i)
                Has = True
                Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, "2", App.Path + "\QuestSysten.ini")
                Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "NPCSKilled", "0", App.Path + "\QuestSysten.ini")
                Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QuestNum", "0", App.Path + "\QuestSysten.ini")
                Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "NPCNum", "0", App.Path + "\QuestSysten.ini")
                Exit For
            End If
        Else
            If GetPlayerInvItemNum(index, i) = 0 Then
                Call SetPlayerInvItemNum(index, i, ItemNum)
                Call SetPlayerInvItemValue(index, i, 1)
                If (Item(ItemNum).Type = ITEM_TYPE_ARMOR) Or (Item(ItemNum).Type = ITEM_TYPE_WEAPON) Or (Item(ItemNum).Type = ITEM_TYPE_HELMET) Or (Item(ItemNum).Type = ITEM_TYPE_SHIELD) Then
                    Call SetPlayerInvItemDur(index, i, Item(ItemNum).Data1)
                End If
                Call SendInventoryUpdate(index, i)
                Has = True
                Exit For
            End If
        End If
    Next i
 
    If Has = False Then
        Call PlayerMsg(index, "Your inventory is full. Please come back when it is not", BRIGHTRED)
        Exit Sub
    Else
        Call QuestMsg(index, "----Quest Complete----", BRIGHTGREEN)
        Call QuestMsg(index, "" & Trim(NPC(npcnum).Name) & " says, '" & Trim(Quest(NPC(npcnum).Quest).End) & "'", SayColor)
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QUEST" & NPC(npcnum).Quest, "2", App.Path + "\QuestSysten.ini")
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "NPCSKilled", "0", App.Path + "\QuestSysten.ini")
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "QuestNum", "0", App.Path + "\QuestSysten.ini")
        Call WriteINI(Player(index).Char(Player(index).CharNum).Name, "NPCNum", "0", App.Path + "\QuestSysten.ini")
        Call SendPlayerData(index)
        Call CheckPlayerLevelUp(index)
        If Item(Quest(NPC(npcnum).Quest).RewardNum).Type = 12 Then
            Call TakeItem(index, Quest(NPC(npcnum).Quest).ItemReq, Quest(NPC(npcnum).Quest).ItemVal)
        Else
            Call TakeItem(index, Quest(NPC(npcnum).Quest).ItemReq, 1)
        End If
                        Call SendInventoryUpdate(index, i)
    End If

End Sub

6) No sub AddChar, adicione:

Código:
Call SetupQuest(Name)

7) No final no modGameLogic, adicione:

Código:
Sub SetupQuest(ByVal Name As String)
Dim i As Long
Dim CharNum As Long
Dim index As Long
Call WriteINI(Name, "NPCSKilled", "0", App.Path + "/QuestSysten.ini")
Call WriteINI(Name, "QuestNum", "0", App.Path + "/QuestSysten.ini")
Call WriteINI(Name, "NPCNum", "0", App.Path + "/QuestSysten.ini")

For i = 1 To MAX_QUESTS
Call WriteINI(Name, "QUEST" & i, "0", App.Path + "\QuestSysten.ini")
Next i
End Sub

Sub CheckAddTargetPoints(ByVal index As Long, npcnum As Long, questnum As Long)
If GetVar(App.Path & "/QuestSysten.ini", GetPlayerName(index), "NPCNum") = npcnum Then
Call AddTargetPoints(index, questnum, npcnum)
End If
End Sub

Sub AddTargetPoints(ByVal index As Long, questnum As Long, npcnum As Long)
Dim monster As Long

monster = Val(Val(Quest(questnum).NPCTargetValue) - Val(GetVar(App.Path & "/questsysten.ini", GetPlayerName(index), "NPCSKilled")) - 1)

If GetVar(App.Path & "/QuestSysten.ini", GetPlayerName(index), "NPCSKilled") + 1 <= Quest(questnum).NPCTargetValue Then
PutVar App.Path & "/QuestSysten.ini", GetPlayerName(index), "NPCSKilled", GetVar(App.Path & "/QuestSysten.ini", GetPlayerName(index), "NPCSKilled") + 1
Call PlayerMsg(index, "Você matou mais um " & NPC(npcnum).Name & "! Só te restam " & monster & " para completar o seu desafio!", YELLOW)
Else
Call PlayerMsg(index, "Você já matou todos os monstros de seu desafio!", YELLOW)
End If
End Sub

no sub AttackNpc, adicione:

Código:
Call CheckAddTargetPoints(attacker, npcnum, Quest)

Abaixo de:

Código:
' Check for a weapon and say damage
        Player(attacker).TargetNPC = 0

9) no sub CanAttackNpc, adicione em todas as direcções para não atacar um npc de quest
10) Adicione para iniciar esse evento:

Código:
If NPC(npcnum).Behavior = NPC_BEHAVIOR_QUEST Then
          Call DoQuest(NPC(npcnum).Quest, attacker, npcnum)
End If

10) No sub InitServer, adicione:

Código:
    Call SetStatus("Loading Quests...")
    Call IncrementBar
    Call LoadQuests

11) No modDatabase, adicione:

Código:
    Function GetSpellReqLevel(ByVal SpellNum As Long) As Long
        GetSpellReqLevel = Spell(SpellNum).LevelReq
    End Function

    Function GetPlayerTargetNpc(ByVal index As Long) As Long
        GetPlayerTargetNpc = Player(index).TargetNPC
    End Function

    Sub SaveQFlags(ByVal Name As String)
    Dim i As Long
    Dim FileName As String
    FileName = App.Path & "\QuestSysten.ini"

    For i = 1 To MAX_QUESTS
    Call PutVar(FileName, Name, "Quest" & i, 0)
    Next i
    End Sub
    Sub SaveQuest(ByVal questnum As Long)
    Dim FileName As String
    Dim f As Long

        FileName = App.Path & "\quests\quests" & questnum & ".dat"
        f = FreeFile
        Open FileName For Binary As #f
        Put #f, , Quest(questnum)
        Close #f
    End Sub

    Sub SaveQuests()
    Dim i As Long

        Call SetStatus("Saving Quests... ")
        For i = 1 To MAX_QUESTS

            If Not FileExist("quests\quests" & i & ".dat") Then
                Call SetStatus("Saving Quests.. " & Int((i / MAX_QUESTS) * 100) & "%")
                DoEvents

                Call SaveQuest(i)
            End If
        Next
    End Sub

    Sub CheckQuests()
        Call SaveQuests
    End Sub
    Sub LoadQuests()
    Dim FileName As String
    Dim i As Long
    Dim f As Long

        Call CheckQuests
        For i = 1 To MAX_QUESTS
            Call SetStatus("Loading Quests... " & Int((i / MAX_QUESTS) * 100) & "%")
            FileName = App.Path & "\Quests\quests" & i & ".dat"
            f = FreeFile
            Open FileName For Binary As #f
            Get #f, , Quest(i)
            Close #f
            DoEvents

        Next
    End Sub

    Sub ClearQuests()
    Dim i As Long

    For i = 1 To MAX_QUESTS
    Quest(i).Name = ""
    Quest(i).LevelIsReq = 0
    Quest(i).ClassIsReq = 0
    Quest(i).StartOn = 0
    Quest(i).LevelReq = 0
    Quest(i).ClassReq = 0

    Quest(i).StartItem = 0
    Quest(i).Startval = 0
    Quest(i).ItemReq = 0
    Quest(i).ItemVal = 0
    Quest(i).RewardNum = 0
    Quest(i).RewardVal = 0
    Quest(i).Start = ""
    Quest(i).End = ""
    Quest(i).During = ""
    Quest(i).NotHasItem = ""
    Quest(i).Before = ""
    Quest(i).After = ""
    Next i
    End Sub

12) Procure por:

Código:
Type NpcRec

Adicione:

Código:
Quest As Long

13) No SendEditNpc, adicione:

Código:
& NPC(npcnum).Quest

14) No sub Packet_SaveNPC, adicione;

Código:
NPC(npcnum).Quest = Val(NPCData(18))



ALGUMAS OBSERVAÇÕES IMPORTANTES:
1) Verifique os packets, pois tive de adaptá-los muito rápido para esse sistema e não conferi!
2) Talvez eu tenha esquecido alguma coisa, caso apresente algum erro, poste!
3) Não irei responder mensagens que não sabem como mandar packets! Leia o tutorial!

OBS: nao sei quem e o criado desse sistema entao so postarei o creditos a mim.

Créditos: Thales por Postar .



[Você precisa estar registrado e conectado para ver esta imagem.]

[Você precisa estar registrado e conectado para ver esta imagem.]

2Tutorial Re: Quest Editor em Seg 11 Out 2010, 16:27

Luucas Robeerto


Fundador
Fundador
Nao esta completa pois o sistema falta muita coisa mais muito bom
um proficional em VB consegue arruma esse pequeno deslice

MUITO BOM +1 CRED

http://universogamesmmo.forumeiros.com

3Tutorial Re: Quest Editor em Seg 11 Out 2010, 19:31

Thales12


Membro
Membro
Vlws afro

4Tutorial Re: Quest Editor em Dom 01 Jul 2012, 20:40

iuriigor


Membro
Membro
Da pra funciona ?

5Tutorial Re: Quest Editor em Sab 21 Jun 2014, 14:54

Monkey D.Dragon


Membro
Membro
sei que isso faz tempo..., muitoo tempo mesmo ,mas sera que alguem ainda tem as Frm pra download ?

6Tutorial Re: Quest Editor em Qua 25 Jun 2014, 16:43

joaopaulo98


Membro
Membro
procura na  aldeiarpg   eu vi um lá não faz nem 2 semanas

7Tutorial Re: Quest Editor em Qui 26 Jun 2014, 16:03

Monkey D.Dragon


Membro
Membro
Monkey D.Dragon escreveu:sei que isso faz tempo..., muitoo tempo mesmo ,mas sera que alguem ainda tem as Frm pra download ?

vo la da uma olhada ,ma tipo quero pra Eclipse Evolution e nao pra Eclipse Origins !

8Tutorial Re: Quest Editor Hoje à(s) 12:16

Conteúdo patrocinado


Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo  Mensagem [Página 1 de 1]

Permissão deste fórum:
Você não pode responder aos tópicos neste fórum