[EVB/DX7] Quest Images

In this tutorial I’m going to walk you through how to have an image render above NPC’s with quests.

Like so:

Now, I’ll attach the image I made for this (ugly as it is) if you want to use it, that’s fine.

Now, this is all client-side and SO easy it’s not even funny.

modDirectDraw7

Find:

Public DDSD_Bars As DDSURFACEDESC2

And below it put:

Public DDSD_Quest As DDSURFACEDESC2

Now find:

Public DDS_Bars As DirectDrawSurface7

and below that put:

Public DDS_Quest As DirectDrawSurface7

Now find this:

If FileExist(App.Path & "\data files\graphics\bars.bmp") Then Call InitDDSurf("bars", DDSD_Bars, DDS_Bars)

and below that put:

If FileExist(App.Path & "\data files\graphics\quest.bmp") Then Call InitDDSurf("quest", DDSD_Quest, DDS_Quest)

Now find this:

Set DDS_Target = Nothing    ZeroMemory ByVal VarPtr(DDSD_Target), LenB(DDSD_Target)

and below that put:

Set DDS_Quest = Nothing    ZeroMemory ByVal VarPtr(DDSD_Quest), LenB(DDSD_Quest)

Now find this in BltNpc:

Call BltSprite(Sprite, X, Y, rec)

And below that put this:

If Npc(MapNpc(MapNpcNum).num).questGiver = 1 Then    Call BltQuest(X, Y)    End If

Now add this at the bottom of the module:

Public Sub BltQuest(ByVal X As Long, ByVal Y As Long)Dim rec As DXVBLib.RECT        ' If debug mode, handle error then exit out    If Options.Debug = 1 Then On Error GoTo errorhandler            With rec        .top = 0        .Bottom = 0        .Left = 0        .Right = 0    End With                Engine_BltFast X + 33, Y - 32, DDS_Quest, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY        ' Error handler    Exit Suberrorhandler:    HandleError "BltQuest", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext    Err.Clear    Exit SubEnd Sub

Depending on the sprite youre using or the image, you’ll want to edit this part of the code.

Engine_BltFast X + 33, Y - 32, DDS_Quest, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY

Now: download the attachment and put it into your graphics folder.

That should be it! Report any bugs and I’ll fix em, like always.

~SkywardRiver

Looks good sky, you beat me too it haha but well done.

How would you add a ? mark one showing the quest returner?

You have to send a quest variable to the client and have the client run a variable check to determine when it’s finished.

Basically something like;


If Player(MyIndex).Quest(QuestNum).Finished = True Then
'Blt the question mark.
Else
'Blt the exclamation mark.
End If

How would you add a ? mark one showing the quest returner?

It’s in the latest version of EVB. Here’s how to do it:

Repeat Sky’s tutorial but instead of “_Quest” for your surfaces add two surfaces named “_Quest_Available” and “_Quest_Handin”

Change:

If Npc(MapNpc(MapNpcNum).num).questGiver = 1 Then 
Call BltQuest(X, Y)
End If

To:

If Npc(MapNpc(MapNpcNum).num).questGiver = 1 Then
        Call BltQuest(X, Y, MapNpcNum)
    End 

Replace your BltQuest with this one:

Public Sub BltQuest(ByVal X As Long, ByVal Y As Long, ByVal MapNpcNum As Long)
Dim rec As DXVBLib.RECT
Dim questNum As Long, i As Long
Dim questInProgress As Boolean

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

    With rec
        .top = 0
        .Bottom = 0
        .Left = 0
        .Right = 0
    End With

    questNum = Npc(MapNpc(MapNpcNum).num).questIndex
    For i = 1 To MAX_QUESTS
        If Player(MyIndex).Quest(i).QuestStatus = 1 And i = questNum Then
            questInProgress = True
        End If
    Next

    If questInProgress Then
        Engine_BltFast X + 32, Y - 10, DDS_Quest_Handin, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
    Else
        Engine_BltFast X + 32, Y - 10, DDS_Quest_Available, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY
    End If

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "BltQuest", "modDirectDraw7", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

There’s no flag for if the quest is ready to hand in (i.e. all the objectives are complete) so it shows if the player is currently on that NPC’s quest.

Log in to reply