![]() |
My Quest System - Printable Version +- Mirage Engine (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: My Quest System (/showthread.php?tid=136) |
My Quest System - Leighland - 19-06-2006 This was based on the following script at: http://www.touchofdeathproductions.com/scripts.html By Unknown_raven Difficulty: 4/5 (Requires some programming ability) It uses a flag system which can become confusing but I'll leave a sample quest at the end of this tutorial for all to see. Server Side Create a new Module. Name it modQuest and add the folowing: Code: Option Explicit Now I'll explain how this works. Basically you are using a system of flags to detrmine how much of the quest has been completed, and it also prevents parts of the quest which were allready finished from being done again, such as recieveing the reward for the quest. Function GetFlagHeight - This function is pretty self explanatory. It access the file 'flags.ini" and checks to see what the current flag's height is. This is specified by the "flagnum". An example of how this could be used is: Code: If GetFlagHeight(index, 1) = 0 Then [b] ' Check the height of flag 1[/b] Sub RaiseFlag - This again is quite obvious. It raises the flag specified by "flagnum" so that any event that allready happened cannot happen again. See the above code example to see how it works. Sub LowerFlag - This again is quite obvious. It lowers the flag specified by "flagnum" so that any event that allready happened can happen again. I haven't exactly thought of any real way this might come into play during a quest but maybe someone else can. Sub SetFlag - This is used to set the height of a flag to a specific height. I haven't needed to use it in my quests yet because they're all hide and go seek quests, so a few IF statements with the getflagheight and raiseflag commands is suitable. There, now that we have a basic understanding of what each function/sub routine does, let's move on to getting these quests to work. First fo all we want to make sure that each players has some flags, otherwise the quests won't work. Open up modGameLogic (still server side): Find: Code: Sub JoinGame(ByVal index As Long) And right under it add: [code] Dim BeenFlagged As Boolean, Num As Integer Dim filename1 As String filename1 = App.Path & "\flags\" & GetPlayerName(index) & ".ini" If Not FileExist(filename1) Then BeenFlagged = False End If If BeenFlagged = False Then Num = 1 'Change the 3 to number of flags you want per player Do While Num - SheepDog - 19-06-2006 I've read most of it, and that seems like a very logical way to set it out. Kudos. Would seem quite annoying though if you have a large player base and a limited amount of quests.. Because there'll be nothing to do? - Sign - 19-06-2006 The system seems very interesting but so simple. Nice job - Dr. Spoon - 21-06-2006 nice system could use a few changes to make it more adptible for larger games with more quests maybe scripting of sorts to add new quests to it or a quest editor a decent idea well thought out - Kenko - 21-06-2006 Had something similar to this on my game for a year, but more advanced. Pretty nice base, though. - Leighland - 23-06-2006 I agree with all of you. It does the job for now, for me and it was modified to fit MSE from that touchofdeath tutorial, which used scripted tiles. Like I said though, if anyone wants to expand on it, feel free. Should the day come along that I need to expand it, I'll be sure to post a new tutorial for it. - Bradyok - 24-06-2006 Woah this is really cool. While i'm not going to actually use any code, the whole flag idea seems pretty cool, and would greatly improve my quest system. Nice job on this. =x - ice - 25-06-2006 Nice tutorial, it really helped. It would be neat though if the quest starts when the player steps on a tile instead of when he enters the map, but I'll be able the figure that out myself I think ![]() - Matt - 25-06-2006 You should greatly improve upon it, by making npc's start the quest instead. Would make your game more realistic. I mean, who steps on a tile or walks into an area and is suddenly given a quest to do? Lol. It's a very good base for a quest system though. Nicely done. - Tosuxo - 25-06-2006 Advocate Wrote:I mean, who steps on a tile or walks into an area and is suddenly given a quest to do? Lol. some quests could work with that... like you enter a room with like a dragon in it, (a non-killing NPC kinda thing) and it gives you a quest... without speaking to it... as you don't know how to speak in dragon-ite or w.e. lol oh i'm just making stuff up sorry lol yeh, it's a great basis to make a quest system from... but i don't think he'd be willing to make the most UBER quest system and then just release it... i mean... my house system (which is complete) could sell... but i gave away the base code (which i'll post a complete tutorial (without mistakes) here later) - ice - 25-06-2006 Well, I meant a new tile type, so the quest would start when you see a wanted poster or something, but yea, it would be even better if the quest starts when you talk to a npc ![]() - Matt - 27-06-2006 Since I now have a computer around here, I MIGHT, if I FEEL like it, improve upon this, and add in the NPC stuff. But I'll make it to where you can still have it the base way as well. ^_^ (If someone doesn't beat me to it, as I have currently much on my plate.) - Leighland - 30-06-2006 Major flaw on my server which was just worked out. It wasn't checking if the file existed right on the joingame sub. I've changed it to look as such: Replace: [code] If Not FileExist(filename1) Then BeenFlagged = False End If If BeenFlagged = False Then Num = 1 'Change the 3 to number of flags you want per player Do While Num |