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

well alatar I tested your  ? and ! and it works just fine.

however i made a custom version that works with using CSDE convo system as INFO

>.< it was hard coming up with a way to make "Info" go away only when something else was there XD

```
    Dim i As Long

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

        If i <= MAX_QUESTS Then
            If Player(MyIndex).PlayerQuest(i).Status = QUEST_STARTED Then
                If Quest(i).Task(Player(MyIndex).PlayerQuest(i).ActualTask).NPC = NPCNum Then
                    Name = "Quest[?]"
                    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) - 8
                    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 = "Quest[!]"
                    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) - 8
                    End If
                    Call DrawText(TexthDC, TextX, TextY, Name, QBColor(Yellow))
                    Exit For
                End If
            End If
        End If

        If i > MAX_QUESTS Then
            If NPC(NPCNum).Convo = True Then
                    Name = "Info"

                    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) - 8
                    End If
                    ' Draw name
                    Call DrawText(TexthDC, TextX, TextY, Name, color)
                    Exit For
            End If
        End If

    Next

```
Link to comment
Share on other sites

Athagekin in that case I think it's because the quest giver "talks" with QuestMessage procedure, instead of PlayerMsg. Haven't checked the conversation system yet but I think that maybe it's that the problem.

Ryoku what's that for? xD
A INFO message over every single friendly npc's head that has a conversation to do?
Link to comment
Share on other sites

alatar about your ? and ! code, Thank you

i was looking at ryokus code and the first thing i noticed right from looking at the code is that it only showed the ? :P

i am still working on getting this in to my game (i am having some help for the obvious reason that im not very good at vb6) but all in all i want to say thanks

On another note, do you think there will be a future version that will allow NPCs to be used for more then one quest? because the way i see it, (and tell me if i am wrong please) if i set up a NPC as a quest giver and then that NPCs quest is finished, then for the remainder of the game, that NPC is useless and it will just be there in the game with no future purpose.
Link to comment
Share on other sites

Ryoku posted that to either use "?" or "!" for npcs that give quest not the way altar did it like you have have described. If you read Ryokus code it shows > Name = "?" 'or ! < meaning u can change it to whatever you want not that it will change depending on the quest status  :P
Link to comment
Share on other sites

@Chukillz:

> On another note, do you think there will be a future version that will allow NPCs to be used for more then one quest? because the way i see it, (and tell me if i am wrong please) if i set up a NPC as a quest giver and then that NPCs quest is finished, then for the remainder of the game, that NPC is useless and it will just be there in the game with no future purpose.

It will stay there just as another friendly npc…
I don't know if that would change for now maybe in a distant future :P
Link to comment
Share on other sites

ok another question then, if i was to set up a quest giver on map1 and the player finishes the quest, and then i set up the same npc on map2 as a quest giver, would it still count as the same quest for the NPC on the different map? (i hope that wasnt confusing for you :P )
Link to comment
Share on other sites

@Chukillz:

> ok another question then, if i was to set up a quest giver on map1 and the player finishes the quest, and then i set up the same npc on map2 as a quest giver, would it still count as the same quest for the NPC on the different map? (i hope that wasnt confusing for you :P )

*confused*

Err… the quest that one npc gives is setted on the NPC editor, so if you create an npc called let's say "Bob" that gives a quest called "Bob Quest", and you set this "Bob" in maps 1, 2, 4 and 114 for example, and you do it, every single Bob npc will have the "Bob Quest" finished.

If that was your question :P
Link to comment
Share on other sites

Ok I'm not sure where I should be posting this but since the topic was started here I will ask here..
Ryoku gave me a code to use to make the "sub CanPlayerAttackNpc" work with both the Quest system and the Conversation system.

This is what I originally had in place and it was wrong as Only the **conversation system** works and the quest system was not working:
```
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

End Function
```
So I replaced it with the code Ryoku suggested and it made the **quest** giver work but now the conversation npc doesn't respond when attacked what is wrong with this code?
```
If NpcX = GetPlayerX(attacker) Then
                If NpcY = GetPlayerY(attacker) Then

                        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
                                If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
                                    PlayerMsg attacker, Trim$(NPC(npcNum).Name) & ": " & Trim$(NPC(npcNum).AttackSay), White
                                Else
                                    InitChat attacker, mapNum, mapNpcNum
                                End If
                                Exit Function
                            End If
                        End If
                        End If
                    End If
                End If
            End If
        End If
End Function
```
Link to comment
Share on other sites

@Bean:

> I think he's trying to link the conversation system with the quest system, so you can initialize a quest through a conversation.

not really i was just trying to get the conversation system to work in the same project as the quest system.
the first code above makes it so only the conversation system works and the quest system does not AND the second code above makes the quest system work and the conversation system not work…
Does it make any sense? Im not trying to do anything with linking them together just wanna have them both working =)
Link to comment
Share on other sites

Hmmm, try with the first one something like

```
                          If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY Then
                            If NPC(npcNum).Convo = True Then
                                InitChat attacker, mapNum, mapNpcNum
                                Exit Function
                            End If
                        End If
```
EDIT: or with the second one something like this:

```
                            If NPC(npcNum).Quest = NO Then
                                If NPC(npcNum).Convo = False Then
                                  If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
                                    PlayerMsg attacker, Trim$(NPC(npcNum).Name) & ": " & Trim$(NPC(npcNum).AttackSay), White
                                  End If
                                Else
                                    InitChat attacker, mapNum, mapNpcNum
                                End If
                                Exit Function
                            End If
```
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...