npc_relationship.qsrc 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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. elseif $ARGS[2] = 'adore':
  65. npcRelSetVal = rand(5,6)
  66. elseif $ARGS[2] = 'dislike':
  67. npcRelSetVal = 0-rand(1,2)
  68. elseif $ARGS[2] = 'hate':
  69. npcRelSetVal = 0-rand(3,4)
  70. elseif $ARGS[2] = 'loathe':
  71. npcRelSetVal = 0-rand(5,6)
  72. !Handle default value
  73. else
  74. npcRelSetVal = 0
  75. end
  76. !Make sure the new value fits within correct range
  77. npcRelSetVal += npc_rel[$ARGS[1]]
  78. if npcRelSetVal > 100: npcRelSetVal=100
  79. if npcRelSetVal < 0: npcRelSetVal = 0
  80. !Make sure that daily limited calls are counted and relationship value only added the allowed times in a given day.
  81. if ARGS[3] > 0:
  82. if ARGS[3] > npc_rel_daily[$ARGS[1]+$ARGS[4]]:
  83. npc_rel_daily[$ARGS[1]+$ARGS[4]] += 1
  84. else
  85. npcRelSetVal = npc_rel[$ARGS[1]]
  86. end
  87. end
  88. !Checks that relatioship gain is not added to relationship locked npc''s
  89. 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)):
  90. npcRelSetVal = npc_rel[$ARGS[1]]
  91. elseif $ARGS[1] = 'A18' and npc_rel['a18'] >= 20:
  92. npcRelSetVal = 20
  93. end
  94. !Set to new value
  95. npc_rel[$ARGS[1]] = npcRelSetVal
  96. killvar 'npcRelSetVal'
  97. end
  98. if $ARGS[0] = 'set':
  99. !Handle if value is numeric
  100. if $ARGS[2] = '':
  101. npcRelSetVal = ARGS[2]
  102. !Handle cases where value is a string to be interpreted
  103. elseif $ARGS[2] = 'unknown':
  104. npcRelSetVal = 0
  105. elseif $ARGS[2] = 'aquaintance':
  106. npcRelSetVal = 20
  107. elseif $ARGS[2] = 'friend':
  108. npcRelSetVal = 50
  109. elseif $ARGS[2] = 'bestie':
  110. npcRelSetVal = 70
  111. elseif $ARGS[2] = 'loved':
  112. npcRelSetVal = 90
  113. !Handle default value
  114. else
  115. npcRelSetVal = 0
  116. end
  117. !Make sure the new value fits within correct range
  118. if npcRelSetVal > 100: npcRelSetVal=100
  119. if npcRelSetVal < 0: npcRelSetVal = 0
  120. !Set to new value
  121. npc_rel[$ARGS[1]] = npcRelSetVal
  122. killvar 'npcRelSetVal'
  123. end
  124. if $ARGS[0] = 'check':
  125. !Value we are checking against
  126. npcRelSetVal = ARGS[1]
  127. npc_rel_check = 0
  128. !Loop through remaining $ARGS entries and count up number of successful compares
  129. i=2
  130. :npcRelCheck000
  131. if $ARGS[i] ! '':
  132. if npc_rel[$ARGS[i]] >= npcRelSetVal:
  133. npc_rel_check += 1
  134. end
  135. i+=1
  136. jump 'npcRelCheck000'
  137. end
  138. result = npc_rel_check
  139. killvar 'npcRelSetVal'
  140. end
  141. !! ---------- default value setups -----------
  142. !! Family and friends
  143. if $ARGS[0] = 'default_family_friends':
  144. gs 'npc_relationship', 'set', 'A28', 50 & ! stepdad (Vladimir)
  145. gs 'npc_relationship', 'set', 'A29', 50 & ! mother (Natasha)
  146. gs 'npc_relationship', 'set', 'A30', 50 & ! aunt Luda
  147. gs 'npc_relationship', 'set', 'A31', 50 & ! grandma (Elena)
  148. gs 'npc_relationship', 'set', 'A32', 50 & ! grandpa (Zlatek)
  149. gs 'npc_relationship', 'set', 'A33', 70 & ! Anya
  150. gs 'npc_relationship', 'set', 'A34', 50 & ! Kolka
  151. gs 'npc_relationship', 'set', 'A11', 60 & ! Vasily Shulgin
  152. !! default friendship of 40 with Mitka 20 with Kolyamba and Vasyan in Gadukino
  153. gs 'npc_relationship', 'set', 'A63', 40
  154. gs 'npc_relationship', 'set', 'A62', 20
  155. gs 'npc_relationship', 'set', 'A61', 20
  156. end
  157. ! Adds relationship based on group types ass passed in
  158. !
  159. ! Variable 'sg_setting_gend' can be set for specific gender selection. 1=Male, 2=Female
  160. ! Required Parameters, these are relationships for each of these groups:
  161. ! ARGS[1] = coolkid
  162. ! ARGS[2] = jock
  163. ! ARGS[3] = nerd
  164. ! ARGS[4] = gopnik
  165. ! ARGS[5] = outcast
  166. ! ARGS[6] = teacher
  167. if $ARGS[0] = 'socialgroup_setting_internal':
  168. r = 1
  169. :socialgroup_loop
  170. if sg_setting_gend = 0 or npc_gender['A<<r>>'] = sg_setting_gend-1:
  171. i = 1
  172. :socialgroup_loop2
  173. !! Loop through ARGS[1-6], updating relationship if needed
  174. if i <= 6:
  175. !
  176. if npc_grupTipe['A<<r>>'] = i and ARGS[i] ! 0:
  177. gs 'npc_relationship', 'modify', 'A<<r>>', ARGS[i]
  178. end
  179. i += 1
  180. jump 'socialgroup_loop2'
  181. end
  182. end
  183. r += 1
  184. if r <= aarraynumber :jump 'socialgroup_loop'
  185. killvar 'i'
  186. killvar 'r'
  187. killvar 'sg_setting_gend'
  188. end
  189. if $ARGS[0] = 'socialgroup_setting':
  190. !All Genders
  191. sg_setting_gend = 0
  192. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  193. end
  194. if $ARGS[0] = 'socialgroup_setting_boys':
  195. !Males
  196. sg_setting_gend = 1
  197. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  198. end
  199. if $ARGS[0] = 'socialgroup_setting_girls':
  200. !Females
  201. sg_setting_gend = 2
  202. gs 'npc_relationship', 'socialgroup_setting_internal', ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6]
  203. end
  204. if $ARGS[0] = 'defaultfriendship':
  205. r = 1
  206. :default_friendship_loop
  207. 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
  208. r += 1
  209. if r <= aarraynumber :jump 'default_friendship_loop'
  210. end
  211. if $ARGS[0] = 'defaultnotschool':
  212. r = 1
  213. :default_friendship_loop2
  214. if npc_grupTipe['A<<r>>'] = 0: gs 'npc_relationship', 'set', 'A<<r>>', 30
  215. r += 1
  216. if r <= aarraynumber :jump 'default_friendship_loop2'
  217. end
  218. if $ARGS[0] = 'default':
  219. r = 1
  220. :default_friendship_loop3
  221. gs 'npc_relationship', 'set', 'A<<r>>', 30
  222. r += 1
  223. if r <= aarraynumber :jump 'default_friendship_loop3'
  224. end
  225. --- npc_relationship ---------------------------------