Alatar
-
Posts
558 -
Joined
-
Last visited
Never
Content Type
Profiles
Forums
Calendar
Posts posted by Alatar
-
-
@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 -
@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 -
That's a pretty nice game art! :)
-
You're right :P
Sorry about that, sometimes my english-language-knowdledge fails.
On the other hand, I have a question for you Robin. The way you handle the attributes on EO (each of one with an unique frame) is really the way you originally pretended to be? -
@Zetasis:
> I just saw the two new pics and it seems like the attribute screen is too blank… If that makes sense.
Actually it's not completed so yes, it's blank. But it won't be for too long. -
It's smaller :P
You have three frames so you can switch easily between them. And it has the Map_Properties form inside this editor. Also I'm reducing the amount of mini-attribute-frames (trap, heal, warp, etc.) to just one a bit more complex.
EDIT: Added two more screens, check the main post. -
@Azkabanana:
> ![](http://i439.photobucket.com/albums/qq111/xsporeonline/fuckyeah.png)
"2 January 0: Beau has just had sexual intercouse with Robin."
"2 January 0: Beau is starving!"
"2 January 0: Robin is starving!"
lol! :P -
Hello there :)
I've been working on ~~a custom map editor~~ editing the visual structure of EO's map editor and just wanted to know what do you people think about it (the form) and if it feels like easy to use for mappers.
![](http://i52.tinypic.com/2cpap6p.png)
![](http://i51.tinypic.com/2ufac15.png)
![](http://i51.tinypic.com/2w53frq.png) -
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? -
Nice work, i like the cinematic! I will give this game a try one of this days I think, only hope that i wont get too lagged just at it happened to me with some eclipse games hosted far away from my homeland :P
-
Did you convert your NPC using this?: http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809345.html#msg809345
The "quest giver npc type" it's no longer used here. -
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. -
> 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
``` -
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. -
@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.
? -
@Ryoku:
> >.> ALATAR… I should slap you.
>
> you STILL haven't ever gotten past using MAX_BYTE for rewards, USE MAX_INTEGER YOU TWIT!
>
> I NO ONE WANTS TO TOP OUT AT 255 FOR EXP REWARDS!
Oh you're right! lol my bad
I wasn't focusing too much on the reward stuff for this release :P -
I can't believe I haven't seen this before. This is awesome one of the few worthy custom edits over here. Downloading right now :)
@Encyclopedia:
> So this is an uber late reply but, considering almost every custom engine in this board is once again tutorials crammed together with no originality or optimizations, **I will once again be working on this project.**
:cheesy:
EDIT: lol, there are a few GUI errors :P with scrollbars on Item Editor and NPC Editor, also when I hit the Resource button I get a 380 RTE and highlights this line:
```
.scrlResourceEditor(5).Value = Resource(EditorIndex).health
``` -
**Update your Quest System from v1.0 to v1.1**
Some people asked for a simple tutorial that update their previous version without having to restart all of that stuff :)
**First of all**:
Download the **Extra Files** and past them in the correct places. [modSvQuest -> [b]Server] [modQuest + frmEditor_Quest + (replace frmEditor_NPC & frmMain) -> [b]Client]
**Server**
**modCombat**
In Sub CanPlayerAttackNpc find:
```
If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_QUEST Then
```Replace with:
```
If NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_FRIENDLY And NPC(npcNum).Behaviour <> NPC_BEHAVIOUR_SHOPKEEPER Then
```Note: there are 2 of this, replace both!
Find:
If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
Replace the:
```
If NPC(npcNum).Behaviour = NPC_BEHAVIOUR_QUEST Then
Call ShowQuest(attacker, NPC(npcNum).QuestNum)
Exit Function
End If
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)
End If
```With this:
```
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
```
Sub PlayerAttackNpc, find:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, 0)
```Replace with:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, victim)
```
**modHandleData**
Go to the end of the sub, delete everything from this line to the bottom:
```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
```And paste this:
```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Exit Sub
End If
Set Buffer = New clsBuffer
Buffer.WriteLong SQuestEditor
SendDataTo Index, Buffer.ToArray()
Set Buffer = Nothing
End Sub
Sub HandleSaveQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim Buffer As clsBuffer
Dim QuestSize As Long
Dim QuestData() As Byte
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Exit Sub
End If
n = Buffer.ReadLong 'CLng(Parse(1))
If n < 0 Or n > MAX_QUESTS Then
Exit Sub
End If
' Update the Quest
QuestSize = LenB(Quest(n))
ReDim QuestData(QuestSize - 1)
QuestData = Buffer.ReadBytes(QuestSize)
CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
Set Buffer = Nothing
' Save it
Call SendUpdateQuestToAll(n)
Call SaveQuest(n)
Call AddLog(GetPlayerName(Index) & " saved Quest #" & n & ".", ADMIN_LOG)
End Sub
Sub HandleRequestQuests(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
SendQuests Index
End Sub
Sub HandlePlayerHandleQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim QuestNum As Long, Order As Long, i As Long
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
QuestNum = Buffer.ReadLong
Order = Buffer.ReadLong '1 = accept, 2 = cancel
If Order = 1 Then
Player(Index).PlayerQuest(QuestNum).Status = QUEST_STARTED '1
Player(Index).PlayerQuest(QuestNum).ActualTask = 1
Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
PlayerMsg Index, "New quest accepted: " & Trim$(Quest(QuestNum).Name) & "!", BrightGreen
'Add item on start
If Quest(QuestNum).QuestGiveItem > 0 And Quest(QuestNum).QuestGiveItem < MAX_ITEMS Then
If Quest(QuestNum).QuestGiveItemValue > 0 And Quest(QuestNum).QuestGiveItemValue < MAX_INV Then 'ToDo: stuff with currency
GiveInvItem Index, Quest(QuestNum).QuestGiveItem, Quest(QuestNum).QuestGiveItemValue
End If
End If
ElseIf Order = 2 Then
Player(Index).PlayerQuest(QuestNum).Status = QUEST_NOT_STARTED '2
Player(Index).PlayerQuest(QuestNum).ActualTask = 1
Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
PlayerMsg Index, Trim$(Quest(QuestNum).Name) & " has been canceled!", BrightGreen
End If
SavePlayer Index
SendPlayerData Index
SendPlayerQuests Index
Set Buffer = Nothing
End Sub
Sub HandleQuestLogUpdate(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
SendPlayerQuests Index
End Sub
```
**modTypes**
In Private Type NpcRec, find:
```
QuestNum As Long
```Replace with:
```
Quest As Byte
QuestNum As Long
```
**Client**
**modGameEditors**
Find:
```
.scrlQuest.Value = NPC(EditorIndex).QuestNum
```Replace with:
```
.chkQuest.Value = NPC(EditorIndex).Quest
.scrlQuest.Value = NPC(EditorIndex).QuestNum
```
**modHandleData**
Go to the end of the sub, delete everything from this line to the bottom:
```
Private Sub HandleQuestEditor()
```And paste this:
```
Private Sub HandleQuestEditor()
Dim i As Long
With frmEditor_Quest
Editor = EDITOR_TASKS
.lstIndex.Clear
' Add the names
For i = 1 To MAX_QUESTS
.lstIndex.AddItem i & ": " & Trim$(Quest(i).Name)
Next
.Show
.lstIndex.ListIndex = 0
QuestEditorInit
End With
End Sub
Private Sub HandleUpdateQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim Buffer As clsBuffer
Dim QuestSize As Long
Dim QuestData() As Byte
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
n = Buffer.ReadLong
' Update the Quest
QuestSize = LenB(Quest(n))
ReDim QuestData(QuestSize - 1)
QuestData = Buffer.ReadBytes(QuestSize)
CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
Set Buffer = Nothing
End Sub
Private Sub HandlePlayerQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim i As Long
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
For i = 1 To MAX_QUESTS
Player(MyIndex).PlayerQuest(i).Status = Buffer.ReadLong
Player(MyIndex).PlayerQuest(i).ActualTask = Buffer.ReadLong
Player(MyIndex).PlayerQuest(i).CurrentCount = Buffer.ReadLong
Next
RefreshQuestLog
Set Buffer = Nothing
End Sub
Private Sub HandleQuestMessage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim i As Long, QuestNum As Long, QuestNumForStart As Long
Dim Message As String
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
QuestNum = Buffer.ReadLong
Message = Trim$(Buffer.ReadString)
QuestNumForStart = Buffer.ReadLong
frmMain.lblQuestName = Trim$(Quest(QuestNum).Name)
frmMain.lblQuestSay = Message
frmMain.picQuestDialogue.Visible = True
If QuestNumForStart > 0 And QuestNumForStart <= MAX_QUESTS Then
frmMain.lblQuestAccept.Visible = True
frmMain.lblQuestAccept.Tag = QuestNumForStart
End If
Set Buffer = Nothing
End Sub
```
**modTypes**
In Private Type NpcRec, find:
```
QuestNum As Long
```Replace with:
```
Quest As Byte
QuestNum As Long
```
And that's all. I think :P, I haven't test it but I think it will work. -
**IMPORTANT**:
I made a converter that transfers the files from v1.0 to the new format in v1.1
**Download here**: http://www.mediafire.com/?s1npryuo6hganio
(I'm also including the source in case you've done source edit to the UDT).
**How it works?**
Simple, first paste in the correct folders the files you want to convert (example, you have Quest1.dat, Quest2.dat and Quest3.dat from your v0.1, copy+paste them in the "quests_1_0" folder).
Open the program then select if you wan't to convert NPCs or Quests from the v0.1, now select the starting value (in this case will be 1) and the limit value (in this case 3) and run. If everything goes okay, open the _1_1 folder (in this case the "quests_1_1") and you will have there the converted files. Copy+paste them in the proper folder in your server/data and that's it :) -
Solved. It was a silly mistake. Ignore this, i need a cup of coffee
:embarrassed:
>! Hi people. I was making a converter for my quest system to transfer the previous versions quests to the new format. I've done a converter long ago, by emulating one that Lightning made for items.
>! Now i don't know why i'm getting a RTE 52 (Bad file name or number), while trying to do the convertion.
>! Here's the code of the sub:
>! ```
Public Sub ConvertQuests(ByVal Start As Integer, ByVal Limit As Integer)
Dim i As Long, n As Long
lstStatus.AddItem "Starting the quests convertion."
For i = Start To Limit
Path_From = App.Path & "\quests_1_0\quest" & i & ".dat"
Path_To = App.Path & "\quests_1_1\quest" & i & ".dat"
If LenB(Dir(Path_From)) > 0 Then
lstStatus.AddItem "Loading file # " & i
'Load the v1.0
Open Path_From For Binary As #1
Get #F, , Quest10.Name
Get #F, , Quest10.QuestLog
Get #F, , Quest10.TasksCount
Get #F, , Quest10.Repeat
For n = 1 To 3
Get #F, , Quest10.Requirement(n)
Next
Get #F, , Quest10.StartItem
Get #F, , Quest10.StartItemValue
Get #F, , Quest10.StartRemoveItem
Get #F, , Quest10.StartRemoveItemValue
For n = 1 To 3
Get #F, , Quest10.Chat(n)
Next
Get #F, , Quest10.RewardItem
Get #F, , Quest10.RewardItemAmount
For n = 1 To MAX_TASKS
Get #F, , Quest10.Task(n)
Next
Close #1
lstStatus.AddItem "Writing file # " & i
'Start writing the previous stuff in the new Rec
With Quest11
.Name = Quest10.Name
.QuestLog = Quest10.QuestLog
.TasksCount = Quest10.TasksCount
.Repeat = Quest10.Repeat
For n = 1 To 3
.Requirement(n) = Quest10.Requirement(n)
Next
.QuestGiveItem = Quest10.StartItem
.QuestGiveItemValue = Quest10.StartItemValue
.QuestRemoveItem = Quest10.StartRemoveItem
.QuestRemoveItemValue = Quest10.StartRemoveItemValue
For n = 1 To 3
.Chat(n) = Trim$(Quest10.Chat(n))
Next
.RewardExp = 0
.RewardItem = Quest10.RewardItem
.RewardItemAmount = Quest10.RewardItemAmount
For n = 1 To MAX_TASKS
.Task(n) = Quest10.Task(n)
Next
End With
lstStatus.AddItem "Saving file # " & i
'Save the v1.1
Open Path_To For Binary As #1
Put #F, , Trim$(Quest11.Name)
Put #F, , Trim$(Quest11.QuestLog)
Put #F, , Quest11.TasksCount
Put #F, , Quest11.Repeat
For n = 1 To 3
Put #F, , Quest11.Requirement(n)
Next
Put #F, , Quest11.QuestGiveItem
Put #F, , Quest11.QuestGiveItemValue
Put #F, , Quest11.QuestRemoveItem
Put #F, , Quest11.QuestRemoveItemValue
For n = 1 To 3
Put #F, , Quest11.Chat(n)
Next
Put #F, , Quest11.RewardExp
Put #F, , Quest11.RewardItem
Put #F, , Quest11.RewardItemAmount
For n = 1 To MAX_TASKS
Put #F, , Quest11.Task(n)
Next
Close #1
Else
lstStatus.AddItem "Process failed at file #" & i & "!"
MsgBox "File " & i & " does not exist, the convertion ends now.": Exit Sub
End If
Next
lstStatus.AddItem "Convertion done :)"
End Sub
```
And here's a screenie:
![](http://i54.tinypic.com/j9n5v7.png)
>! PS: The quest file that is trying to load is totally working in the previous version of the engine.
>! :embarrassed: -
Sure you can xD
-
Working on a simple program that converts quests and npcs from v1.0 to v1.1, will be ready soon
-
Hmm, now i'm thinking on making a small tut to port the v1.0 to v1.1.
On the other hand, i've changed a few stuff on how the data is stored so yep, you people are going to re-do the quests/npc's or make a converter.
@Chukillz:
> nice work alatar :) thank you, here are a few questions/concerns that i have tho.
>
> 1) is there a way that we would be able to use the same NPC for different quests? like we get done with one quest and then we go back to that NPC that gave us the quest, can we get a new quest from that NPC? (if you dont understand i can explain it more in detail.
>
> 2) is there a way that we can put a ! or a ? over the NPC to let us know that there is a quest available or already in progress?
>
> Thanks again
1) No in the way the system is coded, for now each npc can only give one quest.
2) Hmm looks nice. I will add it to the to-do list. -
Version 1.1:
>! **Alatar's Quest System v1.1**
>! ![](http://i53.tinypic.com/2jfgbd5.jpg)
>! * * *
>! Hello and welcome. This is a tutorial for EO 2.0, and also includes the entire project if you wan't to use it right away without the need of following the tutorial. I've started with the idea of this system months ago, and although I abandon it a few times and moved to other things, finally in the past few days I've manage to finish it. I'm just learning to program like many here, so this was my first 'big' personal challenge. So please report any error or suggestion and I will try to do my best ^^
Ok, let's go to the important. (And please forgive me, English is not my main language)
>! **Features**
>! This quest system is a bit different to others due to the fact that it allow developers to create dinamyc quests with different purpose and itinerary, like "_go talk to X npc, then kill X amount of X npc, then talk to Y npc and gather X amount of X item, finally come back and talk to me_".
Each quest can have several tasks to do, each of one fully customizable. The quest system also has a fully working QuestLog and QuestSpeech window.
>! **Types of Tasks**
>! * **GoSlay**: Kill **X** amount of **X** npc's.
* **GoGather**: Gather **X** amount of **X** item.
* **GoTalk**: Interact with **X** npc.
* **GoTravel**: Reach **X** map.
* **GoGive**: Give **X** amount of **X** item to **X** npc.
* **GoKill**: Kill **X** amount of players.
* **GoTrain**: Hit **X** amount of times **X** resource.
* **GoGet**: Get **X** amount of **X** item from **X** npc.
>! **To-Do List**
>! * Fix a currency issue.
* Multiple rewards.
* Add "?" and "!" symbols.
>! **How it Works**
Temporary, it's working this way, but you could add buttons if you wish, and edit the ugly GUI forms and stuff. To open the Quest Editor type /editquest, to open the QuestLog press the white button.
>! **Changelog from v1.0 to v1.1**
>!
>! * New Quest Form.
* New QuestLog and QuestDialogue Form (still ugly, but works better).
* Fixed the GoGather Task that allowed an exploit by dropping and taking the item. Also re-coded the entire task to make it work better and fix other minor bugs.
* Fixed a GoTrain Task micro bug.
* Fixed and re-coded the GoGive Task.
* Fixed the GoKill bug that when a player kill another player the quests gets completed.
* Fixed the QuestLog issue that counts only for the first connected player.
* Fixed that when accepting a quest the questlog fails to update.
* Remove the NPC BEHAVIOUR QUEST, now handled with the friendly ones.
* Fixed a bug that wont allow to restart a quest if it was completed and then saved as repeatitive.
* Added the "Give-on-Start" and "Remove-on-the-end" item stuff.
* Fixed the GoSlay bug when counting enemies for quests.
* Added EXP reward.
>! Ok, let's go with the code. :huh:
>! There are two ways to use this.
>! **Way 1**
[Download the full system](http://www.mediafire.com/?8oq70z4cq2qik26) already added to a blank EO and go test it. That's all, you don't need to follow the steps.
>! **Way 2**
Install the system on your own EO manually, following the steps below and **remember** to [download the extra files](http://www.mediafire.com/?g1gn1bosic8aan1) and add them to your project:
>! **Server Side**
>! **Add the modSvQuest to your project.**
>! **modCombat**
>! Find:
```
If Len(Trim$(NPC(npcNum).AttackSay)) > 0 Then
```Above, after the Else, put
```
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
```
Sub PlayerAttackNpc, find:
```
' send death to the map
```Above place this:
```
Call CheckTasks(attacker, QUEST_TYPE_GOSLAY, npcNum)
```
Sub PlayerAttackNpc, find:
```
Call OnDeath(victim)
```Above place this:
```
Call CheckTasks(attacker, QUEST_TYPE_GOKILL, victim)
```
**modGeneral**
>! In InitServer find:
```
ChkDir App.Path & "\Data\", "spells"
```past this below:
```
ChkDir App.Path & "\Data\", "quests"
```
In ClearGameData find:
```
Call ClearAnimations
```past this below:
```
Call SetStatus("Clearing quests...")
Call ClearQuests
```
In LoadGameData find:
```
Call LoadAnimations
```past this below:
```
Call SetStatus("Loading quests...")
Call LoadQuests
```
**modHandleData**
>! Find:
```
HandleDataSub(CPartyLeave) = GetAddress(AddressOf HandlePartyLeave)
```Paste:
```
HandleDataSub(CRequestEditQuest) = GetAddress(AddressOf HandleRequestEditQuest)
HandleDataSub(CSaveQuest) = GetAddress(AddressOf HandleSaveQuest)
HandleDataSub(CRequestQuests) = GetAddress(AddressOf HandleRequestQuests)
HandleDataSub(CPlayerHandleQuest) = GetAddress(AddressOf HandlePlayerHandleQuest)
HandleDataSub(CQuestLogUpdate) = GetAddress(AddressOf HandleQuestLogUpdate)
```
At the end of the module add this:
>! ```
Sub HandleRequestEditQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
>! ' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Exit Sub
End If
>! Set Buffer = New clsBuffer
Buffer.WriteLong SQuestEditor
SendDataTo Index, Buffer.ToArray()
Set Buffer = Nothing
End Sub
>! Sub HandleSaveQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim Buffer As clsBuffer
Dim QuestSize As Long
Dim QuestData() As Byte
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
>! ' Prevent hacking
If GetPlayerAccess(Index) < ADMIN_DEVELOPER Then
Exit Sub
End If
>! n = Buffer.ReadLong 'CLng(Parse(1))
>! If n < 0 Or n > MAX_QUESTS Then
Exit Sub
End If
' Update the Quest
QuestSize = LenB(Quest(n))
ReDim QuestData(QuestSize - 1)
QuestData = Buffer.ReadBytes(QuestSize)
CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
Set Buffer = Nothing
' Save it
Call SendUpdateQuestToAll(n)
Call SaveQuest(n)
Call AddLog(GetPlayerName(Index) & " saved Quest #" & n & ".", ADMIN_LOG)
End Sub
>! Sub HandleRequestQuests(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
SendQuests Index
End Sub
>! Sub HandlePlayerHandleQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim QuestNum As Long, Order As Long, i As Long
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
QuestNum = Buffer.ReadLong
Order = Buffer.ReadLong '1 = accept, 2 = cancel
If Order = 1 Then
Player(Index).PlayerQuest(QuestNum).Status = QUEST_STARTED '1
Player(Index).PlayerQuest(QuestNum).ActualTask = 1
Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
PlayerMsg Index, "New quest accepted: " & Trim$(Quest(QuestNum).Name) & "!", BrightGreen
'Add item on start
If Quest(QuestNum).QuestGiveItem > 0 And Quest(QuestNum).QuestGiveItem < MAX_ITEMS Then
If Quest(QuestNum).QuestGiveItemValue > 0 And Quest(QuestNum).QuestGiveItemValue < MAX_INV Then 'ToDo: stuff with currency
GiveInvItem Index, Quest(QuestNum).QuestGiveItem, Quest(QuestNum).QuestGiveItemValue
End If
End If
ElseIf Order = 2 Then
Player(Index).PlayerQuest(QuestNum).Status = QUEST_NOT_STARTED '2
Player(Index).PlayerQuest(QuestNum).ActualTask = 1
Player(Index).PlayerQuest(QuestNum).CurrentCount = 0
PlayerMsg Index, Trim$(Quest(QuestNum).Name) & " has been canceled!", BrightGreen
End If
SavePlayer Index
SendPlayerData Index
SendPlayerQuests Index
Set Buffer = Nothing
End Sub
>! Sub HandleQuestLogUpdate(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
SendPlayerQuests Index
End Sub
```
**modTypes**
>! In Private Type PlayerRec, find:
```
Dir As Byte
```Paste:
```
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec
```
In Private Type NpcRec, find:
```
Level As Long
```Paste:
```
Quest As Byte
QuestNum As Long
```
**modEnumerations**
>! Find:
```
SPartyVitals
```Paste:
```
SQuestEditor
SUpdateQuest
SPlayerQuest
SQuestMessage
```
Find:
```
CPartyLeave
```Paste:
```
CRequestEditQuest
CSaveQuest
CRequestQuests
CPlayerHandleQuest
CQuestLogUpdate
```
**modPlayer**
>! Find:
```
Call SendHotbar(Index)
```Paste:
```
Call SendQuests(Index)
```
In PlayerWarp, find:
```
TempPlayer(Index).GettingMap = YES
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOREACH, mapNum)
```
In PlayerMapGetItem, find:
```
SendActionMsg GetPlayerMap(Index), Msg, White, 1, (GetPlayerX(Index) * 32), (GetPlayerY(Index) * 32)
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOGATHER, GetItemNum(Trim$(Item(GetPlayerInvItemNum(Index, n)).Name)))
```
In CheckResource find:
```
SendMapSound Index, rX, rY, SoundEntity.seResource, Resource_index
```Paste:
```
Call CheckTasks(Index, QUEST_TYPE_GOTRAIN, Resource_index)
```
>! **Client Side**
>! **Add the modQuests to your project.
Add the frmEditor_Quest to your project.
Replace your frmEditor_NPC and frmMain with the ones that I provide you.**
>! **modGameEditors**
>! In NpcEditorInit find:
```
.txtDamage.text = NPC(EditorIndex).Damage
```Paste:
```
.chkQuest.Value = NPC(EditorIndex).Quest
.scrlQuest.Value = NPC(EditorIndex).QuestNum
```
**modEnumerations**
>! Find:
```
SPartyVitals
```Paste:
```
SQuestEditor
SUpdateQuest
SPlayerQuest
SQuestMessage
```
Find:
```
CPartyLeave
```Paste:
```
CRequestEditQuest
CSaveQuest
CRequestQuests
CPlayerHandleQuest
CQuestLogUpdate
```
**modHandleData**
>! Find:
```
HandleDataSub(SPartyVitals) = GetAddress(AddressOf HandlePartyVitals)
```Paste:
```
HandleDataSub(SQuestEditor) = GetAddress(AddressOf HandleQuestEditor)
HandleDataSub(SUpdateQuest) = GetAddress(AddressOf HandleUpdateQuest)
HandleDataSub(SPlayerQuest) = GetAddress(AddressOf HandlePlayerQuest)
HandleDataSub(SQuestMessage) = GetAddress(AddressOf HandleQuestMessage)
```
At the end of the module, past this:
```
Private Sub HandleQuestEditor()
Dim i As Long
With frmEditor_Quest
Editor = EDITOR_TASKS
.lstIndex.Clear
>! ' Add the names
For i = 1 To MAX_QUESTS
.lstIndex.AddItem i & ": " & Trim$(Quest(i).Name)
Next
>! .Show
.lstIndex.ListIndex = 0
QuestEditorInit
End With
>! End Sub
>! Private Sub HandleUpdateQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim n As Long
Dim Buffer As clsBuffer
Dim QuestSize As Long
Dim QuestData() As Byte
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
n = Buffer.ReadLong
' Update the Quest
QuestSize = LenB(Quest(n))
ReDim QuestData(QuestSize - 1)
QuestData = Buffer.ReadBytes(QuestSize)
CopyMemory ByVal VarPtr(Quest(n)), ByVal VarPtr(QuestData(0)), QuestSize
Set Buffer = Nothing
End Sub
>! Private Sub HandlePlayerQuest(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim i As Long
>! Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
For i = 1 To MAX_QUESTS
Player(MyIndex).PlayerQuest(i).Status = Buffer.ReadLong
Player(MyIndex).PlayerQuest(i).ActualTask = Buffer.ReadLong
Player(MyIndex).PlayerQuest(i).CurrentCount = Buffer.ReadLong
Next
RefreshQuestLog
Set Buffer = Nothing
End Sub
>! Private Sub HandleQuestMessage(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim Buffer As clsBuffer
Dim i As Long, QuestNum As Long, QuestNumForStart As Long
Dim Message As String
Set Buffer = New clsBuffer
Buffer.WriteBytes Data()
QuestNum = Buffer.ReadLong
Message = Trim$(Buffer.ReadString)
QuestNumForStart = Buffer.ReadLong
frmMain.lblQuestName = Trim$(Quest(QuestNum).Name)
frmMain.lblQuestSay = Message
frmMain.picQuestDialogue.Visible = True
If QuestNumForStart > 0 And QuestNumForStart <= MAX_QUESTS Then
frmMain.lblQuestAccept.Visible = True
frmMain.lblQuestAccept.Tag = QuestNumForStart
End If
Set Buffer = Nothing
End Sub
```
**modInput**
>! Find:
```
SendRequestEditSpell
```Paste:
```
Case "/editquest"
If GetPlayerAccess(MyIndex) < ADMIN_DEVELOPER Then GoTo Continue
SendRequestEditQuest
```
**modTypes**
>! In Private Type PlayerRec, find:
```
Step As Byte
```Paste:
```
PlayerQuest(1 To MAX_QUESTS) As PlayerQuestRec
```
In Private Type NpcRec, find:
```
Level As Long
```Paste:
```
Quest As Byte
QuestNum As Long
```
>! * * *
>! And that's all! Tell me if anything goes wrong. I hope that this system could be useful to your project, and if you use it please give credits ;)
>! **_- Alatar_**
>! * * *
>! Special thanks to Erwin and people who help here bugfixing while I was inactive. :)
And to the people who reported bugs ^^
>! * * *
>! **All Versions**
>! * Alatar's Quest System v1.1: [Link](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809248.html#msg809248)
* Alatar's Quest System v1.0: [Link](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg758371.html#msg758371).
>! * * *
>! **Extras**
>! * [Convert quests from v1.0 to v1.1](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809345.html#msg809345)
* [Update your whole system from v1.0 to v1.1](http://www.touchofdeathforums.com/smf/index.php/topic,70502.msg809347.html#msg809347)
**Changelog**:
* New Quest Form.
* New QuestLog and QuestDialogue Form (still ugly, but works better).
* Fixed the GoGather Task that allowed an exploit by dropping and taking the item. Also re-coded the entire task to make it work better and fix other minor bugs.
* Fixed a GoTrain Task micro bug.
* Fixed and re-coded the GoGive Task.
* Fixed the GoKill bug that when a player kill another player the quests gets completed.
* Fixed the QuestLog issue that counts only for the first connected player.
* Fixed that when accepting a quest the questlog fails to update.
* Remove the NPC BEHAVIOUR QUEST, now handled with the friendly ones.
* Fixed a bug that wont allow to restart a quest if it was completed and then saved as repeatitive.
* Added the "Give-on-Start" and "Remove-on-the-end" item stuff.
* Fixed the GoSlay bug when counting enemies for quests.
* Added EXP reward.
[EO] Alatar's Quest System v1.2
in Source
Posted