npc_relationship.qsrc 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. # npc_relationship
  2. !{ Interface to the Relationship system. This system determines the relationship or reputation that the NPC has for the PC
  3. Methods are:
  4. 1) modify => adds value to this relationship. Can be integer(positive or negative) or string with 'like', 'love', 'adore', 'dislike','hate','loathe'
  5. params: NPCID, value
  6. optional params: Number of times a day, string identifying the event.
  7. Number of times a day can be any non negative numerical valuea, a value of 0 means no limit, else the times that a call for the same npc with the sting identifying the event can change relationship in a given day.
  8. 2) set => sets relationship to a specific value (used to initialize?)
  9. params: NPCID, value
  10. 3) check => like willpower checks, this is used to see if the NPC passes a given threshhold.
  11. params: value, NPCID1,NPCID2,NPCID3....
  12. result: number of NPCs that passed the check
  13. $ARGS[1] determines the Method being used:
  14. 'modify' =>
  15. $ARGS[1] => NPCID - This is NPC identifier thisis acting one, for example 'A29' is the PC''s mother.
  16. ARGS[2] => integer for how much to change the relationship can be positive or negative
  17. or
  18. $ARGS[2] => if third value is a string, the writer doesn't need to know the numberic values, but can use generic amounts
  19. 'like' => moves relationship positively a small amount
  20. 'love' => moves relationship positively a moderate amount
  21. 'adore' => moves relationship positively a large amount
  22. 'dislike' => moves relationship negatively a small amount
  23. 'hate' => moves relationship negatively a moderate amount
  24. 'loathe' => moves relationship negatively a large amount
  25. examples:
  26. gs 'npc_relationship', 'modify', 'A29', 2
  27. gs 'npc_relationship', 'modify', 'A29', 'hate'
  28. 'set' =>
  29. $ARGS[1] => NPCID - This is NPC identifier thisis acting one, for example 'A29' is the PC''s mother.
  30. ARGS[2] => integer to set this NPC's relationship to a specific value.
  31. or
  32. $ARGS[2] => if third value is a string, the writer doesn't need to know the numberic values, but can use generic amounts
  33. 'unknown' => NPC don''t know PC
  34. 'aquaintance' => NPC knows PC, but not much else
  35. 'friend' => NPC is friends and will probably react favorably
  36. 'bestie' => NPC is a best friend
  37. 'loved' => NPC will die to protect PC
  38. examples:
  39. gs 'npc_relationship', 'set', 'A29', 90
  40. gs 'npc_relationship', 'set', 'A29', 'loved'
  41. !The following will make it possible to only gain relationship with the npc A29 3 times a day for any call with $ARGS[4] 'disco'
  42. gs 'npc_relationship', 'set', 'A29', 'loved', 3, 'disco'
  43. 'check' =>
  44. ARGS[1] => Relationship level to check for. Should be integer 1 - 100
  45. $ARGS[2-9] => List of NPCIDs to check, , for example 'A29' is the PC''s mother.
  46. examples:
  47. !Check if one of Mother, Aunt Ludmilla, or Grandma have at least 50 relationship:
  48. if func('npc_relationship', 'check', 50, 'A29', 'A30', 'A31') > 0:
  49. !Check if all of Mother, Aunt Ludmilla, or Grandma have at least 50 relationship:
  50. if func('npc_relationship', 'check', 50, 'A29', 'A30', 'A31') > 2:
  51. !Also if you don't like a function, if sets variable npc_rel_check like WillPower
  52. gs 'npc_relationship', 'check', 50, 'A29', 'A30', 'A31'
  53. if npc_rel_check > 0:
  54. }
  55. if $ARGS[0] = 'modify':
  56. !Handle if value is numeric
  57. if $ARGS[2] = '':
  58. npcRelSetVal = ARGS[2]
  59. !Handle cases where value is a string to be interpreted
  60. elseif $ARGS[2] = 'like':
  61. npcRelSetVal = rand(1,2)
  62. elseif $ARGS[2] = 'love':
  63. npcRelSetVal = rand(3,4)
  64. gs 'exp_gain', 'humint', rand(0,1)
  65. elseif $ARGS[2] = 'adore':
  66. npcRelSetVal = rand(5,6)
  67. gs 'exp_gain', 'humint', rand(1,2)
  68. elseif $ARGS[2] = 'dislike':
  69. npcRelSetVal = 0-rand(1,2)
  70. elseif $ARGS[2] = 'hate':
  71. npcRelSetVal = 0-rand(3,4)
  72. elseif $ARGS[2] = 'loathe':
  73. npcRelSetVal = 0-rand(5,6)
  74. !Handle default value
  75. else
  76. npcRelSetVal = 0
  77. end
  78. !Modify for people skill
  79. if npcRelSetVal > 0:
  80. npcRelSetVal += (npcRelSetVal*pcs_humint)/100
  81. elseif npcRelSetVal < 0:
  82. npcRelSetVal -= (npcRelSetVal*pcs_humint)/200
  83. end
  84. !Make sure the new value fits within correct range
  85. npcRelSetVal += npc_rel[$ARGS[1]]
  86. if npcRelSetVal > 100: npcRelSetVal=100
  87. if npcRelSetVal < 0: npcRelSetVal = 0
  88. !Make sure that daily limited calls are counted and relationship value only added the allowed times in a given day.
  89. if ARGS[3] > 0:
  90. if ARGS[3] > npc_rel_daily[$ARGS[1]+$ARGS[4]]:
  91. npc_rel_daily[$ARGS[1]+$ARGS[4]] += 1
  92. else
  93. npcRelSetVal = npc_rel[$ARGS[1]]
  94. end
  95. end
  96. !Checks that relatioship gain is not added to relationship locked npc''s
  97. if $ARGS[1] = 'A1' and (dimaRevenge = 6 and (dimaRevChoice = 3 or dimaRevChoice = 5 or dimaRevChoice = 6)) or (dimaRevenge = 7 and dimaRevChoice = 2) or (dimaRevenge = 8 and (dimaRevChoice = 1 or dimaRevChoice = 4)):
  98. npcRelSetVal = npc_rel[$ARGS[1]]
  99. !! A12 - Christina, hates YOU
  100. elseif $ARGS[1] = 'A18' and npcRelSetVal > 20:
  101. npcRelSetVal = 20
  102. !! A23 - Albina, hates gopniks
  103. elseif $ARGS[1] = 'A23' and grupTipe = 4 and SchoolAtestat = 0 and npcRelSetVal > 20:
  104. npcRelSetVal = 20
  105. end
  106. !Set to new value
  107. npc_rel[$ARGS[1]] = npcRelSetVal
  108. killvar 'npcRelSetVal'
  109. end
  110. if $ARGS[0] = 'set':
  111. !Handle if value is numeric
  112. if $ARGS[2] = '':
  113. npcRelSetVal = ARGS[2]
  114. !Handle cases where value is a string to be interpreted
  115. elseif $ARGS[2] = 'unknown':
  116. npcRelSetVal = 0
  117. elseif $ARGS[2] = 'aquaintance':
  118. npcRelSetVal = 20
  119. elseif $ARGS[2] = 'friend':
  120. npcRelSetVal = 50
  121. elseif $ARGS[2] = 'bestie':
  122. npcRelSetVal = 70
  123. elseif $ARGS[2] = 'loved':
  124. npcRelSetVal = 90
  125. !Handle default value
  126. else
  127. npcRelSetVal = 0
  128. end
  129. !Make sure the new value fits within correct range
  130. if npcRelSetVal > 100: npcRelSetVal=100
  131. if npcRelSetVal < 0: npcRelSetVal = 0
  132. !Set to new value
  133. npc_rel[$ARGS[1]] = npcRelSetVal
  134. killvar 'npcRelSetVal'
  135. end
  136. if $ARGS[0] = 'check':
  137. !Value we are checking against
  138. npcRelSetVal = ARGS[1]
  139. npc_rel_check = 0
  140. !Loop through remaining $ARGS entries and count up number of successful compares
  141. i=2
  142. :npcRelCheck000
  143. if $ARGS[i] ! '':
  144. if npc_rel[$ARGS[i]] >= npcRelSetVal:
  145. npc_rel_check += 1
  146. end
  147. i+=1
  148. jump 'npcRelCheck000'
  149. end
  150. result = npc_rel_check
  151. killvar 'npcRelSetVal'
  152. end
  153. !! ---------- default value setups -----------
  154. !! Family and friends
  155. if $ARGS[0] = 'default_family_friends':
  156. gs 'npc_relationship', 'set', 'A28', 50 & ! stepdad (Vladimir)
  157. gs 'npc_relationship', 'set', 'A29', 50 & ! mother (Natasha)
  158. gs 'npc_relationship', 'set', 'A30', 50 & ! aunt Luda
  159. gs 'npc_relationship', 'set', 'A31', 50 & ! grandma (Elena)
  160. gs 'npc_relationship', 'set', 'A32', 50 & ! grandpa (Zlatek)
  161. gs 'npc_relationship', 'set', 'A33', 70 & ! Anya
  162. gs 'npc_relationship', 'set', 'A34', 50 & ! Kolka
  163. gs 'npc_relationship', 'set', 'A11', 60 & ! Vasily Shulgin
  164. !! default friendship of 40 with Mitka 20 with Kolyamba and Vasyan in Gadukino
  165. gs 'npc_relationship', 'set', 'A63', 40
  166. gs 'npc_relationship', 'set', 'A62', 20
  167. gs 'npc_relationship', 'set', 'A61', 20
  168. end
  169. ! Adds relationship based on group types ass passed in
  170. !
  171. ! Variable 'sg_setting_gend' can be set for specific gender selection. 1=Male, 2=Female
  172. ! Required Parameters, these are relationships for each of these groups:
  173. ! ARGS[1] = coolkid
  174. ! ARGS[2] = jock
  175. ! ARGS[3] = nerd
  176. ! ARGS[4] = gopnik
  177. ! ARGS[5] = outcast
  178. ! ARGS[6] = teacher
  179. if $ARGS[0] = 'socialgroup_setting_internal':
  180. r = 1
  181. :socialgroup_loop
  182. if sg_setting_gend = 0 or npc_gender['A<<r>>'] = sg_setting_gend-1:
  183. i = 1
  184. :socialgroup_loop2
  185. !! Loop through ARGS[1-6], updating relationship if needed
  186. if i <= 6:
  187. !
  188. if npc_grupTipe['A<<r>>'] = i and ARGS[i] ! 0:
  189. gs 'npc_relationship', 'modify', 'A<<r>>', ARGS[i]
  190. end
  191. i += 1
  192. jump 'socialgroup_loop2'
  193. end
  194. end
  195. r += 1
  196. if r <= aarraynumber :jump 'socialgroup_loop'
  197. killvar 'i'
  198. killvar 'r'
  199. killvar 'sg_setting_gend'
  200. end
  201. if $ARGS[0] = 'socialgroup_setting':
  202. !All Genders
  203. sg_setting_gend = 0
  204. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  205. end
  206. if $ARGS[0] = 'socialgroup_setting_boys':
  207. !Males
  208. sg_setting_gend = 1
  209. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  210. end
  211. if $ARGS[0] = 'socialgroup_setting_girls':
  212. !Females
  213. sg_setting_gend = 2
  214. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  215. end
  216. if $ARGS[0] = 'defaultfriendship':
  217. r = 1
  218. :default_friendship_loop
  219. if npc_grupTipe['A<<r>>'] = 1 or npc_grupTipe['A<<r>>'] = 2 or npc_grupTipe['A<<r>>'] = 3 or npc_grupTipe['A<<r>>'] = 4 or npc_grupTipe['A<<r>>'] = 5 or npc_grupTipe['A<<r>>'] = 6: gs 'npc_relationship', 'set', 'A<<r>>', 30
  220. r += 1
  221. if r <= aarraynumber :jump 'default_friendship_loop'
  222. end
  223. if $ARGS[0] = 'defaultnotschool':
  224. r = 1
  225. :default_friendship_loop2
  226. if npc_grupTipe['A<<r>>'] = 0: gs 'npc_relationship', 'set', 'A<<r>>', 30
  227. r += 1
  228. if r <= aarraynumber :jump 'default_friendship_loop2'
  229. end
  230. if $ARGS[0] = 'default':
  231. r = 1
  232. :default_friendship_loop3
  233. gs 'npc_relationship', 'set', 'A<<r>>', 30
  234. r += 1
  235. if r <= aarraynumber :jump 'default_friendship_loop3'
  236. end
  237. --- npc_relationship ---------------------------------