Help with your scripting

Simple Quest System

Simple Quest System

Postby Shando » 14 Jun 2015, 09:22

Hi All,

As you may know, I have been developing some Plugins recently (which are almost complete, just need a bit of help from the Devs when they're back up and running). So, I thought I might also make a simple Quest plugin (which will probably work nicely with one of my other plugins!).

At the moment, until we get access to a database, I'm planning on using Lua Tables and have come up with the following things that may be required:

    Quest Name (string) - name of the Quest
    Quest ID (int) - ID of the Quest

    Quest Prerequisites (table): - contains the things that are required BEFORE the Quest can be undertaken
      Location (int) - a location in the world (NB: This ties in with a field in one of my plugins)
      Level (int) - the level of the Player (allows for the implementation of a simple Levelling System)
      Items (table) - a list of Items the Player must have acquired (allows for the implementation of a simple Inventory System)
      Skills (table) - a list of Skills the Player must have acquired (allows for the implementation of a simple Skills System)
      Class (table) - the class of the Player (allows for the implementation of a simple Class System)
      NPCs (table) - a list of the NPCs that the Player MUST have met
      Quests (table) - a list of the Quests that the Player MUST have completed
    Completed (function) - a function that determines if the Player has COMPLETED, or FAILED, the Quest

    Timer (timer) - a timer that can be used for timed Quests

    Rewards (table) - contains the Rewards for completing the Quest
      Items (table) - Items that will be awarded to the Player
      Skills (table) - Skills that will be awarded to the Player
      XP (int) - Experience Points that will be awarded to the Player
      Money (int) - Money that will be awarded to the Player (allows for the implementation of simple Trade System)
Please let me know what you think (especially if you have any additions etc.) and I'll see what I can come up with.

Thanks

Shando

PS: I'll probably try to implement the other "Systems" mentioned above before I implement the Quest System.
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Simple Quest System

Postby TattieBoJangle » 14 Jun 2015, 14:46

This would cover a huge amount and would be great to have it in a game the only other thing i could think of that would make the even better would be an inventory system but that may be better in its own.

Keep up the great work m8 cant wait to see it in action.
Case: CM Storm Trooper CPU: I7 5930k X99 Cooler: Noctua NH-D15 Graphics: Asus GTX 1080 Motherboard: Rampage Extreme V x99 Ram: RipJaws DDR4 3000mhz Storage: x2 SSD Crucial 500GB + x5 2TB Hdd PSU: Evga 1500w OS: Windows 10
User avatar
TattieBoJangle
Community Manager
Community Manager
 
Posts: 858
Joined: 26 Jan 2015, 00:15
Location: United Kingdom
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer
Skill: Great creative

Re: Simple Quest System

Postby SolarPortal » 19 Jun 2015, 16:06

Very good idea Shando.

Q) What sort of database are you after? MySQL, simple in engine database, etc....

it looks like the basics are covered in what you wrote, if anything pops into mind, i will jot them down.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Simple Quest System

Postby Shando » 20 Jun 2015, 01:46

Hi SP,

I really don't care what sort of database it is (either in-engine or MySQL) ;) But, having said that, I do know SQL pretty well, so something SQLesque would be perfect.

At the moment I'm just using Lua Tables to test out some of my code!! :roll: Though I have mapped out the required minimalist database which I'll post here shortly for feedback.

Shando
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Simple Quest System

Postby Shando » 20 Jun 2015, 03:53

As per my previous message, here is my proposed database. Feel free to comment / suggest changes etc. as I know very little about RPGs (I used to play AD&D many years ago though!). Also, please bear in mind this is NOT meant to be a full-blown RPG implementation, just a minimalist one to showcase the new Quest System I'm trying to create.

CAVEAT: where I have used ("00") or similar, this relates to my proposal to use codes from "00" to "ZZ" to represent the IDs of the various things. This is a restriction of Global Tables, and would not be necessary in a proper SQL type Database. A value of "00" means NONE, and a value of "ZZ" means ALL.

Items Table
Code: Select all
a table containing ALL Items found in the game
id                  the id of the Item (string - "01" - "ZY")
name               the name of the Item (string - "Sword of Valerus" etc.)
type                        the type of the Item (string - "Potion", "Spell" etc.)
typeid               ??


Potions Table
Code: Select all
a table containing ALL Potions found in the game
id                  the id of the Potion (string - "01" - "Zy"  - this is the same id as in the Items table)
health               the value that health will increase (or decrease) if the Potion is used (integer)
armour               the value that armour will increase (or decrease) if the Potion is used (integer)
strength                    the value that strength will increase (or decrease) if the Potion is used (integer)
dexterity                    the value that dexterity will increase (or decrease) if the Potion is used (integer)
wisdom               the value that wisdom will increase (or decrease) if the Potion is used (integer)
speed               the value that speed will increase (or decrease) if the Potion is used (integer)
time                       the length of time that the Potion will be effective (integer - 0 = INDEFINITE)
usable               who can use the Potion (string - "001003015" - this string is made up from the BINARY values of the Sex, Race & Class selected by the Player)
price                       the price that the Potion can be SOLD for (integer)

Spell Table
Code: Select all
a table containing ALL Spells found in the game
This is almost identical to the Potions Table, but has the following changes / additional fields:
damage               the damage caused to the recipient of the Spell (integer)
distance                    the maximum range that the Spell is effective (integer)
affects               the NPCs that can be affected by the spell (table - this table contains a list of the IDs of ALL NPCs that can be affected by the Spell).

Melee Weapons Table
Code: Select all
a table containing ALL Melee Weapons found in the game
This table only has "damage", "usable", "affects" and "price" fields

Ranged Weapons Table
Code: Select all
 a table containing ALL Ranged Weapons found in the game
This table is almost identical to the Melee Weapons Table, but also has a "distance" field

Special Items Table
Code: Select all
a table containing ALL Other Items found in the game
This table has all of the fields mentioned above

NPC Table
Code: Select all
a table containing ALL NPCs found in the game
id                  the id of the NPC (string - "01" to "ZY")
skyid                       the Skyline ID of the NPC (integer)
type                       the type of the NPC (string - "Blacksmith", "Ogre", Shopkeeper", "Golem" etc.)
health               the health value of the NPC (integer)
armour               the armour value of the NPC (integer)
walkspeed                    the speed that the NPC walks (integer - 0 = STATIONARY)
runspeed                    the speed that the NPC runs (integer - 0 = STATIONARY)
flyspeed                    the speed that the NPC flies (integer - 0 = DOESN'T FLY)
melee               the damage caused when using Melee Weapons
ranged               the damage caused when using Ranged Weapons

Levels Table
Code: Select all
a table used by the Levelling System
id                  the id of the Level (string - "01" to "ZY")
xp                  the XP required for this Level (integer)

Race Table
Code: Select all
a table containing ALL available options for the Race of the Player
id                  the id of the Race (string - "01" to "ZY")
type                       the Race type (string)

Class Table
Code: Select all
a table containing ALL available options for the Class of the Player
id                  the id of the Class (string - "01" to "ZY")
race                       the id of the Race (string - "01" to "ZZ")      this is required if you need to restrict the Classes to specific Races
type                       the Class type (string)

Trade Table
Code: Select all
a table containing ALL Items that are available in shops etc.
id                  the id of the Trade Item (string - "01" to "ZY")
itemid               the id of the Item from the Items Table (string - "01" to "ZY")
npcid               the id of the NPC (string - "01" to "ZY")
cost                       the cost to BUY the Item (integer)
availsex                    what Sex(es) can buy this Item (string - "01" = Male Only, "02" = Female Only, "ZZ" = Both
availrace                    what Race(s) can buy this Item (string - "01" to "ZZ")
availclass                    what Class(es) can buy this Item (string - "01" to "ZZ")
availlevel                    the MINIMUM Level that the Player MUST be to buy this Item (string - "01" - "ZY")

Inventory Table
Code: Select all
a table containing a list of ALL Items in the Player's Inventory
This table can contain multiple Items, with the FIRST FIVE being reserved for "Quick Use" Items
id                  the id of the Item from the Items Table (string - "01" to "ZY")

Current Quests Table
Code: Select all
a table containing a list of ALL Quests that the Player is currently undertaking
This table can contain multiple Items
id                  the id of the Quest from the Quest Table (string - "01" to "ZY")

Selected Class Table
Code: Select all
a table containing the selected Sex, Race & Class of the Player
idsex                       the Sex of the Player (string - "01" = Male, "02" = Female)
idrace               the Race of the Player (string - "01" to "ZY")
idclass               the Class of the Player (string - "01" to "ZY")

Quest Table
Code: Select all
a table containing ALL Quests available in the game
id                  the id of the Quest (string "01" - "ZY")
name               the name of the Quest (string)
prereq               (table - see below)
complete                    (table - see below)
rewards               (table - see below)
timer               a value that denotes how long the Player has to complete the Quest (integer)

Prereq Table
Code: Select all
a table containing ALL Prerequisites required before the Player can undertake the Quest
items               a list of Items required (table)
skills                       a list of Skills required (table - contains both Skill ID and Level)
class                       a code denoting the Sex, Race & Class required (string - "001003005" - BINARY representation of Sex, Race & Class)
npcs                       a list of NPCs that the Player MUST have interacted with (table - see NPCInteraction Table below)
quests               a list of previous Quests that the Player MUST have completed (table - see QuestsCompleted Table below)

Complete Table
Code: Select all
a table containing ALL the requirements to Complete the Quest
items               a list of Items that the Player MUST have found (table)
npcs                       a list of NPCs that the Player MUST have interacted with (table - see NPCInteraction Table below)
toKill                       a list of NPCs that the Player MUST have killed (table - see NPCKill Table below)

Rewards Table
Code: Select all
a table containing ALL the Rewards to be given to the Player on Completion of the Quest
xp                  the value of XP to be awarded to the Player (integer)
money               the value of Money to be awarded to the Player (integer)
items               a list of Items to be awarded to the Player (table)
skillpts                    the value of Skill Points to be awarded to the Player (integer)

Player Skills
Code: Select all
a table listing the values of the various Skills acquired by the Player
id                  the id of the Skill (string - "01" to "ZY" - from the Skills Table below)
points               the current value of Skill Points allocated to the Skill (integer)
level                       the current level of the Skill (integer)

Skills Table
Code: Select all
a table listing ALL Skills available in the game
id                  the id of the Skill (string - "01" to "ZY")
skill                       the name of the Skill (string - "Strength", "Dexterity", "Wisdom" etc.)
skilltable                    a table containing the number of Skill Points and the Level (table - similar to the Levels Table above)


Shando

PS: Sorry about the formatting :oops: It's times like this that I wish BBCode had a Table format (or Tabs!!)

PPS: I also came across this example https://github.com/jgoodman/MySQL-RPG-Schema
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Simple Quest System

Postby Shando » 21 Jun 2015, 10:16

UPDATE

I've made a few changes to the Tables listed in my previous message, so rather than posting another long message, I've uploaded a pdf of my proposed Tables here:

http://1drv.ms/1GAe8ov

Regards

Shando

PS: I'll probably be starting work on the actual code over the next week, so please let me know of any changes etc. as soon as possible.
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Simple Quest System

Postby SolarPortal » 21 Jun 2015, 17:54

just been looking into mysql with lua and found this page http://keplerproject.github.io/luasql/doc/us/manual.html from the lua website. All we might need to do is compile(dll or other file type) it into the system. Have a read and let us know :)

I am also trying to see if we can have a table bbcode system as it would make lists like yours tidier to read. Will let you know how this one turns out. However, the list and its contents are very interesting and i feel you have covered a lot of bases, it will be interesting to see how this plays out.
The PDF is a really good document outlining the data. Good job!

Another idea we had to do with storing your tables could be to use excel and use the script file interaction system you first built for the community to access and read the data into lua easier. That way its easier to type out and read in every time.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Simple Quest System

Postby Shando » 22 Jun 2015, 01:11

just been looking into mysql with lua and found this page http://keplerproject.github.io/luasql/d ... anual.html from the lua website. All we might need to do is compile(dll or other file type) it into the system. Have a read and let us know :)


Looks perfect as it allows connection to quite a few different database types :D

Another idea we had to do with storing your tables could be to use excel and use the script file interaction system you first built for the community to access and read the data into lua easier. That way its easier to type out and read in every time.


I was thinking of making a "plugin" that would store the data in xml, or JSON, files ( as csv needs to be 'flattened' to cope with nested tables :( ) and then create a loader that can be run when the game starts to load all of the data into Lua Tables (for speed of access). If we can get in-built database connectivity, then I can create the database straight from the "plugin" 8-) I am assuming that direct database access will be too slow in-game, so we would still need to load the data into Lua Tables for run-time access?

Shando

EDIT: I have come across these two libraries, which would be very useful for complex data reading/writing:

LuaXML - http://viremo.eludi.net/LuaXML/, and
JSON for Lua - https://github.com/xpol/lua-rapidjson

EDIT 2: Been thinking about this a bit more, and would definitely prefer the JSON functionality if possible ( though both would be handy of course ;) )
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: Simple Quest System

Postby SolarPortal » 23 Jun 2015, 20:09

i will look into this and see whats integratable the best. I will check the JSON interface first as well as MySQL :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: Simple Quest System

Postby Shando » 24 Jun 2015, 01:11

SolarPortal wrote:i will look into this and see whats integratable the best. I will check the JSON interface first as well as MySQL :)


Hi SP,

Thanks for this, it'll certainly make life easier :D
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 5 guests

cron