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

  • Replies 703
  • Created
  • Last Reply

Top Posters In This Topic

@Chukillz:

> 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?

Check the first post. There's a link at the bottom for the v1.0, but I think you should use v1.1 instead.

@Ryoku:

> >.> so what about adding this stuff to already custom NPC editors, and frmMains….

It's really a simple edit, just check the code and the form and you'll see it. :/

@Captain:

> I'm seriously questioning some things above.

?
Link to comment
Share on other sites

Erwin where did i say that i was going to use v1.0? i was asking about it so that i could see what i need to take out and such because i didnt label the quest system in my code i just simply added the code so i need to know what i should take out so that i could start adding v1.1\.
Link to comment
Share on other sites

@Chukillz:

> Erwin where did i say that i was going to use v1.0? i was asking about it so that i could see what i need to take out and such because i didnt label the quest system in my code i just simply added the code so i need to know what i should take out so that i could start adding v1.1.

You don't need to delete it, just do the tutorial on the previous page.
Link to comment
Share on other sites

id say its more than enough that altar updated it at all.  suck it up and just do the tut again.

as for questlog not updating on map transfers, add this lil fix if your still on the old version.  new version may need some label tweeking but otherwise should work the same. (maybe the same lables i havnt checked)

search for :
**Private Sub HandleMapDone()**
above
```
GettingMap = False
CanMoveNow = True
```
add this

```
If frmMain.questlog.Visible = True Then
    UpdateQuestLog
    LoadQuestLogPage
    ShowQuestLogPage 1
    End If
```
Link to comment
Share on other sites

>.>

upon completing a quest it doesnt give you a new level, I looked and you use

SetEXP index, Current + reward… THIS IS A NO NO!!!!

GivePlayerEXP index , Reward
is the right way to do it... I cant post the exact code because im in class and i cant pull it up on this computer.

PS. I wrote some code for haveing a "?" or "!" above the NPC, ill post it later
Link to comment
Share on other sites

still in class got on their network with my laptop.

FIX EXP:

Server side

in modSvQuests find 'give experience
replace the line under it with
```
'give experience

    GivePlayerEXP Index, Quest(QuestNum).RewardExp

```

* * *

! or ? mark above quest NPCs:

Client Side

in modText

In Public Sub DrawNpcName

before ' Error handler

add
```
    If NPC(NPCNum).Quest = YES Then
        Name = "?" 'or !

        TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
        If NPC(NPCNum).Sprite < 1 Or NPC(NPCNum).Sprite > NumCharacters Then
            TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16
        Else
            ' Determine location for text
            TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(NPC(NPCNum).Sprite).lHeight / 4) + 4 'adjust last number to get it to fit right
        End If
        ' Draw name
        Call DrawText(TexthDC, TextX, TextY, Name, color)
    End If

```
Link to comment
Share on other sites

@sotvotkong:

> id say its more than enough that altar updated it at all.  suck it up and just do the tut again.
>
> as for questlog not updating on map transfers, add this lil fix if your still on the old version.  new version may need some label tweeking but otherwise should work the same. (maybe the same lables i havnt checked)
> -snip-

Is this fix needed for the new version?

ps thanks Ryoku for the exp fix
Link to comment
Share on other sites

yes i belive it would still need this.

easy test would be to get a quest beyond quest 1, leave your quest window open and goto a new map.  if they read out correctly still then you are good.  if they dont, then you need the fix above.
Link to comment
Share on other sites

Well i didn't make it that far yet I have a problem… When I interact with the npc it doesn't do anything (yes i have stat points in all slots) is there something wrong with my code?

Piece of code form CanPlayerAttackNpc:

>! ```
If NpcX = GetPlayerX(attacker) Then
                If NpcY = GetPlayerY(attacker) Then
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            If NPC(npcNum).Convo = True Then
                                InitChat attacker, mapNum, mapNpcNum
                            End If
                            Exit Function
                        End If

                    If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
                        CanPlayerAttackNpc = True
                    Else
                        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

                        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
```
Link to comment
Share on other sites

>.> don't put code inside of spoiler…

Justn's code
```
If NpcX = GetPlayerX(attacker) Then
                If NpcY = GetPlayerY(attacker) Then
                        If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            If NPC(npcNum).Convo = True Then
                                InitChat attacker, mapNum, mapNpcNum
                            End If
                            Exit Function
                        End If

                    If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
                        CanPlayerAttackNpc = True
                    Else
                        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

                        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

```
The problem with your code is that it's set up wrong, it already leaves the function on the first check for friendly NPC, you have to join the quest checks with your existing friendly check.

* * *

Ryoku's WORKING version

```

                        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
                            If NPC(npcNum).Quest = NO Then
                                If NPC(npcNum).Convo = False Then
                                    Call SpeechWindow(attacker, Trim$(NPC(npcNum).AttackSay), npcNum)
                                Else
                                    InitChat attacker, mapNum, mapNpcNum
                                End If
                                Exit Function
                            End If
                        End If

```Please also notice this version is Convo system compatible too! ;D

But also i use several diffident types of speech windows, it might need a bit of editing to work right.
Link to comment
Share on other sites

thanks Ryoku it worked! I removed my speech window so all i had to do with your code was replace the 'Call Speechwindow' with the default code

@sotvotkong
I made two quest and switched maps with the questlog open and I didnt have any problems they are both still there

Edit:
@ Eveyone else
If you set a reward it doesn't show up in the reward spot on the quest log is that normal? Same thing with the Requirements slot
Link to comment
Share on other sites

About the Exp, you're right. I've done it quickly and haven't seen that there's a proper function to work with exp.

@Justn:

> Thanks! Umm ok I downloaded the premade copy to see if i screwed up somewhere but it doesn't show anything in the Requirements slot or the Rewards slot of the quest log no matter what you set it to

It's in the ToDo list. Although it's not hard to finish it.
Link to comment
Share on other sites

> Warning - while you were typing a new reply has been posted. You may wish to review your post.

@Ryoku:

> Hey Alatar! =3
>
> I did some of your todo list for you ;D I did the "!" or "?" above quest NPCs =3 you can add it if you want

Lol! I was just going to post about that right now! Check below, and thanks Ryoku  :cheesy:

* * *

@Justn:

> oops sorry altar just wanted to make sure, I didn't see the to do list. I'll add it in np. Everything else is working great so far thanks everyone for the help.

Oh, i need to add it to this topic to-do list lol, it's in my own to-do list .txt file :P
On the other hand, there are some other stuff that would need to be added for the next version, the main thing is one with coding the currency items to work fine with this source edition.

There is a long road until this is completed people  :embarrassed:

@Ryoku:

> still in class got on their network with my laptop.
>
> FIX EXP:
>
> Server side
>
> in modSvQuests find 'give experience
> replace the line under it with
> ```
> 'give experience
>    
>     GivePlayerEXP Index, Quest(QuestNum).RewardExp
>    
>
> ```
>
> * * *
>
> ! or ? mark above quest NPCs:
>
> Client Side
>
> in modText
>
> In Public Sub DrawNpcName
>
> before ' Error handler
>
> add
> ```
>     If NPC(NPCNum).Quest = YES Then
>         Name = "?" 'or !
>    
>         TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
>         If NPC(NPCNum).Sprite < 1 Or NPC(NPCNum).Sprite > NumCharacters Then
>             TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16
>         Else
>             ' Determine location for text
>             TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(NPC(NPCNum).Sprite).lHeight / 4) + 4 'adjust last number to get it to fit right
>         End If
>         ' Draw name
>         Call DrawText(TexthDC, TextX, TextY, Name, color)
>     End If
>    
>
> ```

Nice one, but it will only show the "?" if the npc is a quest giver, and it will show it all the time.

Here's my try about it (i'm thinking anyway to work in a dd7 version of it, but first I'll need to learn dd7 xD):

* * *

**NEW: Add "?" or "!" to the NPCs**

"[?]" is if you need to talk to X npc in any quest, and "[!]" is if you can take a new quest from one npc.

Client-side, go to modText, find DrawNpcName, find this:
```
Call DrawText(TexthDC, TextX, TextY, Name, color)
```Paste this:
```
    'Alatar v1.2
    Dim i As Long

    For i = 1 To MAX_QUESTS
        'check if the npc is the next task to any quest: [?] symbol

        If Player(MyIndex).PlayerQuest(i).Status = QUEST_STARTED Then
            If Quest(i).Task(Player(MyIndex).PlayerQuest(i).ActualTask).NPC = npcNum Then
                Name = "[?]"
                TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
                If NPC(npcNum).Sprite < 1 Or NPC(npcNum).Sprite > NumCharacters Then
                    TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16
                Else
                    TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(NPC(npcNum).Sprite).lHeight / 4)
                End If
                Call DrawText(TexthDC, TextX, TextY, Name, QBColor(Yellow))
                Exit For
            End If
        End If

        'check if the npc is the starter to any quest: [!] symbol

        'can accept the quest as a new one?
        If Player(MyIndex).PlayerQuest(i).Status = QUEST_NOT_STARTED Or Player(MyIndex).PlayerQuest(i).Status = QUEST_COMPLETED_BUT Then
            'the npc gives this quest?
            If NPC(npcNum).QuestNum = i Then
                Name = "[!]"
                TextX = ConvertMapX(MapNpc(Index).x * PIC_X) + MapNpc(Index).XOffset + (PIC_X \ 2) - getWidth(TexthDC, (Trim$(Name)))
                If NPC(npcNum).Sprite < 1 Or NPC(npcNum).Sprite > NumCharacters Then
                    TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - 16
                Else
                    TextY = ConvertMapY(MapNpc(Index).y * PIC_Y) + MapNpc(Index).YOffset - (DDSD_Character(NPC(npcNum).Sprite).lHeight / 4)
                End If
                Call DrawText(TexthDC, TextX, TextY, Name, QBColor(Yellow))
                Exit For
            End If
        End If
    Next
    '/Alatar v1.2
```
Link to comment
Share on other sites

I was thinking about the same thing. Haven't stress tested it. The loop could be a problem. That's why I put a break but I don't know if it would be enought in a map full of npc's or something like that.

Anyway, if I want this to be done well I will need to do it with surfaces.
Link to comment
Share on other sites

I've just converted the system from 1.0 to 1.1\. However, the quest speech window doesn't show when I attack a quest giving NPC. Mods I've implemented are the speech window and conversation mods. It worked fine when the system was still 1.0, but 1.1 seems to have broken it. The speech and conversation windows show up when they're given convos, but if the NPC is a quest giver, the quest window doesn't show at all. I don't know what could be causing the problem.
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...