Angry NPC

Candacis
24 Apr 2013, 21:23I have started working on my own text adventure, creating rooms, objects, all that stuff that was covered in the tutorial. Now I want to have a npc that remembers if something was already mentioned to him, maybe several different things and so that he has new answers. How would I do this? An If command or maybe set a flag for the different topics? I don't want to work with a conversation menu (seems complicated), just ask/tell conversation.
Second thing I'm trying to accomplish is an angry mood the npc can get, if the player asks the wrong questions or does something wrong. I think I need some sort of counter or value, and different topics or actions can add to that counter until it is high enough to set the angry mood. In the "add a script" I saw the commands "increase object counter", "add a value to a list" (they don't seem to appear in the wiki). Can some of these commands do what I want? Maybe in a need little function script? But perhaps it is too difficult for me right now, so I'm not so sure about it.
Second thing I'm trying to accomplish is an angry mood the npc can get, if the player asks the wrong questions or does something wrong. I think I need some sort of counter or value, and different topics or actions can add to that counter until it is high enough to set the angry mood. In the "add a script" I saw the commands "increase object counter", "add a value to a list" (they don't seem to appear in the wiki). Can some of these commands do what I want? Maybe in a need little function script? But perhaps it is too difficult for me right now, so I'm not so sure about it.
HegemonKhan
25 Apr 2013, 00:28simplier, but more cumbersome (less efficient and~or less organized method ~ more work you got to do possibly depending on how much stuff you got in game):
(more advanced method: lists and~or dictionaries, which I won't cover here, too hard to explain, lol)
1A. NPC -> Attributes -> Add ->
Name: topic_name_npc_name (example: legendary_sword_wise_owl)
Type: (Boolean or Integer or String ~ whichever you want to use)
Value: (depends on Type: boolean == wise_owl.legendary_sword = false, Integer = 0, String = legendary_sword_wise_owl_topic)
NPC -> Ask~Tell (Tab) -> Add a script ->
If (example: wise_owl.legendary_sword = true) {
-> msg (where is it?)
}
else {
-> msg (why do I need it?)
}
2. Unfortunately, If I remember correctly, the Ask/Tell scripts only uses a "yes/no" structure, so this probably won't be an option for you.
just add~create a "talk" verb of your own (this will override the default~core quest engine talk verb script, which is completely fine to do so, it won't cause any problems, aside from using your own talk verb scripts and not the default talk verb script. It doesn't actually override the default talk verb, the game will just use yours instead of the default, so if you want the default to be used, just delete your own talk verbs)
3. NPC -> Attributes -> Add ->
Name: hostility
Type: Integer
Value: 0 (or whatever you want as the starting~intial value for your npcs)
NPC -> Attributes -> Add ->
Name: hostile
Type: boolean
Value: false
then just set it where you want it, for example:
ask npc about marrying his daughter -> set variable or attribute -> npc.hostility = npc.hostility + 100
turnscript:
If (npc.hostility > 50) {
-> npc.hostile = true
}
where ever (what script where) you want this:
if (npc.hostile = true) {
-> then (whatever you want, whatever script you want)
}
4. if you're able to use ~ work with ~ the code, then this is very useful:
http://quest5.net/wiki/Category:All_Fun ... t_Commands
enjoy
--------------------------------
"Object Counters"
Adder:
object_name.object_integer_attribute = object_name.object_integer_attribute + (your value amount)
Subtractor:
object_name.object_integer_attribute = object_name.object_integer_attribute - (your value amount)
Multiplier:
object_name.object_integer_attribute = object_name.object_integer_attribute * (your value amount)
Dividor:
object_name.object_integer_attribute = object_name.object_integer_attribute / (your value amount)
---------------------------------------
An Example:
Starting npc's, named "HK", "strength" 's value:
"object counter" -> HK.strength = 0
A created "Drink" verb on a created object named, "str_pot_100", and it's script line:
"adder" -> HK.strength = HK.strength + 100
--------------------------------------------
"increase object counter"
is actually an equation~formula using "Set a variable or attribute", so there's no actual~direct script command for it.
as shown above:
initial~old HK's strength attribute's value: HK.strength = 0
Equation~Formula ("Adder") script: HK.strength = HK.strength + 100
HK.strength (new value) = HK.strength (old value) + 100
HK. strength (new value) = (replace this old value HK.strength with what it is, which is: 0) + 100
HK.strength (new value) = 0 + 100
HK.strength (new value) = 100
new HK's strength attribute's value: HK.strength = 100
------------------------
"add a value to a list"
http://quest5.net/wiki/List_add
http://quest5.net/wiki/ListCombine
lists and especially dictionaries are a bit more difficult to work with and understand for noobs, you may not be ready for this yet.
http://quest5.net/wiki/Using_Lists
http://quest5.net/wiki/List_add
http://quest5.net/wiki/ListCombine
etc etc etc
http://quest5.net/wiki/Using_Dictionaries
http://quest5.net/wiki/Dictionary_add
etc etc etc
----------------------
P.S.
I'm referencing the code, so I think the GUI~Editor lines you mentioned, indeed are correct, for doing the things you want. I think those GUI~Editor things are the right things that will do what you want. you guessed them correctly (I think ~ I'm too lazy to open up quest in the GUI~Editor to make sure, lol).
I don't think the wiki has GUI~Editor lines, or much of any GUI~Editor stuff, but I could be wrong.
(more advanced method: lists and~or dictionaries, which I won't cover here, too hard to explain, lol)
1A. NPC -> Attributes -> Add ->
Name: topic_name_npc_name (example: legendary_sword_wise_owl)
Type: (Boolean or Integer or String ~ whichever you want to use)
Value: (depends on Type: boolean == wise_owl.legendary_sword = false, Integer = 0, String = legendary_sword_wise_owl_topic)
NPC -> Ask~Tell (Tab) -> Add a script ->
If (example: wise_owl.legendary_sword = true) {
-> msg (where is it?)
}
else {
-> msg (why do I need it?)
}
2. Unfortunately, If I remember correctly, the Ask/Tell scripts only uses a "yes/no" structure, so this probably won't be an option for you.
just add~create a "talk" verb of your own (this will override the default~core quest engine talk verb script, which is completely fine to do so, it won't cause any problems, aside from using your own talk verb scripts and not the default talk verb script. It doesn't actually override the default talk verb, the game will just use yours instead of the default, so if you want the default to be used, just delete your own talk verbs)
3. NPC -> Attributes -> Add ->
Name: hostility
Type: Integer
Value: 0 (or whatever you want as the starting~intial value for your npcs)
NPC -> Attributes -> Add ->
Name: hostile
Type: boolean
Value: false
then just set it where you want it, for example:
ask npc about marrying his daughter -> set variable or attribute -> npc.hostility = npc.hostility + 100
turnscript:
If (npc.hostility > 50) {
-> npc.hostile = true
}
where ever (what script where) you want this:
if (npc.hostile = true) {
-> then (whatever you want, whatever script you want)
}
4. if you're able to use ~ work with ~ the code, then this is very useful:
http://quest5.net/wiki/Category:All_Fun ... t_Commands
enjoy

--------------------------------
"Object Counters"
Adder:
object_name.object_integer_attribute = object_name.object_integer_attribute + (your value amount)
Subtractor:
object_name.object_integer_attribute = object_name.object_integer_attribute - (your value amount)
Multiplier:
object_name.object_integer_attribute = object_name.object_integer_attribute * (your value amount)
Dividor:
object_name.object_integer_attribute = object_name.object_integer_attribute / (your value amount)
---------------------------------------
An Example:
Starting npc's, named "HK", "strength" 's value:
"object counter" -> HK.strength = 0
A created "Drink" verb on a created object named, "str_pot_100", and it's script line:
"adder" -> HK.strength = HK.strength + 100
--------------------------------------------
"increase object counter"
is actually an equation~formula using "Set a variable or attribute", so there's no actual~direct script command for it.
as shown above:
initial~old HK's strength attribute's value: HK.strength = 0
Equation~Formula ("Adder") script: HK.strength = HK.strength + 100
HK.strength (new value) = HK.strength (old value) + 100
HK. strength (new value) = (replace this old value HK.strength with what it is, which is: 0) + 100
HK.strength (new value) = 0 + 100
HK.strength (new value) = 100
new HK's strength attribute's value: HK.strength = 100
------------------------
"add a value to a list"
http://quest5.net/wiki/List_add
http://quest5.net/wiki/ListCombine
lists and especially dictionaries are a bit more difficult to work with and understand for noobs, you may not be ready for this yet.
http://quest5.net/wiki/Using_Lists
http://quest5.net/wiki/List_add
http://quest5.net/wiki/ListCombine
etc etc etc
http://quest5.net/wiki/Using_Dictionaries
http://quest5.net/wiki/Dictionary_add
etc etc etc
----------------------
P.S.
I'm referencing the code, so I think the GUI~Editor lines you mentioned, indeed are correct, for doing the things you want. I think those GUI~Editor things are the right things that will do what you want. you guessed them correctly (I think ~ I'm too lazy to open up quest in the GUI~Editor to make sure, lol).
I don't think the wiki has GUI~Editor lines, or much of any GUI~Editor stuff, but I could be wrong.