Giving a character a name after the player speaks to them.

animeaddict411
Simple question, I'm sure the solution is also simple. I'm starting out and I don't know much about the coding aspect, (and I'm hoping to avoid it as much as possible) but I have a situation I can't figure out how to work:
my game involves the player meeting new characters fairly regularly, and how I'd like it set up is that when the player enters a room, the description will say "You can see a woman". Once the player speaks to her though, they will learn her name, and from then on I want the game to say "You can see Marie." Im not sure how to work this.
In addition, I am unsure how to move "Marie" to another room once the player completes a certain task.

Pertex
Something like this:
img.jpg

HegemonKhan
useful links:

http://docs.textadventures.co.uk/quest/

http://docs.textadventures.co.uk/quest/ ... notes.html

http://docs.textadventures.co.uk/quest/ ... quest.html
http://docs.textadventures.co.uk/quest/ ... ments.html

Elements (the 'physical things' of quest):
http://docs.textadventures.co.uk/quest/elements/
http://docs.textadventures.co.uk/quest/ ... /game.html
http://docs.textadventures.co.uk/quest/ ... bject.html
http://docs.textadventures.co.uk/quest/ ... /exit.html
http://docs.textadventures.co.uk/quest/ ... ction.html
http://docs.textadventures.co.uk/quest/ ... cript.html
http://docs.textadventures.co.uk/quest/ ... timer.html
http://docs.textadventures.co.uk/quest/ ... /type.html
http://docs.textadventures.co.uk/quest/ ... mmand.html
http://docs.textadventures.co.uk/quest/ ... /verb.html

Attributes:
http://docs.textadventures.co.uk/quest/types/ (Attributes)
http://docs.textadventures.co.uk/quest/ ... tring.html
http://docs.textadventures.co.uk/quest/ ... olean.html
http://docs.textadventures.co.uk/quest/types/int.html
http://docs.textadventures.co.uk/quest/ ... ouble.html
http://docs.textadventures.co.uk/quest/ ... cript.html
http://docs.textadventures.co.uk/quest/ ... lists.html
http://docs.textadventures.co.uk/quest/ ... aries.html

Scriptings (actions~events):
http://docs.textadventures.co.uk/quest/functions/ (categorical order)
http://docs.textadventures.co.uk/quest/ ... tions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/scripts/
http://docs.textadventures.co.uk/quest/types/ (Attributes)
http://docs.textadventures.co.uk/quest/scripts/set.html (Attributes)
http://docs.textadventures.co.uk/quest/scripts/if.html

http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/guides/
viewforum.php?f=18 (more guides: Libraries and Code Samples)

http://docs.textadventures.co.uk/quest/ ... ation.html

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

if you haven't yet, you really should go through the tutorial (even if it is boring and~or simple), as it does a good job of introducing the basics of using quest and game making:

http://docs.textadventures.co.uk/quest/tutorial/

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

in the GUI~Editor, these are the main important things: Elements (especially Objects), Attributes, and Scriptings

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

Attributes:

initial creation using the GUI~Editor:

'whatever' Object -> 'Attributes' Tab -> Attributes -> Add -> (set it up, see below)

(Object Name: whatever)
Attribute Name: whatever
Attribute Type: (String, Boolean, Int ~ Integer ~ Non-decimal number, Double ~ Float ~ Floating Point ~ Decimal number, Script, List, Dictionary, etc)
Attribute Type: whatever (but is based upon your Attribute Type, of course)

if you want to set (create~add), re-set, and~or alter~change Attributes (an action~event in~for the game), you do so via scripting, for example:

'room' Object -> 'Object' Tab -> Add -> 'life_50_potion' Object

'player' Player Object -> 'Attribute' Tab -> Attributes -> Add -> (see below)

(Object Name: player)
Attribute Name: life
Attribute Type: int (integer)
Attribute Value: 500

'player' Player Object -> 'Attribute' Tab -> Status Attributes -> Add -> (see below)

Attribute Name: life
Field Type~Name~whatever it is called, lol (Attribute Value): Life: !

'life_50_potion' Object -> 'Verbs' Tab -> 'drink' -> (see below)

The first of 2 SUPER SCRIPTS:

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> (set it up, see below)*

* I don't know the GUI~Editor's drop down menu choices [whatever], but if you can figure out what to use to do the same thing as I am going to show you in my alternative way, then do so, however, I am going show you using this drop down menu choice: [EXPRESSION], as it let's me write~code in what I want directly (coding isn't too scary, hehe):

run as script -> add a~new script -> variables -> 'set a variable or attribute' -> [EXPRESSION] -> (set it up, see below)

Object_name.Attribute_name = Value_or_Expression

this is how you write~code in an Attribute, in code.

so, for our 'life_50_potion', we'd do this:

player.life = player.life + 50

so, when you 'drink' Verb from the 'life_50_potion' Object, you (the 'player' Player Object), get 50 more life:

conceptually only:
player.life (new) = player.life (old:500) + 50
player.life (new) = 500 + 50
player.life = 550

if you were to 'drink' it again...

conceptually only:
player.life (new) = player.life (old:550) + 50
player.life (new) = 550 + 50
player.life = 600

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

Scriptings:

the other SUPER SCRIPT is:

the 'if' Script

run as script -> add a~new script -> scripts -> 'if' Script -> [EXPRESSION] ~ again you can figure out what drop down menus [whatever] to use instead -> (see below, in pseudo code+GUI~Editor, hehe)

OPERATORS:
Addition: +
Subtraction: -
Multiplication: *
Division: /
Equals: =
Not Equals A: <>
Not Equals B: not xxx = xxx
Greater Than: >
Lesser Than: <
Greater Than and Equal To: >=
Lesser Than and Equal To: <=

* for the 'greater than and equal to' and 'lesser than and equal to', the equal sign MUST be on the RIGHT side, and the greater~lesser than sign on the left side

if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
-> then, add a script -> Object_name.Attribute_name = Value_or_Expression
} else if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
-> then, add a script -> Object_name.Attribute_name = Value_or_Expression
} else if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
-> then, add a script -> Object_name.Attribute_name = Value_or_Expression
} else if (Object_name.Attribute_name OPERATOR Value_or_Expression) {
-> then, add a script -> Object_name.Attribute_name = Value_or_Expression
// etc 'else ifs' as you need them (or less, as you need them, lol)
} else {
-> add a script -> Object_name.Attribute_name = Value_or_Expression
}

you don't have to have 'else ifs' nor 'elses', just showing it to you.

for example (in code, hehe):

if (player.life < 0) {
player.life = 0
}


if (player.current_life < 0) {
player.current_life = 0
} else if (player.current_life > player.maximum_life) {
player.current_life = player.maximum_life
}
if (player.current_life = 0) {
msg ("You died.")
msg ("GAME OVER")
finish
} else if (player.current_life = player.maximum_life) {
msg ("You have full life!")
} else {
msg ("You currently have " + player.current_life + " life remaining out of your total life of " + player.maximum_life + " life.")
}


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

so, as you might see, the 2 SUPER SCRIPTS are:

1. the 'set a variable or attribute' Script
2. the 'if' Script

and especially when used together, can do 90% of everything that you want to do in your game!

-------

as for moving an Object:

in the GUI~Editor:

run as script -> add a~new script -> objects -> you figure out what drop down menus, otherwise... in code... -> Move Object (moving_Object_name, destination_Object_name)

example:

MoveObject (player, room2)

or, within scripting (same as if you do the 'set a variable or attribute' Script + [EXPRESSION] in the GUI~Editor), you can do this:

moving_Object_name.parent = destination_Object_name

example:

player.parent = room2

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

Support

Forums