1
0
Преглед на файлове

[new] This method can be used to randomly pick an npc from the npcstatic lists.

CroWke преди 5 години
родител
ревизия
391212eb25
променени са 2 файла, в които са добавени 52 реда и са изтрити 0 реда
  1. 1 0
      glife.qproj
  2. 51 0
      locations/randAnpc.qsrc

+ 1 - 0
glife.qproj

@@ -195,6 +195,7 @@
 		<Location name="npc_age"/>
 		<Location name="saveupdater"/>
 		<Location name="NPCChanger"/>
+		<Location name="randAnpc"/>
 	</Folder>
 	<Folder name="Combat">
 		<Location name="fight"/>

+ 51 - 0
locations/randAnpc.qsrc

@@ -0,0 +1,51 @@
+# randAnpc
+
+!! arguments: <gender> <excluded_first_name> <grupTipeEnabled>...
+!! gender : 0 for male, 1 for female, 2 for any gender
+!! excluded_first_name : can be '' or you can provide result of previous invocation, so you can compose non-repeating pairs of people
+!! <grupTipeEnabled>... : 1 if you include grupTipe, 0 otherwise, look at examples below
+!!
+!! example:
+!! $rand_girl = func('randAnpc', 1, '', 1, 1, 0, 1, 0, 0, 0, 0)
+!! $rand_girl1 = func('randAnpc', 1, $rand_girl, 1, 1, 0, 1)
+!!
+!! Having grupTipes (social groups)
+!! 1 - cool kids
+!! 2 - jocks
+!! 3 - nerds
+!! 4 - Gopnik
+!! 5 - outcasts
+!! 6 - teachers
+!! 7 - family
+!! 8 - other Pavlovsk
+!! examples above instruct to choose random person from: cool kids, jocks and gopniks
+!! NOTE that in $rand_girl1 zero values for outcasts, teachers, family and other Pavlovk npcs are not defined - undefined values will be zero by language
+!! Thanks to that you can include new social group and you don''t need to make changes in all places
+
+:selectloop
+	r = rand(1, aarraynumber)
+	if ARGS[1] ! 2:
+		if npc_gender['A<<r>>'] ! ARGS[1]: jump 'selectloop'
+	end
+	if npc_grupTipe['A<<r>>'] = 1:
+		if ARGS[3] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 2:
+		if ARGS[4] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 3:
+		if ARGS[5] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 4:
+		if ARGS[6] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 5:
+		if ARGS[7] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 6:
+		if ARGS[8] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 7:
+		if ARGS[9] = 0: jump 'selectloop'
+	elseif npc_grupTipe['A<<r>>'] = 8:
+		if ARGS[10] = 0: jump 'selectloop'
+	end
+if $npc_firstname['A<<r>>'] = $ARGS[2]: jump 'selectloop'
+
+numnpc = r
+
+--- randAnpc ---------------------------------