npc_add_preference.qsrc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. # npc_add_preference
  2. !! npc_code = 'A***', 'B***', 'C***', etc.
  3. !! Full reset of npc preferences:
  4. !! gs 'npc_add_preference', 'reset', npc_code
  5. !!
  6. !! Add a preference to an npc:
  7. !! gs 'npc_add_preference', npc_code, trait, amount
  8. !! trait: = 'strong', 'cum_on_face', 'tits_big', 'ass_bubble', etc.
  9. !!
  10. !! amount = 'hate', 'dislike', 'neutral', 'like', 'love'
  11. if $ARGS[0] = 'reset':
  12. $npc_preferences[$ARGS[1]] = ''
  13. end
  14. !! $ARGS[0] = 'A***', 'B***', 'C***', etc.
  15. if isnum(mid($ARGS[0], 2)):
  16. !!Dynamically create the $npc_pref_traits and npc_trait_values arrays
  17. dynamic $npc_preferences[$ARGS[0]]
  18. dynamic $npc_pref_values[$ARGS[0]]
  19. !! Example of these created arrays.
  20. !!$npc_pref_traits: npc_pref_traits[i] = 'strong'
  21. !!npc_trait_values: npc_trait_values['strong'] = -15
  22. !! Translate 'hate, dislike, etc. into a number and store it.'
  23. temp_trait_value = func('npc_add_preference', 'get_value', $ARGS[1], $ARGS[2])
  24. temp_skip_loop = 0
  25. :skip_start
  26. !! Escape the preference loops when overwriting a preference.
  27. if temp_skip_loop = 0:
  28. !!if the npc has no preferences, create the $npc_preferences and $npc_pref_values entries from scratch.
  29. if arrsize('$npc_pref_traits') = 0:
  30. !!replace(..., ' ', '') is there to remove the tabs from the string.
  31. $npc_preferences[$ARGS[0]] = replace({killvar '$npc_pref_traits'
  32. $npc_pref_traits[] = } + "'<<$ARGS[1]>>'" + {
  33. }, ' ', '')
  34. $npc_pref_values[$ARGS[0]] = replace({killvar 'npc_trait_values'
  35. npc_trait_values} + "['<<$ARGS[1]>>'] = <<temp_trait_value>>" + {
  36. }, ' ', '')
  37. else
  38. !!loop over every preference to check if the npc already has a preference for that trait.
  39. i = 0
  40. :preference_loop
  41. !!The npc already has a preference for the trait.
  42. !!We overwrite the trait and then escape the preference_loop
  43. if $npc_pref_traits = $ARGS[1]:
  44. npc_trait_values[$ARGS[1]] = temp_trait_value
  45. !!Rebuild the $npc_pref....[$ARGS[0]] strings from the grounds up
  46. $temp_npc_pref_traits = {killvar '$npc_pref_traits'
  47. }
  48. $temp_npc_trait_values = {killvar 'npc_trait_values'
  49. }
  50. !!Loop over every preference and add it to the $npc_pref....[$ARGS[0]] strings.
  51. i = 0
  52. :pref_loop_2
  53. $temp_npc_pref_traits += {$npc_pref_traits[] = } + "'<<$npc_pref_traits[i]>>'" + {
  54. }
  55. $temp_npc_trait_values += {npc_trait_values} + "['<<$npc_pref_traits[i]>>'] = <<npc_trait_values[i]>>" + {
  56. }
  57. i += 1
  58. if i < arrsize('$npc_pref_traits'): jump 'pref_loop_2'
  59. !!Overwrite the $npc_pref....[$ARGS[0]] strings with the rebuild string.
  60. $npc_preferences[$ARGS[0]] = replace($temp_npc_pref_traits, ' ', '')
  61. $npc_pref_values[$ARGS[0]] = replace($temp_npc_trait_values, ' ', '')
  62. killvar '$temp_npc_pref_traits'
  63. killvar '$temp_npc_trait_values'
  64. killvar 'pref_loop_2'
  65. temp_skip_loop = 1
  66. jump 'skip_start'
  67. end
  68. i += 1
  69. if i < arrsize('$npc_pref_traits'): jump 'preference_loop'
  70. !!We have checked that the npc has no preference for the trait.
  71. !!We add the preference to the npc.
  72. $npc_preferences[$ARGS[0]] += replace({$npc_pref_traits[] = } + "'<<$ARGS[1]>>'" + {
  73. }, ' ', '')
  74. $npc_pref_values[$ARGS[0]] += replace({npc_trait_values} + "['<<$ARGS[1]>>'] = <<temp_trait_value>>" + {
  75. }, ' ', '')
  76. end
  77. end
  78. killvar '$npc_pref_traits'
  79. killvar 'npc_trait_values'
  80. killvar 'i'
  81. killvar 'temp_skip_loop'
  82. killvar 'skip_start'
  83. killvar 'temp_value'
  84. end
  85. !!====================================!!
  86. !! !!
  87. !! Calculate pref_value !!
  88. !! !!
  89. !!====================================!!
  90. if $ARGS[0] = 'get_value':
  91. temp_pref_values['hate'] = -30
  92. temp_pref_values['dislike'] = -15
  93. temp_pref_values['neutral'] = 0
  94. temp_pref_values['like'] = 15
  95. temp_pref_values['love'] = 30
  96. if $ARGS[1] = 'body_fit' or $ARGS[1] = 'body_piercing':
  97. temp_pref_values['hate'] = -30
  98. temp_pref_values['dislike'] = -15
  99. end
  100. if $ARGS[2] = 'hate':
  101. result = temp_pref_values['hate']
  102. elseif $ARGS[2] = 'dislike':
  103. result = temp_pref_values['dislike']
  104. elseif $ARGS[2] = 'like':
  105. result = temp_pref_values['like']
  106. elseif $ARGS[2] = 'love':
  107. result = temp_pref_values['love']
  108. else
  109. result = temp_pref_values['neutral']
  110. end
  111. killvar 'temp_pref_values'
  112. end
  113. !! To be updated
  114. !! 'body_tits_big'
  115. !! 'body_ass_bubble'
  116. !! Body
  117. !! 'body_fit'
  118. !! 'body_piercing'
  119. !! 'body_pregnant'
  120. !! 'body_strong'
  121. !! 'body_tan'
  122. !! 'body_tatoo'
  123. !! Clothes
  124. !! 'clothes_bimbo'
  125. !! 'clothes_goth'
  126. !! 'clothes_punk'
  127. !! 'clothes_skirt_short'
  128. !! 'clothes_thin'
  129. !! Cosmetics
  130. !! 'cosmetics_makeup'
  131. !! Cum
  132. !! 'cum_face'
  133. !! 'cum_clothes'
  134. --- npc_add_preference ---------------------------------