npc_relationship.qsrc 8.7 KB

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