npc_set_preference.qsrc 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. # npc_set_preference
  2. !! npc_code = 'A***', 'B***', 'C***', etc.
  3. !! Full reset of npc preferences:
  4. !! gs 'npc_set_preference', 'reset', npc_code
  5. !!
  6. !! Add a preference to an npc:
  7. !! gs 'npc_set_preference', $npc_code, $trait, [$amount/amount]
  8. !! npc_code = 'A12', 'A51', 'B13', 'C1', etc
  9. !! trait: = 'body_strong', 'cum_face', 'body_tits_big', 'body_ass_bubble', etc.
  10. !!
  11. !! you can either use a string or number for amount:
  12. !! $amount = 'hate', 'dislike', 'neutral', 'like', 'love'
  13. !! amount is the change in appearance that this preference causes.
  14. !!
  15. !! examples:
  16. !! gs 'npc_set_preference', 'A12', 'body_tits_big', 'like'
  17. !! gs 'npc_set_preference', 'B1', 'body_bmi_overweight', -50
  18. if $ARGS[0] = 'reset':
  19. $npc_preferences[$ARGS[1]] = ''
  20. end
  21. !! $ARGS[0] = 'A***', 'B***', 'C***', etc.
  22. if isnum(mid($ARGS[0], 2)):
  23. !!Dynamically create the $npc_pref_traits and npc_trait_values arrays
  24. dynamic $npc_preferences[$ARGS[0]]
  25. dynamic $npc_pref_values[$ARGS[0]]
  26. !! Example of these created arrays.
  27. !!$npc_pref_traits: npc_pref_traits[i] = 'strong'
  28. !!npc_trait_values: npc_trait_values['strong'] = -15
  29. if $ARGS[2] = '':
  30. temp_set_preference_trait_value = ARGS[2]
  31. else
  32. !! Translate 'hate, dislike, etc. into a number and store it.'
  33. temp_set_preference_trait_value = func('npc_set_preference', 'get_value', $ARGS[1], $ARGS[2])
  34. end
  35. !! This block of code is here to find the index of the preferences.
  36. skip_check_preferences_loop = 0
  37. :check_preference_loop_start
  38. !! Escape the preference loops if we found the index of the preferences
  39. if skip_check_preferences_loop = 0:
  40. if arrsize('$npc_pref_traits') > 0:
  41. preference_loop_index = 0
  42. :check_preferences_loop
  43. if $npc_pref_traits[preference_loop_index] = $ARGS[1]:
  44. skip_check_preferences_loop = 1
  45. jump 'check_preference_loop_start'
  46. end
  47. preference_loop_index += 1
  48. if preference_loop_index < arrsize('$npc_pref_traits'): jump 'check_preferences_loop'
  49. end
  50. end
  51. if temp_set_preference_trait_value ! 0:
  52. if arrsize('$npc_pref_traits') = 0:
  53. !!replace(..., ' ', '') is there to remove the tabs from the string.
  54. $npc_preferences[$ARGS[0]] = replace({killvar '$npc_pref_traits'
  55. $npc_pref_traits[] = } + "'<<$ARGS[1]>>'" + {
  56. }, ' ', '')
  57. $npc_pref_values[$ARGS[0]] = replace({killvar 'npc_trait_values'
  58. npc_trait_values} + "['<<$ARGS[1]>>'] = <<temp_set_preference_trait_value>>" + {
  59. }, ' ', '')
  60. else
  61. if preference_loop_index < arrsize('$npc_pref_traits'):
  62. !!The npc already has a preference for the trait.
  63. !!We overwrite the trait and then escape the preference_loop
  64. npc_trait_values[$ARGS[1]] = temp_set_preference_trait_value
  65. !!Rebuild the $npc_pref....[$ARGS[0]] strings from the grounds up
  66. gs 'npc_set_preference', 'rebuild_preferences', $ARGS[0]
  67. else
  68. !!We have checked that the npc has no preference for the trait.
  69. !!We add the preference to the npc.
  70. $npc_preferences[$ARGS[0]] += replace({$npc_pref_traits[] = } + "'<<$ARGS[1]>>'" + {
  71. }, ' ', '')
  72. $npc_pref_values[$ARGS[0]] += replace({npc_trait_values} + "['<<$ARGS[1]>>'] = <<temp_set_preference_trait_value>>" + {
  73. }, ' ', '')
  74. end
  75. end
  76. else
  77. !! The trait exists and we are setting it to 0. Best just remove it entirely
  78. if temp_preference_loop_index < arrsize('$npc_pref_traits'):
  79. killvar '$npc_pref_traits', temp_preference_loop_index
  80. gs 'shortgs', 'remove_array_element', 'npc_trait_values', $ARGS[1]
  81. !!Rebuild the $npc_pref....[$ARGS[0]] strings from the grounds up
  82. gs 'npc_set_preference', 'rebuild_preferences', $ARGS[0]
  83. end
  84. end
  85. killvar '$npc_pref_traits'
  86. killvar 'npc_trait_values'
  87. killvar 'preference_loop_index'
  88. killvar 'temp_set_preference_trait_value'
  89. end
  90. !! Called as gs 'npc_set_preference', 'rebuild_preferences', $npc_code
  91. if $ARGS[0] = 'rebuild_preferences':
  92. !!Rebuild the $npc_pref....[$ARGS[0]] strings from the grounds up
  93. $temp_npc_pref_traits = {killvar '$npc_pref_traits'
  94. }
  95. $temp_npc_trait_values = {killvar 'npc_trait_values'
  96. }
  97. !!Loop over every preference and add it to the $npc_pref....[$ARGS[0]] strings.
  98. rebuild_preferences_index = 0
  99. :rebuild_preferences_loop
  100. $temp_npc_pref_traits += {$npc_pref_traits[] = } + "'<<$npc_pref_traits[rebuild_preferences_index]>>'" + {
  101. }
  102. $temp_npc_trait_values += {npc_trait_values} + "['<<$npc_pref_traits[rebuild_preferences_index]>>'] = <<npc_trait_values[rebuild_preferences_index]>>" + {
  103. }
  104. rebuild_preferences_index += 1
  105. if rebuild_preferences_index < arrsize('$npc_pref_traits'): jump 'rebuild_preferences_loop'
  106. !!Overwrite the $npc_pref....[$ARGS[0]] strings with the rebuild string.
  107. $npc_preferences[$ARGS[0]] = replace($temp_npc_pref_traits, ' ', '')
  108. $npc_pref_values[$ARGS[0]] = replace($temp_npc_trait_values, ' ', '')
  109. killvar '$temp_npc_pref_traits'
  110. killvar '$temp_npc_trait_values'
  111. killvar 'rebuild_preferences_index'
  112. end
  113. !! Called as gs 'npc_set_preference', 'remove_prefence', $npc_code, $pref_trait
  114. if $ARGS[0] = 'remove_preference':
  115. if arrsize('$npc_pref_traits') > 0:
  116. !! Check the position of the preference in the preference array.
  117. temp_set_preferences_trait_position = arrpos('$npc_pref_traits', $ARGS[2])
  118. !! If the preference exists:
  119. if temp_set_preferences_trait_position ! -1:
  120. !! Remove the preference from the array.
  121. killvar '$npc_pref_traits', temp_set_preferences_trait_position
  122. gs 'shortgs', 'remove_array_element', 'npc_trait_values', $ARGS[2]
  123. !! Then rebuild the dynamic string.
  124. gs 'npc_set_preference', 'rebuild_preferences', $ARGS[1]
  125. end
  126. killvar 'temp_set_preferences_trait_position'
  127. end
  128. end
  129. !!====================================!!
  130. !! !!
  131. !! Calculate pref_value !!
  132. !! !!
  133. !!====================================!!
  134. !! gs 'npc_set_preference', 'get_value', $PREFERENCE, $VALUE
  135. !! $PREFERENCE: body_fit, clothes_style_bimbo, etc.
  136. !! $VALUE: 'love', 'like', 'neutral', 'dislike', or 'hate'
  137. if $ARGS[0] = 'get_value':
  138. temp_pref_values['love'] = 10
  139. temp_pref_values['like'] = 3
  140. temp_pref_values['neutral'] = 0
  141. temp_pref_values['dislike'] = -3
  142. temp_pref_values['hate'] = -10
  143. if $ARGS[1] = 'body_bmi_starving':
  144. temp_pref_values['love'] = 60
  145. temp_pref_values['like'] = 40
  146. temp_pref_values['dislike'] = -5
  147. temp_pref_values['hate'] = -10
  148. elseif $ARGS[1] = 'body_bmi_underweight':
  149. temp_pref_values['love'] = 10
  150. temp_pref_values['like'] = 5
  151. temp_pref_values['dislike'] = -25
  152. temp_pref_values['hate'] = -35
  153. elseif $ARGS[1] = 'body_bmi_normal':
  154. temp_pref_values['love'] = 5
  155. temp_pref_values['like'] = 2
  156. temp_pref_values['dislike'] = -50
  157. temp_pref_values['hate'] = -70
  158. elseif $ARGS[1] = 'body_bmi_overweight':
  159. temp_pref_values['love'] = 10
  160. temp_pref_values['like'] = 5
  161. temp_pref_values['dislike'] = -25
  162. temp_pref_values['hate'] = -35
  163. elseif $ARGS[1] = 'body_bmi_obese':
  164. temp_pref_values['love'] = 60
  165. temp_pref_values['like'] = 40
  166. temp_pref_values['dislike'] = -5
  167. temp_pref_values['hate'] = -10
  168. elseif $ARGS[1] = 'body_skin_bad':
  169. temp_pref_values['love'] = 2
  170. temp_pref_values['like'] = 1
  171. temp_pref_values['dislike'] = -1
  172. temp_pref_values['hate'] = -2
  173. elseif $ARGS[1] = 'body_skin_normal':
  174. temp_pref_values['love'] = 2
  175. temp_pref_values['like'] = 1
  176. temp_pref_values['dislike'] = -1
  177. temp_pref_values['hate'] = -2
  178. elseif $ARGS[1] = 'body_skin_good':
  179. temp_pref_values['love'] = 2
  180. temp_pref_values['like'] = 1
  181. temp_pref_values['dislike'] = -1
  182. temp_pref_values['hate'] = -2
  183. end
  184. if $ARGS[2] ! '':
  185. result = temp_pref_values[$ARGS[2]]
  186. else
  187. if ARGS[2] = temp_pref_values['neutral']:
  188. $result = 'neutral'
  189. elseif ARGS[2] < (temp_pref_values['hate'] + temp_pref_values['dislike']) / 2:
  190. $result = 'hate'
  191. elseif ARGS[2] > (temp_pref_values['love'] + temp_pref_values['like']) / 2:
  192. $result = 'love'
  193. elseif ARGS[2] < (temp_pref_values['dislike'] + temp_pref_values['neutral']) / 2:
  194. $result = 'dislike'
  195. elseif ARGS[2] > (temp_pref_values['like'] + temp_pref_values['neutral']) / 2:
  196. $result = 'like'
  197. else
  198. $result = 'neutral'
  199. end
  200. end
  201. killvar 'temp_pref_values'
  202. end
  203. !! Preferences:
  204. !!
  205. !! body:
  206. !! ass:
  207. !! body_ass_flat
  208. !! body_ass_average
  209. !! body_ass_big
  210. !! body_ass_heart
  211. !! body_ass_bubble
  212. !! bmi:
  213. !! body_bmi_starving
  214. !! body_bmi_underweight
  215. !! body_bmi_normal
  216. !! body_bmi_overweight
  217. !! body_bmi_obese
  218. !! eyes:
  219. !! body_eyes_brown
  220. !! body_eyes_grey
  221. !! body_eyes_green
  222. !! body_eyes_blue
  223. !! lips:
  224. !! body_lips_thin
  225. !! body_lips_normal
  226. !! body_lips_plump
  227. !! body_lips_big
  228. !! body_lips_pillowy
  229. !! skin:
  230. !! body_skin_bad
  231. !! body_skin_normal
  232. !! body_skin_good
  233. !! strength:
  234. !! body_strength_weak
  235. !! body_strenght_normal
  236. !! body_strenght_athletic
  237. !! body_strenght_strong
  238. !! body_strenght_manly
  239. !! sweat:
  240. !! body_sweat_none
  241. !! body_sweat_sweaty
  242. !! body_sweat_stinky
  243. !! tits:
  244. !! body_tits_small
  245. !! body_tits_average
  246. !! body_tits_big
  247. !! body_tits_huge
  248. !! body_fit
  249. !! body_pregnant
  250. !! body_tan
  251. !! body_tan_not
  252. !!
  253. !! clothes:
  254. !! exposed:
  255. !! clothes_exposed_ass
  256. !! clothes_exposed_bra
  257. !! clothes_exposed_panties
  258. !! clothes_exposed_pussy
  259. !! clothes_exposed_tits
  260. !! skirt:
  261. !! clothes_skirt_long
  262. !! clothes_skirt_normal
  263. !! clothes_skirt_short
  264. !! style:
  265. !! clothes_style_bimbo
  266. !! clothes_style_goth
  267. !! clothes_style_punk
  268. !! clothes_thin
  269. !!
  270. !! cosmetics:
  271. !! cosmetics_deodorant
  272. !! cosmetics_makeup
  273. !! cosmetics_piercing
  274. !! cosmetics_tattoo
  275. !!
  276. !! cum:
  277. !! cum_clothes
  278. !! cum_face
  279. !!
  280. !! hair:
  281. !! color:
  282. !! hair_color_black
  283. !! hair_color_brown
  284. !! hair_color_red
  285. !! hair_color_blonde
  286. !! hair_color_dyed
  287. !! length:
  288. !! hair_length_veryshort
  289. !! hair_length_short
  290. !! hair_length_chin
  291. !! hair_length_shoulder
  292. !! hair_length_bra
  293. !! hair_length_long
  294. !! pubes:
  295. !! hair_pubes_shaven
  296. !! hair_pubes_grown
  297. !! hair_pubes_styled
  298. !! hair_leg
  299. !! hair_leg_not
  300. !! hair_curly
  301. !! hair_straight
  302. --- npc_set_preference ---------------------------------