Browse Source

[fixes] broken randoms and associated code

slanon 4 years ago
parent
commit
5243e4a396
1 changed files with 76 additions and 140 deletions
  1. 76 140
      locations/gschool_events.qsrc

+ 76 - 140
locations/gschool_events.qsrc

@@ -273,7 +273,7 @@ if $ARGS[0] = 'break_events':
 					grupvalue[1] += 1
 					grupvalue[2] += 2
 					grupvalue[4] += 3
-					npc_rel['A<<r>>'] -= 5
+					npc_rel[$school_static_num] -= 5
 					'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy1.jpg"></center>'
 					'The moment the hand makes contact with your bottom, you jump mid-stride and squeal at the stinging pain. You whip around and glare furiously at <<$rand_boy>> who is standing right behind you with a shit eating grin on his face. "What the fuck do you think you''re doing you fucking perv!" you scream in his face before swinging your hand, your smack causing a resounding clap that is echoed by the, "Ooooh!" of your observing classmates. Before giving him a chance to respond, you storm off in the direction you were originally headed'+iif($pantyworntype ! 'none', '.', ', though the whispers of your classmates regarding the sound of his hand on your naked ass cheeks follow you down the hallway.')
 					gs 'gschool_events', 'leave_break_events'
@@ -1668,18 +1668,12 @@ if $ARGS[0] = 'afterschool_events':
 		'As you are heading out of school, you see a group of gopniks ahead of you. Just before you walk past them Vitek steps in front of you blocking your path. You look at Vitek with contempt, "What the fuck do you want?" He''s not impressed in the slightest.'
 		*nl
 		'"I''ll show you what the fuck I want, slut." With these words, Vitek suddenly grabs you by the hair and presses your face against his desk. "What I want is your lips around my dick, right now. Everyone already knows you''re a <<$gnikname>>, you better start acting like it or there will be consequences." He turns to his friends and says, "Come on boys, this whore doesn''t understand her place in life. It''s about time we show her."'
-		i = 0
-		:rand_jock_loop
 		gs 'gschool_events', 'rand_boy_arg', 0,1,0,0,0,0
-		if npc_gender['A<<r>>'] = 0 and npc_grupTipe['A<<r>>'] = 2 and npc_rel['A<<r>>'] > 50:
-			$jock = $npc_nickname['A<<r>>']
-			'As you try and pull away <<$jock>> comes over and pulls the gopnik off you and turns to him. "Leave her alone!"'
+		if npc_rel[$school_static_num] > 50 and npc_gender[$school_static_num] = 0 and npc_grupTipe[$school_static_num] = 2:
+			'As you try and pull away <<$rand_boy>> comes over and pulls the gopnik off you and turns to him. "Leave her alone!"'
 			'The gopnik turns towards him and narrows his eyes. "Or what pussy?"'
-			'<<$jock>> Steps up close crowding him. "Or I will fucking kick your ass right here!" Then they start shoving each other, but before more can happen a teacher interrupts. "What''s going on here, break it up all of you." With that everyone goes their own way as the teacher watches and you word a thank you to <<$jock>> as you slip away.'
+			'<<$rand_boy>> Steps up close crowding him. "Or I will fucking kick your ass right here!" Then they start shoving each other, but before more can happen a teacher interrupts. "What''s going on here, break it up all of you." With that everyone goes their own way as the teacher watches and you word a thank you to <<$jock>> as you slip away.'
 			act 'Continue': gt 'gschool_grounds', 'main'
-		elseif i < 1000:
-			i += 1
-			jump 'rand_jock_loop'
 		else
 			gs 'willpower', 'bj', 'resist'
 			if will_cost <= pcs_willpwr:
@@ -1801,24 +1795,22 @@ if $ARGS[0] = 'rand_scoolboy':
 	*clr & cla
 	if scoolboy = 1:
 		if DimaRudeBlock = 0 and rand(0,2) = 0:
-			r = 1
+			$school_static_num = 'A1'
 		elseif rand(0,1) = 0:
-			r = 4
+			$school_static_num = 'A4'
 		else
-			r = 147
+			$school_static_num = 'A147'
 		end
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_boy = $npc_nickname['A<<r>>']	
+		$rand_boy = $npc_nickname[$school_static_num]	
 	elseif scoolboy = 3:
 		if (artQW ! 3 and artQW ! 20) and rand(0,2) = 0:
-			r = 2
+			$school_static_num = 'A2'
 		elseif rand(0,1) = 0:
-			r = 6
+			$school_static_num = 'A6'
 		else
-			r = 152
+			$school_static_num = 'A152'
 		end
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_boy = $npc_nickname['A<<r>>']
+		$rand_boy = $npc_nickname[$school_static_num]
 	elseif scoolboy = 4:
 		if pav_sex >= 50 and kotovLoveQW <= 0:
 			gt 'gschool_events', 'rand_gopnic'
@@ -1828,8 +1820,8 @@ if $ARGS[0] = 'rand_scoolboy':
 	else
 		gs 'gschool_events', 'rand_boy_arg', 0, 1, 0, 0, 1, 0
 	end
-	'<center><img <<$set_imgh>> src="images/pc/npc_headshots/big<<r>>.jpg"></center>'
-	if npc_gender['A<<r>>'] = 0:
+	'<center><img <<$set_imgh>> src="images/pc/npc_headshots/big<<mid($school_static_num, 2)>>.jpg"></center>'
+	if npc_gender[$school_static_num] = 0:
 		if scoolboy = 3:
 			'You can tell from the embarrassed look on his face and the admiring glances of his friends that <<$rand_boy>> was the one touching your ass. Looks like he scored some points in his group today.'
 		elseif scoolboy = 2:
@@ -1851,7 +1843,7 @@ if $ARGS[0] = 'rand_scoolboy':
 		else
 			'Wait a minute... you don''t recognize any of these people! You must be in the wrong classroom!'
 		end
-		if npc_rel['A<<r>>'] <= 50 and npc_grupTipe['A<<r>>'] ! 5:
+		if npc_rel[$school_static_num] <= 50 and npc_grupTipe[$school_static_num] ! 5:
 			act 'Ignore it':
 				grupvalue[1] -= 1
 				grupvalue[2] -= 1
@@ -1865,7 +1857,7 @@ if $ARGS[0] = 'rand_scoolboy':
 					*clr & cla
 					gs 'willpower', 'pay', 'self'
 					gs 'stat'
-					npc_rel['A<<r>>'] -= 5
+					npc_rel[$school_static_num] -= 5
 					'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy1.jpg"></center>'
 					if mesec > 0:
 						'It''s bad enough he did it, it is worse because you are on your period. "You fucking pervert!" you shout angrily, and you slap him across the face as hard as you can. You shake the stinging out of your hand afterwards, while he clutches his cheek in agony. When he finally pulls his hands away from his face, the outline of your hand is clearly visible on his cheek that''s going to leave a bruise. The other boys laugh loudly, this is the best entertainment they''ve had during the break in a long time.'
@@ -1888,9 +1880,9 @@ if $ARGS[0] = 'rand_scoolboy':
 			else
 				act 'Slap him hard (<font color="red"><<will_cost>> Willpower</font>)': '<br><font color="red">You don''t have enough willpower to use this action.</font>'
 			end
-		elseif npc_rel['A<<r>>'] > 50:
+		elseif npc_rel[$school_static_num] > 50:
 			act 'Slap him playfully':
-				npc_rel['A<<r>>'] -= 2
+				npc_rel[$school_static_num] -= 2
 				*clr & cla
 				'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy2.jpg"></center>'
 				'You think to yourself, "<<$rand_boy>> ain''t so bad... but still, I can''t just let him do this."'
@@ -1917,12 +1909,12 @@ if $ARGS[0] = 'rand_scoolboy':
 			act 'Continue': gt 'gschool_events', 'leave_break_events2'
 		end
 !! or npcsex[r]	> 0 can be removed if all remnants of the old school ID-System are gone	
-	elseif npc_sex['A<<r>>'] > 0 or npcsex[r] > 0:
+	elseif npc_sex[$school_static_num] > 0 or npcsex[mid($school_static_num,2)] > 0:
 		'You notice the confident stares of <<$rand_boy>> it must''ve been him.'
 		act 'Taunt him':
 			*clr & cla
 			pcs_horny += 50
-			gs 'boyStat', 'A<<r>>'
+			gs 'boyStat', $school_static_num
 			gs'stat'
 			'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy4.jpg"></center>'
 			'He''s kind of cute. You''re so horny right now, you decide to tease him and see if you can push him into doing more. You put your finger in your mouth and quietly ask him in a lewd voice, "Come on <<$rand_boy>>, is that all you have for me?"'
@@ -2007,12 +1999,12 @@ if $ARGS[0] = 'rand_scoolboy':
 		end
 		!! apmeet=6 This closure molestation nerds, Well I think so from the code, who knows if there is no correct.
 		!! dimarudeblock=1 This video stolen from Nosov.
-		if (apmeet = 6 and (r = 6 or r = 2)) or (dimarudeblock = 1 and r = 1):
+		if (apmeet = 6 and (val(mid($school_static_num,2)) = 6 or val(mid($school_static_num,2)) = 2)) or (dimarudeblock = 1 and val(mid($school_static_num,2)) = 1):
 			*nl
 			'After all <<$rand_boy>> did with you, he''s still pinching your ass in school like that? He''s kinda cute, but still that''s just wrong!'
 			act 'Kick him in the balls':
 				*clr & cla
-				npc_rel['A<<r>>'] -= 10
+				npc_rel[$school_static_num] -= 10
 				grupvalue[4] += 5
 				'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy8.jpg"></center>'
 				'You kick <<$rand_boy>> in the balls, sending him and all of his classmates the message that you will not put up with this behavior in school. You watch him writhe in pain on the floor for a second, before collecting your things and making your way to your next class.'
@@ -2029,6 +2021,7 @@ if $ARGS[0] = 'rand_gopnic':
 	else
 		r = rand(154,156)
 	end
+	$school_static_num = 'A<<r>>'
 
 	if grupTipe = 4:
 		*clr & cla
@@ -2088,7 +2081,7 @@ if $ARGS[0] = 'rand_gopnic':
 			end
 		end
 	else
-		gs 'boystat', 'A<<r>>'
+		gs 'boystat', $school_static_num
 		'<center><img <<$set_imgh>> src="images/pc/npc_headshots/big<<r>>.jpg"></center>'
 		'You look at <<$boydesc>> with contempt, "What the fuck do you want?" He''s not impressed in the slightest, your loose reputation undermining any authority you try to impose.'
 		act 'Continue':
@@ -2098,7 +2091,7 @@ if $ARGS[0] = 'rand_gopnic':
 			'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/events/rand_scoolboy5.jpg"></center>'
 			'"I''ll show you what the fuck I want, slut." With these words, <<$boydesc>> suddenly grabs you by the hair and presses your face against his desk. "What I want is your lips around my dick, right now. Everyone already knows you''re a <<$gnikname>>, you better start acting like it or there will be consequences." He turns to his friends and says, "Come on boys, this whore doesn''t understand her place in life. It''s about time we show her."'
 			gs 'gschool_events', 'rand_boy_arg1', 0, 1, 0, 0, 0, 0
-			if npc_rel['A<<r>>'] > 50:
+			if npc_rel[$school_static_num] > 50:
 				'As you try and pull away <<$rand_boy1>> comes over and pulls the gopnik off you and turns to him. "Leave her alone!"'
 				'The gopnik turns towards him and narrows his eyes. "Or what pussy?"'
 				'<<$rand_boy1>> Steps up close crowding him. "Or I will fucking kick your ass right here!" Then they start shoving each other, but before more can happen a teacher interupts. "What''s going on here, break it up all of you." With that you word a thank you to <<$rand_boy1>> and slip away.'
@@ -2223,140 +2216,83 @@ end
 
 !!Random boy, arguments set to 1 mean included, groups are cool kids, jock, nerd, gopnik, outcast, teachers
 if $ARGS[0] = 'rand_boy_arg':
-	grup1 = 0
-	grup2 = 0
-	grup3 = 0
-	grup4 = 0
-	grup5 = 0
-	grup6 = 0
-	if ARGS[1] = 1:grup1 = 1
-	if ARGS[2] = 1:grup2 = 2
-	if ARGS[3] = 1:grup3 = 3
-	if ARGS[4] = 1:grup4 = 4
-	if ARGS[5] = 1:grup5 = 5
-	if ARGS[6] = 1:grup6 = 6
-	boy_counter = 0
-	:rnd_boy_loop
-	boy_counter += 1
-	r = rand(0,arrsize('npc_grupTipe'))
-	if npc_gender['A<<r>>'] = 0 and schoolenable['A<<r>>'] = 1 and npc_grupTipe['A<<r>>'] ! 0 and (npc_grupTipe['A<<r>>'] = grup1 or npc_grupTipe['A<<r>>'] = grup2 or npc_grupTipe['A<<r>>'] = grup3 or npc_grupTipe['A<<r>>'] = grup4 or npc_grupTipe['A<<r>>'] = grup5 or npc_grupTipe['A<<r>>'] = grup6):
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_boy = $npc_nickname['A<<r>>']
-		killvar 'boy_counter'
-	elseif boy_counter = 1000:
-		$school_static_num = 0
-		$rand_boy = 'boy you don''t know'
-		killvar 'boy_counter'
+	$school_static_num = func('gschool_events', 'random_pers', 0, ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6])
+	if $school_static_num ! 'A0':
+		$rand_boy = $npc_nickname[$school_static_num]
 	else
-		jump 'rnd_boy_loop'
+		$rand_boy = 'boy you don''t know'
 	end
 end
 
 if $ARGS[0] = 'rand_boy_arg1':
-	grup1 = 0
-	grup2 = 0
-	grup3 = 0
-	grup4 = 0
-	grup5 = 0
-	grup6 = 0
-	if ARGS[1] = 1:grup1 = 1
-	if ARGS[2] = 1:grup2 = 2
-	if ARGS[3] = 1:grup3 = 3
-	if ARGS[4] = 1:grup4 = 4
-	if ARGS[5] = 1:grup5 = 5
-	if ARGS[6] = 1:grup6 = 6
-	boy_counter = 0
 	:rnd_boy1_loop
-	boy_counter += 1
-	r = rand(0,arrsize('npc_grupTipe'))
-	if npc_gender['A<<r>>'] = 0 and schoolenable['A<<r>>'] = 1 and npc_grupTipe['A<<r>>'] ! 0 and (npc_grupTipe['A<<r>>'] = grup1 or npc_grupTipe['A<<r>>'] = grup2 or npc_grupTipe['A<<r>>'] = grup3 or npc_grupTipe['A<<r>>'] = grup4 or npc_grupTipe['A<<r>>'] = grup5 or npc_grupTipe['A<<r>>'] = grup6):
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_boy1 = $npc_nickname['A<<r>>']
+	$school_static_num = func('gschool_events', 'random_pers', 0, ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6])
+	if $school_static_num ! 'A0':
+		$rand_boy1 = $npc_nickname[$school_static_num]
 		if $rand_boy = $rand_boy1: jump 'rnd_boy1_loop'
-		killvar 'boy_counter'
-	elseif boy_counter = 1000:
-		$school_static_num = 0
-		$rand_boy1 = 'boy you don''t know'
-		killvar 'boy_counter'
 	else
-		jump 'rnd_boy1_loop'
+		$rand_boy1 = 'boy you don''t know'
 	end
 end
 
-if $ARGS[0] = 'rand_girl_arg':
-	grup1 = 0
-	grup2 = 0
-	grup3 = 0
-	grup4 = 0
-	grup5 = 0
-	grup6 = 0
-	if ARGS[1] = 1:grup1 = 1
-	if ARGS[2] = 1:grup2 = 2
-	if ARGS[3] = 1:grup3 = 3
-	if ARGS[4] = 1:grup4 = 4
-	if ARGS[5] = 1:grup5 = 5
-	if ARGS[6] = 1:grup6 = 6
-	girl_counter = 0
-	:rnd_girl_loop
-	girl_counter += 1
-	r = rand(0,arrsize('npc_grupTipe'))
-	if npc_gender['A<<r>>'] = 1 and schoolenable['A<<r>>'] = 1 and npc_grupTipe['A<<r>>'] ! 0 and (npc_grupTipe['A<<r>>'] = grup1 or npc_grupTipe['A<<r>>'] = grup2 or npc_grupTipe['A<<r>>'] = grup3 or npc_grupTipe['A<<r>>'] = grup4 or npc_grupTipe['A<<r>>'] = grup5 or npc_grupTipe['A<<r>>'] = grup6):
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_girl = $npc_nickname['A<<r>>']
-		killvar 'girl_counter'
-	elseif girl_counter = 1000:
-		$school_static_num = 0
-		$rand_girl = 'girl you don''t know'
-		killvar 'girl_counter'
+if $ARGS[0] = 'rand_girl_arg':	
+	$school_static_num = func('gschool_events', 'random_pers', 1, ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6])
+	if $school_static_num ! 'A0':
+		$rand_girl = $npc_nickname[$school_static_num]
 	else
-		jump 'rnd_girl_loop'
+		$rand_girl = 'girl you don''t know'
 	end
 end
 
 if $ARGS[0] = 'rand_girl_arg1':
-	grup1 = 0
-	grup2 = 0
-	grup3 = 0
-	grup4 = 0
-	grup5 = 0
-	grup6 = 0
-	if ARGS[1] = 1:grup1 = 1
-	if ARGS[2] = 1:grup2 = 2
-	if ARGS[3] = 1:grup3 = 3
-	if ARGS[4] = 1:grup4 = 4
-	if ARGS[5] = 1:grup5 = 5
-	if ARGS[6] = 1:grup6 = 6
-	girl_counter = 0
 	:rnd_girl1_loop
-	girl_counter += 1
-	r = rand(0,arrsize('npc_grupTipe'))
-	if npc_gender['A<<r>>'] = 1 and schoolenable['A<<r>>'] = 1 and npc_grupTipe['A<<r>>'] ! 0 and (npc_grupTipe['A<<r>>'] = grup1 or npc_grupTipe['A<<r>>'] = grup2 or npc_grupTipe['A<<r>>'] = grup3 or npc_grupTipe['A<<r>>'] = grup4 or npc_grupTipe['A<<r>>'] = grup5 or npc_grupTipe['A<<r>>'] = grup6):
-		$school_static_num = $school_static_num['A<<r>>']
-		$rand_girl1 = $npc_nickname['A<<r>>']
+	$school_static_num = func('gschool_events', 'random_pers', 1, ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6])
+	if $school_static_num ! 'A0':
+		$rand_girl1 = $npc_nickname[$school_static_num]
 		if $rand_girl = $rand_girl1: jump 'rnd_girl1_loop'
-		killvar 'girl_counter'
-	elseif girl_counter = 1000:
-		$school_static_num = 0
-		$rand_girl1 = 'girl you don''t know'
-		killvar 'girl_counter'
 	else
-		jump 'rnd_girl1_loop'
+		$rand_girl1 = 'girl you don''t know'
 	end
 end
 
 !!Random teacher, male
 if $ARGS[0] = 'rand_teacher_arg':
-	teacher_counter = 0
-	:rnd_teacher_loop
-	teacher_counter += 1
-	r = rand(0,arrsize('npc_grupTipe'))
-	if teacher_counter = 1000:
+	$school_static_num = func('gschool_events', 'random_pers', 0, ARGS[1], ARGS[2], ARGS[3], ARGS[4], ARGS[5], ARGS[6])
+	if $school_static_num ! 'A0':
+		$rand_teacher = $npc_nickname[$school_static_num]
+	else
 		$rand_teacher = 'Tsarev'
-		killvar 'teacher_counter'
-	elseif npc_grupTipe['A<<r>>'] ! 6 or npc_gender['A<<r>>'] = 1:
-		jump 'rnd_teacher_loop'
 	end
-	$rand_teacher = dyneval('$result = $npc_lastname[''A<<r>>'']')
+	$rand_teacher = dyneval('$result = $npc_lastname[<<$school_static_num>>]')
+end
+
+!{ random person by gender, groups (replaces old faulty random code)
+   set gender to -1 to include both genders, 0 for male, 1 for female
+   set groups to 1 to include, 0 otherwise
+   usage:
+	$x = func('gschool_events', 'random_pers', gender, g1, g2, g3, g4, g5, g6)
+ }
+if $ARGS[0] = 'random_pers':
+	!! create candidate array:
+	tmpArrIdx = 0
+	:rand_pers_fill_loop
+		$school_static_num = $school_static_num[tmpArrIdx]
+		if schoolenable[$school_static_num] = 1 and (ARGS[1] = -1 or npc_gender[$school_static_num] = ARGS[1]) and (npc_grupTipe[$school_static_num] = ARGS[2] or npc_grupTipe[$school_static_num] = ARGS[3]*2 or npc_grupTipe[$school_static_num] = ARGS[4]*3 or npc_grupTipe[$school_static_num] = ARGS[5]*4 or npc_grupTipe[$school_static_num] = ARGS[6]*5 or npc_grupTipe[$school_static_num] = ARGS[7]*6):
+			$tmpCandidateArr[] = $school_static_num
+		end
+		tmpArrIdx +=1
+	if tmpArrIdx < arrsize('$school_static_num'): jump 'rand_pers_fill_loop'
+
+	!! random person within candidates
+	if arrsize('tmpCandidateArr') > 0:
+		$result = $tmpCandidateArr[rand(0, arrsize('tmpCandidateArr') -1)]
+	else
+		$result = 'A0'
+	end
+
+	!! cleanup
+	killvar 'tmpArrIdx'
+	killvar 'tmpCandidateArr'
 end
 
 if $ARGS[0] = 'christinaphotos':