This will delete the page "NPC Attraction - They love me, They love me not"
. Please be certain.
Anjuna
Grand Duke of Telecommunications
December 25, 2023
Welcome to the tutorial on the npc preference and attraction system, and how you can interact with it. If you have any other questions, you can always ask for help at the Discord.
I wish you a happy coding experience.
Your truly,
Anjuna
The entire preference system consists of roughly 4 parts:
We will go over each file and address its function, how to use it, and how to add to it.
We use the following terms repeatedly:
In pcs has attr we define each attribute/preference, and it is filled with code which checks whether Sveta has that attribute/preference.
We can then check whether Sveta has an attribute / conforms to a preference using func(‘pcs_has_attr’, $attr_name). In an if-statement this looks like:
if func(‘pcs_has_attr’, $attr_name):
[CODE HERE FOR WHEN SVETA CONFORMS TO THE PREFERENCE]
else
[CODE HERE FOR WHEN SVETA DOES NOT CONFORM TO THE PREFERENCE]
end
The general structure of how we define a preference is as follows:
if $ARGS[0] = [$attr_name]:
if [SVETA CONFORMS TO THE PREFERENCE]:
result = 1
else
result = 0
end
end
Example 1: A preference for red hair
if $ARGS[0] = ‘hair_color_red’:
if pcs_haircol = 2:
result = 1
else
result = 0
end
end
and we can check it as:
if func(‘pcs_has_attr’, ‘hair_color_red’):
‘Sveta, you have red hair’
else
‘Sveta, you do not have red hair’
end
Having coded multiple preferences, we also added the basic ‘AND’ and ‘OR’ functions so you can check for multiple attributes as follows:
if func(‘pcs_has_attr’, ‘AND’, $attr_name1, $attr_name2, $attr_name3, ...)
if func(‘pcs_has_attr’, ‘OR’, $attr_name1, $attr_name2, $attr_name3, ...)
As of the time of writing, it’s currently not possible to nest ‘AND’ inside of ‘AND’ or ‘OR’ inside of ‘OR’. So it is possible to write:
func(‘pcs_has_attr’, ‘AND’, func(‘pcs_has_attr’, ‘OR’, $attr_name1, $attr_name2),
func(‘pcs_has_attr’, ‘OR’, $attr_name3, $attr_name4))
but not:
func(‘pcs_has_attr’, ‘AND’, func(‘pcs_has_attr’, ‘OR’,
func(‘pcs_has_attr’, ‘AND’, $attr_name1, $attr_name2), ...), ...)
You can add to pcs has attr as follows:
The attribute/preference names follow the following convention: [class] [group] [subgroup], where the subgroup is optional.
Here we add, change, or remove preferences from npc’s.
The general structure for altering an npc’s preference is as follows:
gs ‘npc_set_preference’, $npc_code, $attr_name, [DISPOSITION]
Here we used:
Example 1: Dimka (‘A1’) dislikes bimbo clothing:
gs ‘npc_set_preference’, ‘A1’, ‘clothing_bimbo’, ‘dislike’
Example 2: Vladimir (step-dad) (‘A28’) likes you having a tan:
gs ‘npc_set_preference’, ‘A28’, ‘body_tan’, ‘like’
Example 3: Mikhail (bio-dad) (‘A35’) dislikes you having cum on your face:
gs ‘npc_set_preference’, ‘A35’, ‘cum_face’, ‘dislike’
To limit the number of variables needed (which has a hard, build in, limit), as well as maximize our ability to loop through active preferences, checking the preferences that an NPC has is rather complicated. It is done as follows:
create the $npc_pref_traits and npc_trait_values arrays
dynamic $npc_preferences[$npc_code]
dynamic $npc_pref_values[$npc_code]
For a specific preference $PREF_NAME, the npc has a positive disposition if:
if npc_trait_values[$attr_name] > 0:
and a negative disposition if:
if npc_trait_values[$attr_name] < 0:
when done, clean up the created arrays:
killvar ‘$npc_pref_traits’
killvar ‘npc_trait_values’
Example 1: We want to know how Dimka (‘A1’) feels about bimbo clothing:
dynamic $npc_pref_values[‘A1’]
if npc_trait_values[‘clothing_bimbo’] > 0:
‘Dimka is positive about bimbo clothes’
elseif npc_trait_values[‘clothing_bimbo’] < 0:
‘Dimka is negative about bimbo clothes’
else
‘Dimka has no special opinion about bimbo clothes’
end
killvar ‘npc_trait_values’
Example 2: We want to know whether both Vladimir (step-dad) (‘A28’) and Natasha (bio-mom) (‘A29’) dislike Sveta having cum on her face:
This is rather difficult, since creating the array for the second NPC overwrites the first NPC. This thus needs to be done with temporary variables:
dynamic $npc_pref_values[‘A28’]
temp_vlad_cum_pref = npc_trait_values[‘cum_face’]
dynamic $npc_pref_values[‘A29’]
if temp_vlad_cum_pref < 0 and npc_trait_values[‘cum_face’] < 0:
‘Both parents dislike Sveta having cum on her face’
else
‘At least one of her parents likes it if Sveta has cum on her face. Kinky’
end
killvar ‘npc_trait_values’
killvar ‘temp_vlad_cum_pref’
If for some ungodly reason you need to simultaneously loop through the preferences of multiple npc’s, the build in copyarr function is the way to go.
You don’t!
Here we use the preferences defined using npc set preference and calculate the a relative appearance (called attraction) and relative hotcat for Sveta from the eyes of an NPC.
Getting the relative appearance and hotcat is relatively simple:
First we fill the relevant entries in the npc_attraction and npc_rel_hotcat arrays
gs ‘set_npc_attraction’, $npc_code, MAX_HOTCAT_DIFFERENCE
Then the relative appearance (or attraction) is npc_attraction[$npc code]
The relative hotcat is npc_rel_hotcat[$npc code].
Example 1: Sveta is talking to Artem (‘A2’) and if he finds her attractive enough (relative hotcat > 6) he might do something, but we only want the relative hotcat to increase/decrease by at most 3 points:
gs ‘set_npc_attraction’, ‘A2’, 3
if npc_rel_hotcat[‘A2’] > 6:
[CODE HERE]
end
Example 2: Vitek (‘A9’), Dan (‘A10’), and Vasily (‘A11’) might act differently depending on whether the majority finds Sveta attractive enough (relative hotcat > 5), and we allow any increase/decrease to the relative hotcat:
gs ‘set_npc_attraction’, ‘A9’, -1
gs ‘set_npc_attraction’, ‘A10’, -1
gs ‘set_npc_attraction’, ‘A11’, -1
if (npc_rel_hotcat[‘A9’] > 5 and npc_rel_hotcat[‘A10’] > 5) or
(npc_rel_hotcat[‘A9’] > 5 and npc_rel_hotcat[‘A11’] > 5) or
(npc_rel_hotcat[‘A10’] > 5 and npc_rel_hotcat[‘A11’] > 5):
[CODE HERE]
end
You don’t!
TBD
This will delete the page "NPC Attraction - They love me, They love me not"
. Please be certain.