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

(EO) Visual Quest System (with editor)


Murdoc
 Share

Recommended Posts

This is tested and 100% working. Qazek's [http://www.touchofdeathforums.com/smf/index.php?topic=62859.0](http://www.touchofdeathforums.com/smf/index.php?topic=62859.0) is needed for the code to function properly.

It uses the npc editor for this system as well. So you can assign a different text message for each window with ease.

Thanks go to DSHWinchester for help with code.

First, create a picturebox named "picQuestWindow" (our background), cmd button called "cmdOkQuest" (to click "ok"), and a label "lblQuestMsg" (where text will display).

Client Side
–---------

Under ' Packets sent by server to client add:

```
SQuestWindow
```
In modHandleData add:

```
HandleDataSub(SQuestWindow) = GetAddress(AddressOf HandleQuestWindow)
```
At bottom of modHandleData create Sub:

```
Private Sub HandleQuestWindow(ByVal Index As Long, ByRef Data() As Byte, ByVal EditorIndex As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)

Dim Buffer As clsBuffer
Dim msg As String
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()

msg = Buffer.ReadString

frmMainGame.picQuestWindow.Visible = True
frmMainGame.lblQuestMsg.Caption = "" & msg & ""
frmMainGame.lblQuestMsg.Visible = True
frmMainGame.cmdOkQuest.Visible = True

End Sub
```
Double click on button "cmdOkQuest" and insert code:

```
frmMainGame.picQuestWindow.Visible = False
frmMainGame.lblQuestMsg.Visible = False
frmMainGame.cmdOkQuest.Visible = False
```

Server Side:

Locate the original code to call the quest that starts "If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then" and replace with:

```
If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then
                            If Npc(NpcNum).QuestLevel <= GetPlayerLevel(Attacker) Then
                                If GetVar("data\quest\" & GetPlayerName(Attacker) & ".ini", "QUEST", "Quest" & Npc(NpcNum).QuestNum) = 0 Then
                                    Call QuestWindow(Attacker, Npc(NpcNum).QuestMsg1)
                                    Call PlayerMsg(Attacker, Npc(NpcNum).QuestMsg1, Yellow)
                                    Call PutVar("data\quest\" & GetPlayerName(Attacker) & ".ini", "QUEST", "Quest" & Npc(NpcNum).QuestNum, 1)
                                Exit Function
                                End If

                                If GetVar("data\quest\" & GetPlayerName(Attacker) & ".ini", "QUEST", "Quest" & Npc(NpcNum).QuestNum) = 1 Then
                                If HasItem(Attacker, Npc(NpcNum).QuestReqItem) Then
                                    Call QuestWindow(Attacker, Npc(NpcNum).QuestMsg2)
                                    Call PlayerMsg(Attacker, Npc(NpcNum).QuestMsg2, Yellow)
                                    Call TakeInvItem(Attacker, Npc(NpcNum).QuestReqItem, Npc(NpcNum).QuestReqItemHowMany)
                                    Call GiveInvItem(Attacker, Npc(NpcNum).QuestRewItem, Npc(NpcNum).QuestRewItemHowMany)
                                    Call PutVar("data\quest\" & GetPlayerName(Attacker) & ".ini", "QUEST", "Quest" & Npc(NpcNum).QuestNum, 2)
                                Exit Function
                                Else
                                    Call QuestWindow(Attacker, Npc(NpcNum).QuestMsg3)
                                    Call PlayerMsg(Attacker, Npc(NpcNum).QuestMsg3, Yellow)
                                End If
                                End If

                                If GetVar("data\quest\" & GetPlayerName(Attacker) & ".ini", "QUEST", "Quest" & Npc(NpcNum).QuestNum) = 2 Then
                                    Call QuestWindow(Attacker, Npc(NpcNum).QuestMsg4)
                                    Call PlayerMsg(Attacker, Npc(NpcNum).QuestMsg4, Yellow)
                                Exit Function
                                End If
                            Else
                                Call QuestWindow(Attacker, "Come back when you're stronger!")
                                Call PlayerMsg(Attacker, "You don't have required level!", Yellow)
                            End If
                        End If
                        If Len(Trim$(Npc(NpcNum).AttackSay)) > 0 Then
                            PlayerMsg Attacker, Trim$(Npc(NpcNum).Name) & ": " & Trim$(Npc(NpcNum).AttackSay), White
                        End If
                    End If
                End If
            End If
        End If
    End If

End Function

```
Add```
SQuestWindow
```under ' Packets sent by server to client

Add a Sub at bottom of modGameLogic:

```
Sub QuestWindow(byval index as long,byval msg as string)
Dim Buffer As clsBuffer
Set Buffer = New clsBuffer
Buffer.WriteLong SQuestWindow
Buffer.WriteString Msg
SendDataTo index, Buffer.ToArray()

    Set Buffer = Nothing
end sub
```
Done.

Now you can use Qazek's quest editor to define the messages that will appear in "picQuestWindow".

I plant to  update this tutorial later to include npc portraits. :)

Example Screenshots:

![](http://www.freemmorpgmaker.com/files/imagehost/pics/d8869d75b9dba495978b4a62a77d5c4b.jpg)

![](http://www.freemmorpgmaker.com/files/imagehost/pics/22d8a800a423d6c82129c8f1d907c2c8.jpg)
Link to comment
Share on other sites

I guess it makes the overall code a little better - good job. It isn't much more difficult to make a quest log to keep track of your accepted quests, and the ability to Give up quests at any time. It didn't take me long to write a whole quest system with those features.

Regards,

Lightning
Link to comment
Share on other sites

@Lightning:

> I guess it makes the overall code a little better - good job. It isn't much more difficult to make a quest log to keep track of your accepted quests, and the ability to Give up quests at any time. It didn't take me long to write a whole quest system with those features.
>
> Regards,
>
> Lightning

Robin's Son ;D
Link to comment
Share on other sites

@[Cake:

> Vitin â„¢ link=topic=64737.msg693731#msg693731 date=1284902354]
> Who lighting?If yes , then yes :D Lighting is a great coder.He is doing an amazing work with OTLR

I'm not Robin's son - and Robin is only 2 years older than me so it wouldn't make sense in the first place ;)
Link to comment
Share on other sites

@Lightning:

> I guess it makes the overall code a little better - good job. It isn't much more difficult to make a quest log to keep track of your accepted quests, and the ability to Give up quests at any time. It didn't take me long to write a whole quest system with those features.
>
> Regards,
>
> Lightning

We think much alike. :) Gonna try and update the tutorial with portrait power (lol), and a simple quest log add-on at some point.
Link to comment
Share on other sites

@â•‘Veneranceâ•‘:

> @Lightning:
>
> > I guess it makes the overall code a little better - good job. It isn't much more difficult to make a quest log to keep track of your accepted quests, and the ability to Give up quests at any time. It didn't take me long to write a whole quest system with those features.
> >
> > Regards,
> >
> > Lightning
>
> We think much alike. :) Gonna try and update the tutorial with portrait power (lol), and a simple quest log add-on at some point.

Sounds good. I will post a screenshot of my questlog in this thread when I get back home, I guess you could use it as reference.

Regards,

Lightning
Link to comment
Share on other sites

@Coolguy6318:

> I did all this but when I push ctrl by npc nothing happens?

Make sure the npc number and QuestNum are the same. (I believe that's correct) Anyway, if that doesn't work, maybe check the code again? Did you have Qazek's quest system working before you tried this? Let's see if we can narrow it down. :)
Link to comment
Share on other sites

@Lightning:

> Old screenie from the ES version of OTLR. Use this image as reference if you like:
>
> ![](http://i801.photobucket.com/albums/yy294/Adrammelech_2009/questlogupdate.png)
>
> Regards,
>
> Lightning

Thanks for this Lightning. (nice screenie btw) .. I'm gonna do something like this, but have all game quests listed, and just grey out the ones that arent active. Should be simple enough… I hope :)
Link to comment
Share on other sites

  • 2 weeks later...
@ѕнα∂σω:

> @Coolguy6318:
>
> > I did all this but when I push ctrl by npc nothing happens?
>
> Make sure the npc number and QuestNum are the same. (I believe that's correct) Anyway, if that doesn't work, maybe check the code again? Did you have Qazek's quest system working before you tried this? Let's see if we can narrow it down. :)

Ok i tested Qazeks quest system today no errors but when i talk 2 npc nothing happens :icon_crap:
Link to comment
Share on other sites

  • 4 weeks later...
Hey, nice job on this one.

Looks easy to do. (Yet I'm in learning stage.)
I should mess with this code some more.

I hope to write some nice coding like a Ticket system or so. Just to start with. I will make a Tutorial too.

These tutorials are helping me out step by step by applying them and mess around with them.

Thanks, keep it up.
I wonder how the Cancel or Reset system would work and keeping a Log of all your quests.
Probably needs something to do inside the same .Ini. Or eventually another .Ini. ([Quests-Done] Quest1=Done/Busy/-)

I'm trying to figure out it my self for now, it sure should be able to be done with just this code already.

And I really like the ease of use of this In-Game Quest maker. I'm really gonna use this one.
Thanks!
Link to comment
Share on other sites

  • 5 weeks later...
@[NEG:

> Deity link=topic=64737.msg715318#msg715318 date=1290607511]
> Hrm…for some reason, the picturebox and command button are always visible.
> Tried setting the 'visibility' option in the properties to false but they still show up.

Don't create the picturebox inside the game screen. Make it seperate. I think this should fix that problem. If not, let me know.
Link to comment
Share on other sites

  • 1 month later...
I have a problem installing the quest editor…

> Server Side:
>
> Locate the original code to call the quest that starts "If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then" and replace with:

in my origins server folder i dont have any Npc Behaivour = NPC_BEHAIVOUR_QUEST so where should i add that code?please Help!  :sad:
Link to comment
Share on other sites

@s3th:

> I have a problem installing the quest editor…
>
> > Server Side:
> >
> > Locate the original code to call the quest that starts "If Npc(NpcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then" and replace with:
>
> in my origins server folder I dont have any Npc Behaivour = NPC_BEHAIVOUR_QUEST so where should I add that code?please Help!  :sad:

You must not have installed the quest system, Qazek made, properly. There's a link to it in my post. I suggest going back and checking it over, because it should be there. :)
Link to comment
Share on other sites

  • 1 month later...
@leopoldobb:

> I adapted this tutorial for my game, using the hardcoded version of quest, this link:
> http://www.touchofdeathforums.com/smf/index.php/topic,68426.0.html
>
> Works perfectly. :)

Thanks for letting us know. :-) I was actually gonna test the same to see if it would work. But you beat me to it!
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...