Skills, attributes ( like health, Magicka, stamina), and classes

I've been looking through the Quest Tutorial, and as of yet, I have found no way to implement anything like skills, attributes, or classes like what you would see in Fallout, TES, or basically any other D&D inspired CRPG. Perhaps I'm looking in the wrong place, or there is no way to implement such mechanics.

Does anyone have any ideas about how to do this, or what part of the tutorial I should look in? Also, I would like to know if there is a way to use a RNG for things like combat and character interaction?

I've been going through the Lone Wolf series via a cellphone app, and have been inspired to make a similar thing but with more complicated D&D style mechanics. Actually several if I can manage it. So many ideas......so little time.


Hi,
There are no predefined attributes like in TES or Fallout engines, but it is possible to implement them, it just requires some work.
In this repository you can see my very incomplete (and still ongoing) work to implement d&d style RPG system.

The main idea is to have base types with numeric properties like "strength" or "agility" and have NPCs and player inherit from those types.


here's some links/guides to get you started:

http://textadventures.co.uk/forum/general/topic/ljjm32av4e2t9ot49k478g/help#710be61e-eae1-4af1-8363-520cc718ba1c

ask if you need help with anything or are confused about anything


(filler for getting my edited post, updated/posted)


Data (VARIABLES: Attribute and Variable, and their: Value) Types:

(these are how to create and apply, along with actions which this post does NOT cover: scripting: an_Object's_Script_Attributes/Functions/Commands/Turnscripts/Timers/etc, a game's stats/attributes/skills/text-dialogue-messages/events/etc-etc-etc)


VARIABLES:
-> Attributes: global scope (due to being "attached", contained within, an Object) and "permanent" (so long as the Object containing the Attribute, exists or still exists, of course): player.strength = 100
-> Variables: local scope (can NOT be used outside of its scripting, due to NOT being "attached", NOT contained within, an Object) and temporary (ceases to exist when its scripting is completed): strength = 100
-> Parameters/Arguments: deals with Functions/Commands/etc? (basically they're VARIABLES or direct/literal VALUES inputted into the Function/Command/etc for it to then use them within its scripting)


The 'String' Data Type:

a collection of characters (alphabet and numeric/numbers) and/or (some) symbols

anything encased within the double quotes is a String

"a"
"abc"

"1" // this is a String Value due to the double quotes, and NOT an amount (integer:non-decimal/double:decimal) value, you can NOT do arithmetic (addition, subtraction, multiplication, division) on string values

"123" // this is a String Value due to the double quotes, and NOT an amount (integer/double) value, you can NOT do arithmetic (addition, subtraction, multiplication, division) on string values

"abc123"
"abc_123"
"Hi, welcome to my game, I hope you enjoy it"

game.intro = "Hi, welcome to my game, I hope you enjoy it"

player.condition = "normal"
player.condition = "poisoned"
player.condition = "dead"


The 'Boolean' Data Type:

true
false

(notice how they do NOT have the double quotes, as if they did, they'd be String Values and not Boolean Values)

the 'true/false' are special/reserved values for Booleans

player.poisoned = false
player.poisoned = true

player.flying = false
player.flying = true

handled = true
handled = false

tv.switchedon = false
tv.switchedon = true

game.paused = false
game.paused = true

orc.dead = false
orc.dead = true


The 'Integer' Data Type:

non-decimal amount values

-9999999
-1
0
1
99999999

(notice how they do NOT have the double quotes, as if they did, they'd be String Values and not Integer Values)

player.strength = 100
game.state = 0

player.strength = 100
katana.damage = 50
player.weapon = katana // this Attribute/Data/Value Type will be explained further down, in a different data type section
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [100] / 100
// player.damage = 100

player.strength = 0
katana.damage = 50
player.weapon = katana // this Attribute/Data/Value Type will be explained further down, in a different data type section
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [0] / 100
// player.damage = 50

player.strength = 50
katana.damage = 50
player.weapon = katana // this Attribute/Data/Value Type will be explained further down, in a different data type section
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [50] / 100
// player.damage = ~ 75

player.strength = 75
katana.damage = 50
player.weapon = katana // this Attribute/Data/Value Type will be explained further down, in a different data type section
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [75] / 100
// player.damage = ~ 87

player.strength = 25
katana.damage = 50
player.weapon = katana // this Attribute/Data/Value Type will be explained further down, in a different data type section
player.damage = player.weapon.damage + player.weapon.damage * player.strength / 100
// player.damage = [50] + [50] * [25] / 100
// player.damage = ~ 62


The 'Double' Data Type:

double: floats / floating points: decimal amounts

-99999.123
-9.123
0.0
9.123
99999.123

(notice how they do NOT have the double quotes, as if they did, they'd be String Values and not Double Values)


The 'Object' (reference/pointer) Data Type:

Objects and Object reference/pointer Values are anything without the double quotes and also that are not any of the reserved/special words like 'true/false' and many/some others as well...

create ("katana") // creating a 'katana' Object
create ("claymore") // creating a 'claymore' Object
create ("battle_axe") // creating a 'battle_axe' Object

player.weapon = katana
player.weapon = claymore
player.weapon = battle_axe

// the default 'player' Player Object is the default Player Object of new games, so it already exists, so we don't need to create it
// the default 'room' Room Object is the default Room Object of new games, so it already exists, so we don't need to create it
create ("room2")
create ("room3")
// moving ("teleporting/warping") the 'player' without using the 'Exits':
// (the built-in 'parent' Object Reference/Pointer Attribute is how containment is actually determined/controlled)
player.parent = room
player.parent = room2
player.parent = room3

(notice how they do NOT have the double quotes, as if they did, they'd be String Values and not Object Reference/Pointer Values)


The 'List' Data Type:

technically, lists are just a string that is segmented/split/divided into smaller string (or Object reference/pointer) parts/segments/pieces (via a selected separator), which we call as 'items'

create ("example_object")
example_object.color_string = "red;blue;yellow"
msg (example_object.color_string)
// output/results:
// red;blue;yellow
example_object.color_list = Split (example_object.color_string, ";")
// we're segmenting our string into items via the ';' character, as our 'SEPERATOR' that the 'Split (STRING, SEPERATOR)' Function uses to segment the string into smaller parts/strings/items, as can be seen below:
DisplayList (example_object.color_list, true)
// output/result:
// 1. red
// 2. blue
// 3. yellow

and we can then rejoin our list back into a string too:

example_object.example_color_string = Join (example_object.color_list, ";")
msg (example_object.example_color_string)
// output/results:
// red;blue;yellow

or, we can just create a new (blank) List, and add/remove items to it:

create ("example_object")
example_object.color_list = NewStringList () // this creates a new (blank) list
list add (example_object.color_list, "red")
list add (example_object.color_list, "blue")
list add (example_object.color_list, "yellow")
DisplayList (example_object.color_list, true)
// output/result:
// 1. red
// 2. blue
// 3. yellow
list remove (example_object.color_list, "blue")
DisplayList (example_object.color_list, true)
// output/result:
// 1. red
// 2. yellow

you can also think of Lists as input-output functions too:

(a list's items are automatically numbered starting at 0, and NOT 1 - this takes some time to get used to, this numbering is known as their 'index number')

a String List's item:
input: STRING: "INDEX_NUMBER"
output: STRING: "VALUE"

an Object List's item:
input: STRING: "INDEX_NUMBER"
output: OBJECT (reference/pointer): OBJECT

// IMPORTANT: you can NOT use the 'Split (LIST, SEPARATOR)' Function to create an Object List (as it can only create String Lists), you must use create a new (blank) Object List Function and add the items (OBJECT references/pointers) to it

example_object.color_list = Split ("red;blue;yellow", ";")

item 1:
input: "0"
output: "red"

item 2:
input: "1"
output: "blue"

item 3:
input: "2"
output: "blue"

item 4:
input: "3"
ERROR: there is no 4th item!

this takes people a while to get used to:
3 items: red, blue, and yellow
but the index numbers are: 0, 1, 2
just got to remember that the last index number (the last item in the list) is: the number of items [ListCount (LIST)] - 1:
3 items, but the last item's index number is 2 (3 items - 1)

StringListItem (example_object.color_list, "0") ===> red
StringListItem (example_object.color_list, "1") ===> blue
StringListItem (example_object.color_list, "2") ===> yellow
StringListItem (example_object.color_list, "3") ===> ERROR! there is no 4th item!


The 'Dictionary' Data Type:

it's basically the same as lists, except you select/determine/input/type-in what it's input is (its input is customizable, it doesn't automatically use contiguous numbers starting at '0' like lists do, so you could have the input be whatever you want: hi, bye, blah, abc, one, two, three, dragon, king, princess, etc etc etc):

a String Dictionary's item:

input: "STRING"
output: "STRING"

an Object Dictionary's item:

input: "STRING"
output: OBJECT

an Script Dictionary's item:

input: "STRING"
output: SCRIPT/S

create ("king")

king.parent = room

king.topics_dict = NewStringDictionary ()
dictionary add (king.topics_dict, "princess", "The princess has been kidnapped by a dragon!")
dictionary add (king.topics_dict, "dragon", "The dragon can only be killed by the legendary dragon slaying sword")
dictionary add (king.topics_dict, "sword", "An evil wizard stole the legendary dragon slaying sword")
dictionary add (king.topics_dict, "wizard", "The evil wizard can be found in his tower in the dead lands")

king.talk => {
  show menu ("Topic?", king.topics_dict, false) {
    // hidden from you (done automatically with the 'show menu / ShowMenu / get input / etc' Functions: result = YOUR_TYPED_IN_OR_MENU_SELECTED_INPUT // (princess/dragon/sword/wizard from the popup menu)
    output_string_variable = StringDictionaryItem (king.topics_dict, result)
    msg (output_string_variable)
  }
}

you can only do arithmetic operations (addition, subtraction, multiplication, division, and modulus: division, except that it gets/finds/returns the REMAINDER) with INTEGERS and DOUBLES

addition operation symbol: +
subtraction operation symbol: -
multiplication operation symbol: *
division operation symbol: /
modulus operation symbol: %


with STRINGS, you can do concatenation (literally putting things/strings together)

concatenation operator symbol: +


addition vs concatenation:

5 + 5 = 10
55 + 55 = 110

"5" + "5" = "55"
"55" + "55" = "5555"

5 + "5" = ERROR: both humans and computers have no idea how to combine an amount (INTEGER/DOUBLE) and a text (STRING) together, lol

"5" + 5 = ERROR: both humans and computers have no idea how to combine an amount (INTEGER/DOUBLE) and a text (STRING) together, lol

"mama" + "mia" = "mamamia"

// the 'SPACE/WHITE_SPACE' is a character/number/symbol just like the 'a/1/_' is a character/number/symbol:
"mama" + " " + "mia" = "mama mia" // "mama" + "[SPACE]" + "mia" = "mama[SPACE]mia"
"mama " + "mia" = "mama mia" // "mama[SPACE]" + "mia" = "mama[SPACE]mia"
"mama" + " mia" = "mama mia" // "mama" + "[SPACE]mia" = "mama[SPACE]mia"

"mama" + "5" = "mama5"

"5" + "mama" = "5mama" // NOTE that this only works for VALUES, as Objects' and Attributes' names can NOT start with a number character, they must start with an alpabet character (and maybe there's a few symbols that you can start with too, such as the commonly usable/allowable underscore character)

the useful application of concatenation:

string_variable = "Hi"
msg (string_variable)
// output:
// Hi
string_variable = string_variable + ", my name is HK."
msg (string_variable)
// output:
// Hi, my name is HK.
string_variable = string_variable + " What is your name?"
msg (string_variable)
// output:
// Hi, my name is HK. What is your name?


(sorry posted in the wrong thread)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums