Choosing Species / Race

clockworkdragon
Hello!

You have all probably heard this before, I'm a newbie to Quest and I need help.

I am looking for the best method to making it possible to choose your players species / race for a game I am creating. My idea was to have a command that would work only in one room in the game, you would type ' play <race> ' and it would set the appropriate flags on your character.

I was going to use a if switch to accomplish this. I'm not sure of the technical term for it but it's the switch board looking code that handles several different expressions. Unfortunately I can only seem to get it to work with numbers. When I use the code (shown below) I am hit by 'unknown variable errors' or 'can not find object errors'.

switch (text) {
case (Race) {
msg ("Test Message")
}
}

I am fairly certain I am doing something wrong here or that there is a simpler and easier way to do this. I am though open to suggestions from those who don't mind sharing, on what is the best way to creating a viable 'change species' option or even menu.

I am also going to probably need some help with expressions in general at some point as well. >.> I will though save the discussion for implementing team mate's with combat later on after I actually get to that point and after I get a chance to research it myself :)

jaynabonne
In your "case" statement, you need to put what you're comparing against in quotes. Otherwise, it looks for a variable with that name. For example:

switch (text) {
case ("human") {
msg ("You are a human.")
}
}

HegemonKhan
here's some links for you:

http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/guides/
http://docs.textadventures.co.uk/quest/ ... ation.html
http://docs.textadventures.co.uk/quest/ ... _menu.html
http://docs.textadventures.co.uk/quest/ ... witch.html
http://docs.textadventures.co.uk/quest/ ... cript.html
http://docs.textadventures.co.uk/quest/ ... _case.html

------

if you want, the easiest way of doing 'character creation' is immediately at game start, which is done by:

'game' (the special Game Object) -> scripts or setup (tab) -> 'start' Script -> (add your scripts)

the 'start' Script is activated at the start of your game.

in code:

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="xxx">
<gameid>xxx</gameid>
<start type="script">
// your scripts
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
</inherit name="editor_player" />
</object>
</object>
</asl>


-------

the 'switch' Script is the same as multiple 'if' Scripts, though a bit more limited and its design is a bit different, though it can be clearer to understand.

for you to use the 'switch' Script, you need to first have a VARIABLE (a Variable or an Attribute) to work with, and which since you want to choose from choices (of 'species' and 'race' for character creation), you'll want a Stringlist VARIABLE:

run as script -> add a~new script -> variables -> 'set a variable or attribute' Script -> (see below)

VARIABLE:
-> Variable (local: can ONLY be used by the scripting* which it is within)
-> Attribute (global: save'able and thus load'able: can be used within any scripting within the entire game, so long as the Object that it is attached to, exists, obviously)

*Scripting ELEMENTS**: Verbs, Commands, Functions, Turnscripts, Timers, Script Attributes, and etc

**ELEMENTS (these are your main 'physical things' within quest): http://docs.textadventures.co.uk/quest/elements/

Variables (in code) general~base syntax:

variable_string_name = Value_or_Expression

Attributes (in code) general~base syntax:

Object_name.Attribute_name = Value_or_Expression

String Attribute examples:

(the Values must be within quotes, and for Dynamic Expressions, the textual parts must be within quotes)

player.alias = "HK"
game.author = "HK"
player.condition = "normal"
player.condition = "poisoned"
HK.favorite_color = "black"
HK.favorite_color_list = split ("black; red", ";")
orc.skin_color = "green"
game.number_event_flag = "0"
game.number_event_flag = "1"
game.y = "x"
player.greeting_static = "Hi, my name is HK, what is your name?"
player.greeting_dynamic = "Hi, my name is " + player.alias + ", what is your name?"
player.strength = "strong"

Integer Attribute examples:

player.strength = 100
player.physical_damage = player.katana.physical_damage + player.katana.physical_damage * player.strength / 100
game.number_event_flag = 0
game.number_event_flag = 1

Double (Floats ~ Floating Points ~ Decimals) Attribute examples:

player.damage = 468.1940945

Boolean (or for quest specific terminology: Flags, though flags, as a concept, are also a general term too, being not specifically Boolean Attributes, so this causes some confusion) Attribute examples:

orc.dead = true
orc.dead = false
player.flying = false
player.flying = true
player.poisoned = false
player.poisoned = true
HK.is_awesome = true
tv.switchedon = true
tv.switchedon = false
door.locked = true
door.locked = false

-------

anyways... I'm getting tired... went into too much info... laughs...

so, let me finish this up, back to specifically answering your question:

(ask if you need help, or if you want to do what you want in a different way~method~design)

we're going to using the 'show menu' Script to generate a built-in Variable: result = your_selected_choice, which we then will use for the 'switch' Script:

(a quick example)

<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="xxx">
<gameid>xxx</gameid>
<start type="script">
show menu ("What is your species?", split ("human;elf", ";"), false) {
// the quest game engine automatically (hidden from you) sets: result = your_selected_choice
player.species = result
switch (player.species) {
case ("human") {
player.strength = 2
player.intelligence = 1
show menu ("What is your race?", split ("european;asian;arabian;african;american", ";"), false) {
// the quest game engine automatically (hidden from you) sets: result = your_selected_choice
player.race = result
switch (player.race) {
case ("european") {
player.strength = player.strength + 1
}
case ("asian") {
player.strength = player.strength + 2
}
case ("arabian") {
player.strength = player.strength + 3
}
case ("african") {
player.strength = player.strength + 4
}
case ("american") {
player.strength = player.strength + 5
}
}
}
}
case ("elf") {
player.strength = 1
player.intelligence = 2
show menu ("What is your race?", split ("high;light;dark;night;wood", ";"), false) {
// the quest game engine automatically (hidden from you) sets: result = your_selected_choice
player.race = result
switch (player.race) {
case ("high") {
player.intelligence = player.intelligence + 1
}
case ("light") {
player.intelligence = player.intelligence + 2
}
case ("dark") {
player.intelligence = player.intelligence + 3
}
case ("night") {
player.intelligence = player.intelligence + 4
}
case ("wood") {
player.intelligence = player.intelligence + 5
}
}
}
}
}
}
on ready {
wait {
msg ("You are a " + player.race + " " + player.species + ".")
msg ("Strength: " + player.strength)
msg ("Intelligence: " + player.intelligence)
}
}
</start>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
</inherit name="editor_player" />
</object>
</object>
</asl>

HegemonKhan
Dynamic Expressions of String Attributes:

the secret trick is to break them into 'chunks', and the two types of chunks are:

1. " text "
2. + Object_name.Attribute_name +

for example:

player.alias = "HK"
player.gender_string = "male"
player.species = "human"
player.race = "european"
player.class = "warrior"
msg (player.alias + " is a " + player.gender_string + " " + player.species + " " + player.race + " " + player.class + ".")
outputs: HK is a male human european warrior.

player.alias = "ilyena"
player.gender_string = "female"
player.species = "elf"
player.race = "light"
player.class = "sorceress"
msg (player.alias + " is a " + player.gender_string + " " + player.species + " " + player.race + " " + player.class + ".")
outputs: ilyena is a female elf light sorceress.

the chunks:

player.alias +
" (space) is (space) a (space) "
+ player.gender_string +
" (space) "
+ player.species +
" (space) "
+ player.race +
" (space) "
+ player.class +
" (dot~period) "

or if you'd rather, there's this way of looking at it too:

player.alias
+
" (space) is (space) a (space) "
+
player.gender_string
+
" (space) "
+
player.species
+
" (space) "
+
player.race
+
" (space) "
+
player.class
+
" (dot~period) "

jaynabonne

Dynamic Expressions of String Attributes:


You can avoid *all* that complexity by just using the text processor.

msg ("{player.alias} is a {player.gender_string} {player.species} {player.race} {player.class}.")

There's just no reason to go the other way (and it's not hard to figure out - just put all your attributes in line. Nothing even to learn).

HegemonKhan
chuckles, looking at this now with what I've learned with coding, there's really not any difference at all between the text processor and using Dynamic Expressions:

msg (player.alias + " is a " + player.gender_string + " " + player.species + " " + player.race + " " + player.class + ".")

VS

msg ("{player.alias} is a {player.gender_string} {player.species} {player.race} {player.class}.")

{ } vs " +

hehe :D

When I first started out, I'd never have recognized the minor difference of symbol usage (or of syntax) between the two methods.

-----

I really need to get learning to use the text processor code though, and these in-line commands like 'showmenu', and etc that I don't know about, hehe.

jaynabonne
Try it through the GUI, and you'll see a big difference. Or try adding images or command links or object links or... The latter is also much less prone to errors.

The more critical thing about the text processor is that you can use it in room descriptions, etc, without having to write any script at all. And *that* is a huge difference for those who don't know how to script.

And as far as learning the text processor... well, in the example we've been discussing, you already now know at least this part of it. :)

clockworkdragon
Wow! The fast responses from so many people truely is mind boggling o.o

And excellent. I'll admit that a lot of it went over my head but i think I can work it out.

Basically for this game species is mostly cosmetic, effecting mostly your description and sometimes how npcs react to you.

There will also be a fittness / fattness system along with a scaring system to make the players character stand out more, and possibly more things once I get a handle on the coding here.

Both those are for other help topics and I'm sure someone somewhere has asked about them in the forums already :3

Thank you all for your help. Im going to try this out. If i come across a problem I cant solve I'll let you all know!

clockworkdragon
This was very helpful.

I decided for what I need to make a simple list for the players to choose from. I am going to try and emulate the Elder Scroll's style of character generation, that is you give the players a setting first, even interact with them on a small level, then give them the option to choose what they want to play.

Because who wants to do things simply in their first try XD

I am though interested in any suggestions to making in balancing character generation functionality with player immersion into the story, but that is more of a game play question rather than coding. :)

Silver
Well as well as the mechanics, you could set a flag for each character so every NPC would react dependent on which race/class they were talking to. And that's about all I can suggest really.

HegemonKhan
haha, we need to team up, I too am trying to learn how to code better, to be able to code in RPG aspects, specifically many of TES (The Elder Scroll) games, too, hehe :D

for you, first understand (be able to make a functional game doing...) 'character creation' ( http://docs.textadventures.co.uk/quest/ ... ation.html ), as this new stuff (a 'disposition' system, to use TES' terminolgy, well Morrowind's anyways ~ I only played it ~ not oblivion nor skyrim sighs ~ too busy old broke, hehe) you're asking for involves much more complex coding, advanced usage of lists~dictionaries and even advanced parsing~delegate usage (which is far beyond my noob code ability)

I am literally stuck on just trying to create a TES-like character creation system:

name, titles+ranks, gender, species+race+etc heirarchy of 'life taxonomy', skin type (skin, fur, feathers, or scales), skin~fur~feathers~scales color, eye color, height, weight, nose size+shape, ear size+shape (normal:rounded vs elven~goblin:pointed), wings~tails~etc (for 'beast' species~races), hair type (none, straight, wavy, curly), hair length+width~thickness, hair style (spiked, bald, ponytail, pigtailed, bunned, braided, afro, dreadlocks, mohawk, etc), tatoos ~~ body~face paint, specialization (combat, magic, stealth, diplomacy, science), equipment system, magic system (elementals: fire, water, air, earth, light, dark, holy, unholy, sun, moon, nature, etc), stealth (steal, sneak, etc) system, combat system, diplomacy (disposition~hostility~factions~etc, intimidate, taunt, bribe, compliment, insult, flirt, etc), classes (ranger, knight, paladin, etc), skills~perks~abilities, and etc etc etc... laughs.

-------------

I haven't touched this thread for a long time, but you might be interested in it, and if you got anything to add, please do so, hehe:

viewtopic.php?f=20&t=3876

I just want a collection of ideas for people to have at their disposal, for reference to use for ideas for their own games.

clockworkdragon
Lol nice! I shall read through them when I have more time.

While I would like to add the complexity of a game, really any game in the elder scrolls, I've found that simple works just as well as long as you add the right details :3

What I do like about those games was that it always incorporated character creation into the game.

If you are going to create a hack /slash dungeon crawler then all you really need is a menu at the beginning with important information relating to your stats (Which I might do anyway for simplicity >.>) if though you want to create a game that focus's more on story telling than dungeon crawling then you try to immerse the player in the game from the get go.

OR at least that is my reasoning behind this particular set up XD

Basically I am having the player run through several rooms first, meeting various different characters on board a ship of different species / races etc etc. And then choose their class, species, etc after they get a glimpse at what they each do and how they effect you ^^

I am also going to try and use a more...I suppose the term is animated...form of story telling. Keeping descriptions short and focusing in on the important details. Basically I am trying to give the game a whimsical light hearted 'cartoon' feel (like Jack and Daxter or Ratchet and Clank )

I hope that makes sense :) If anyone wants to share how they accomplished their own way of adding a certain 'feel' to their games, by all means feel free to share it if you desire to :D whether by code or simple text.

Silver
Character creation comes from Dungeons and Dragons afaik which precedes Elder Scrolls by some years.

HegemonKhan
when you do the character creation and how you go about it within your game progression (aka after a bit of 'prologue~intro' playing), isn't that difficult (beyond deciding upon those things, hehe), but the actual hard part is the character creation itself (if you do a complex+game dynamic one, anyways), if you're not already a good coder... as I am finding out...

Silver
I imagine balancing them all would be tricky too. Otherwise you might end up with a simple-to-play game with one character and an impossible-to-complete-one with another.

HegemonKhan
ya... if just coming up with Game Mechanic equations isn't hard enough... you then got to balance them out for actual game play... laughs... we truly don't appreciate how incredible game makers are, even if they have a team of 100, it's still an amazing feat that we take so much for granted, as players.

you don't want to find yourself stuck with a single (or just a few) 'god builds' and all that other work into those other builds go to waste, as they're inferior builds. Diablo 2 classic is a great example of this... UN-balancing...

heck... forget entire builds... just coming up with proper your or your weapons damage vs monster life~defense, is hard enough to find equations that will balance well, especially as you progress through the game... (not having the game be uber easy, nor impossible, nor easy them impossible, nor impossible then easy... argh, lol)

keeping a gradual progressive difficulty throughout the game is really a MASSIVE challenge... I'd almost guard Game Mechanics more prizedly secret than my otherwise entire game's code (aka source code).

Silver
I couldn't get into diablo 2 at all. Dunno why really. That was £50 down the drain lol.

clockworkdragon
Like stocking your party in Final Fantasy 1 with only fighters? And then facing a creature that is immune to physical attacks? Yep. That is certainly a danger of classes. :)

clockworkdragon
I'm finding it simplest to put the player into a character creation room. There are several different commands tied to that room only that connect with a 'switch' script, such as a switch for species, gender, and a third switch for details you can add. Like ' detail eyecolor red' etc etc.

I have also found if I add a simple if /then script to the mix I can control what details a player can add. That way they don't play a human with a lion's tail for example.

I'll try to experiment with the room in ways to give it some flair and not make it so dry.

Thank you all for your help! I really appreciate it!

Silver
A human with a lion's tail sounds cool though...

clockworkdragon
Lol, it does XD Well if this works out there will be three races, a human like people (think Jak and Daxter style human) A beastly race that can be feline, reptilian or canid, and a robotic race.

At the moment i'm just having trouble hammering out some of the code. I'll post it later when I have time. :)

HegemonKhan
if you need any help, ask ~ let us know, I've done some deep ~ complex character creation stuff (not advanced level of coding itself, but for me, design ~ structurally, it has been complex code work, lol). I can help you with lists~dictionaries, if you're trying to use them, though they're a step up, not sure if you advanced~improved to this level of coding yet, but if you want to use them I can help. If you need advanced coding help with parsing~delegate~etc usage, you'll need to get help from others, who're good at coding.

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

Support

Forums