1
0

npc_relationship.qsrc 7.6 KB

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