npc_set_preference.qsrc 9.7 KB

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