this involves Attributes (Attribute Usage) and the 'if' Script
Attributes and their 'set a variable or attribute' Script, and the 'If' Script, are the two SUPER SCRIPTS, enabling you to do this and 90% of everything else that you want to do in your game
the concept of a personality/relationship/hostility system:
you have a scale (ie: 0-100), and various things happen (or don't happen) based upon that scale's value (ie: 50) and/or range of values (ie: 33-66)*
* In quest's programming, this is how syntax-conceptually you do a(n inclusive) range:
VARIABLE (> or >=) min_range_value and VARIABLE (< or <=) max_range_value
* you can NOT do the more logical-sense-making syntax of:
min_range_value (< or <=) VARIABLE (< or <=) max_range_value
* To do an exclusive range, the syntax-conceptuality is:
VARIABLE (< or <=) min_range_value or VARIABLE (> or >=) max_range_value
* the 'XXX' are values that are NOT a part of your range
* the 'arrows' are the values that ARE a part of your range
* inclusive range definition example: XXX 0 <-----> 100 XXX
* exclusive range definition example: <----- 0 XXXX 100 ----->
each npc needs an Integer (int) Attribute to store/hold their current scale value
you then need scripting that checks (the 'if' Script) this Integer Attribute for what to do or not do
you also need a method that fires/activates the checking of the Integer Attribute when the Integer Attribute has its value altered/changed (the 'Turnscript' Element and/or the special 'changed' Script)
you'll also need scripting that will increase/decrease (addition/multiplication/subtraction/division/modulus) the npcs' Integer Attribute:
(simple) Addition: Object_name.Attribute_name = Object_name.Attribute_name + Number_Value
(simple) Subtraction: Object_name.Attribute_name = Object_name.Attribute_name - Number_Value
(simple) Multiplication: Object_name.Attribute_name = Object_name.Attribute_name * Number_Value
(simple) Division (division that finds the quotient only): Object_name.Attribute_name = Object_name.Attribute_name / Number_Value
(simple) Modulus (division that finds the remainder only): Object_name.Attribute_name = Object_name.Attribute_name % Number_Value
here's a guide on Attributes (Attribute Usage) and the 'If' Script:
viewtopic.php?f=18&t=5559 (about halfway down the link's post, is the part on the two super scripts, bolded and in large font, just got to scroll down a ways, though you should read all of it)
here's a partial initial-setup example:
<object name="npc1">
<inherit name="npc_group_object_type" />
<attr name="alias" type="string">best friend joe</attr>
<attr name="relationship_integer" type="int">100</attr>
<attr name="relationship_string" type="string">positive</attr>
</object>
<object name="npc2">
<inherit name="npc_group_object_type" />
<attr name="alias" type="string">farmer john</attr>
<attr name="relationship_integer" type="int">50</attr>
<attr name="relationship_string" type="string">neutral</attr>
</object>
<object name="npc3">
<inherit name="npc_group_object_type" />
<attr name="alias" type="string">criminal jeff</attr>
<attr name="relationship_integer" type="int">0</attr>
<attr name="relationship_string" type="string">negative</attr>
</object>
<type name="npc_group_object_type">
<attr name="talk" type="script">
if (this.relationship_integer <= 33) {
this.relationship_integer = this.relationship_integer + 1
msg ("You talk to " + this.alias + ", improving your relationship with " + this.article + ".")
} else {
msg ("You talk to " + this.alias + ", but you no longer can improve your relationship with " + this.article + " through talking anymore.")
}
</attr>
<attr name="changedrelationship_integer" type="script">
if (this.relationship_integer > 100) {
this.relationship_integer = 100
if (not this.relationship_string = "positive") {
this.relationship_string = "positive"
}
} else if (this.relationship_integer < 0) {
this.relationship_integer = 0
if (not this.relationship_string = "negative") {
this.relationship_string = "negative"
}
} else if (this.personality_integer > 66 and if (not this.relationship_string = "positive") {
this.relationship_string = "positive"
} else if (this.personality > 33 and if (not this.relationship_string = "neutral") {
this.relationship_string = "neutral"
} else if (not this.relationship_string = "negative") {
this.relationship_string = "negative"
}
</attr>
<attr name="displayverbs" type="simplestringlist">talk</attr>
</type>
<verb>
<property>talk</property>
<pattern>talk</pattern>
<defaultexpression>You can't talk to that.</defaultexpression>
</verb>