# npcgeneratec

! {This file expects npctempgsex which is the desired sex of the NPC to be generated, $npctempgn[0], which is the used name of the generated NPC. Rapist or Red Headed Stranger, for example. And npctempgage, which is the approximate age of the NPC in years. Everything is then randomly generated, and you are expected to fix the generated NPC yourself with any special items you need from it after it completes running. So sex, what you call them until they introduce themselves, and age.}

! The fourth parameters indicates what area the npc''s home is in
!! 1 - Pavlovsk Residential Area
!! 2 - Student dorms in the city
!! 3 - St. Petersburg Residential Area
!! 4 - St. Petersburg City Center
!! {A example to use this would be gs 'npcgeneratec', 0, 'stranger', rand(18,45) which would generate a male with a used name of stranger between 18 and 45.}

npctempgsex = ARGS[0]
$npctempgn[0] = $ARGS[1]
npctempgage = ARGS[2]
temp_location = ARGS[3]

if temp_location = 0:
	if $region = 'city_center' or $region = 'city_residential' or $region = 'city_industrial' or $region = 'city_island' or $region = 'city_lake' or $region = 'city_park':
		temp_location = rand(3,4)
	elseif $region = 'pav_commercial' or $region = 'pav_park' or $region = 'pav_residential':
		temp_location = 1
	end
end

!! {First we set the newly generated index number or overwrite the first blank number}
!! {Checks to see if array 0 in the cleanup list is available for overwrite and makes the overwrite as that if so.}
if mid($cemptyarray[0],1,1) = 'C':
	$npclastgenerated = $cemptyarray[0]
	killvar '$cemptyarray', 0
else
	:npcgencsanityloop
	i = 0
	$npclastgenerated = 'C' + '<<carraynumber>>'
	$npctemparrc = 'C' + '<<(carraynumber)-(1)>>'
	if $npc_perstype[$npctemparrc] = '' and carraynumber > 0:
		carraynumber -= 1
		i = 1
	elseif $npc_perstype[$npclastgenerated] = '':
		i = 0
	else
		carraynumber += 1
		i = 1
	end
	if i = 1: jump 'npcgencsanityloop'
end
carraynumber += 1

! {moved up to here}
npclastgeneratedn = mid($npclastgenerated, 2)

! {Now we need a random birthday based on the rough age given.}
npctempc1[1] = year - npctempgage
npctempc1[2] = rand(1,12)
if npctempc1[2] = 4 or npctempc1[2] = 6 or npctempc1[2] = 9 or npctempc1[2] = 11:
	npctempc1[3] = rand(1,30)
elseif npctempc1[2] = 1 or npctempc1[2] = 3 or npctempc1[2] = 5 or npctempc1[2] = 7 or npctempc1[2] = 8 or npctempc1[2] = 10  or npctempc1[2] = 12:
	npctempc1[3] = rand(1,31)
elseif ((npctempc1[1] mod 4 = 0) and (npctempc1[1] mod 100 ! 0)) or (npctempc1[1] mod 400 = 0):
	npctempc1[3] = rand(1,29)
else
	npctempc1[3] = rand(1,28)
end
npc_dob[$npclastgenerated] = npctempc1[1] * 10000
npc_dob[$npclastgenerated] += (npctempc1[2] * 100)
npc_dob[$npclastgenerated] += npctempc1[3]
! {we save the unique number of the npc, to be able to get the index of the array via arrpos}

! {Now, we set the variable for the stat randomization as well as calculate chance of virginity.}
if npctempgage < 18:
	npctempc2[0] = 30
	npctempc2[1] = rand(0,20)
else
	npctempc2[0] = 50
	npctempc2[1] = rand(19,24)
end
! {We flag virginity based on the results of the check. Overwrite it after generation if you want to be sure of status.}
if npctempc2[1] < 20:
	npc_sexskill[$npclastgenerated] = 0
end


! {Then we need to give them a name, and establish their official gender}
if npctempgsex = 0:
	! {Male}
	gs 'npcrnamefile', 'rusMale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 0
	npc_spermpot[$npclastgenerated] = 10000
	$npc_thdick[$npclastgenerated] = $npctempgn[4]
	npc_dick[$npclastgenerated] = npctempgn[5]
	$npc_notes[$npclastgenerated] = 'A male.'
	npc_bust[$npclastgenerated] = 0
elseif npctempgsex = 1:
	! {Female}
	gs 'npcrnamefile', 'rusFemale'
	npc_gender[$npclastgenerated] = 1
	npc_spermpot[$npclastgenerated] = -1
	$npc_thdick[$npclastgenerated] = 'clitoris'
	npc_dick[$npclastgenerated] = rand(0,1)
	$npc_notes[$npclastgenerated] = 'A female.'
	!!0 - 60  curve around 22,5 (C/D cups)
	npc_bust[$npclastgenerated] = rand(0,15) + rand(0,15) + rand(0,15) & if rand(1,10) = 1: npc_bust[$npclastgenerated] += rand(0,15)
elseif npctempgsex = 2:
	! {HermFemale}
	gs 'npcrnamefile', 'rusFemale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 1
	npc_spermpot[$npclastgenerated] = -1
	$npc_thdick[$npclastgenerated] = 'clitoris'
	npc_dick[$npclastgenerated] = npctempgn[5]
	$npc_notes[$npclastgenerated] = 'A female Hermaphrodite.'
	!!0 - 60  curve around 22,5 (C/D cups)
	npc_bust[$npclastgenerated] = rand(0,15) + rand(0,15) + rand(0,15)
else
	! {HermMale}
	gs 'npcrnamefile', 'rusMale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 0
	npc_spermpot[$npclastgenerated] = 10000
	$npc_thdick[$npclastgenerated] = $npctempgn[4]
	npc_dick[$npclastgenerated] = npctempgn[5]
	$npc_notes[$npclastgenerated] = 'A male Hermaphrodite.'
	npc_bust[$npclastgenerated]= rand(0,10)
end

! {Then we set the names, and the stat high ends as determined earlier.}
gs 'npcrnamefile', 'rusSur'
$npc_firstname[$npclastgenerated] = $npctempgn[1]
$npc_nickname[$npclastgenerated] = $npctempgn[2]
$npc_lastname[$npclastgenerated] = $npctempgn[3]
$npc_usedname[$npclastgenerated] = $npctempgn[0]
npc_intel[$npclastgenerated] = rand(1,npctempc2)

! {Then we call out other stats}
npc_drunk[$npclastgenerated] = 0

! {NPCs start with random horniness}
npc_horny[$npclastgenerated] = rand(0,60)

! {Random attractiveness}
npc_apprnc[$npclastgenerated] = rand(30,60)

! {Random skin quality and body hair}
npc_height[$npclastgenerated] = 0

! {Random pubic hair}
npc_haircol[$npclastgenerated] = 0

! {Starting at 0 quest state and love for the character, and slightly disliked.}
npc_QW[$npclastgenerated]= 0
npc_rel[$npclastgenerated] = 40
npc_love[$npclastgenerated] = 0

! {Start unemployed and unspecified location}
npc_occupation[$npclastgenerated] = 0
npc_outfit[$npclastgenerated] = 0

! {Unspecified dad and <<$npc_nickname[''A29'']>>, and picture. We could have a stock group of pictures and have it pick based on certain attribute types, but...}
$npc_pic[$npclastgenerated] = 'xPICx'

! {STDs are not randomly given here. For characters with a STD, you need to gs npcgenext rstd. It will be expecting an npclastgeneratedn variable.}
npc_herpes[$npclastgenerated] = 0
npc_syth[$npclastgenerated] = 0
npc_gon[$npclastgenerated] = 0
npc_thrush[$npclastgenerated] = 0

npc_sex[$npclastgenerated] = 0
npc_perv[$npclastgenerated] = 0

! {Personality is called up}
gs 'npcgenext', 'pers'
$npc_perstype[$npclastgenerated] = $npctempgn[6]

! {Creating the DNA of the character. If it is someone specific, like father, mother, daughter, sone, etc. then should be overwritten.}
$npc_dna[$npclastgenerated] = func('DNA','create')




! npc_apt_type = 1: student dorm (only available in the city for obvious reasons)
! npc_apt_type = 2: studio apartment
! npc_apt_type = 3: one bedroom apartment (or 2 bedroom by UK/european definition, an apartment that has a separate bedroom unlike a studio)
! npc_apt_type = 4: multi-bedroom apartment with roommates
! npc_apt_type = 5: multi-bedroom apartment living alone
! npc_apt_type = 6: high rise apartment (for rich people only)
! boyfriend attributes

!! temp_location
!! 1 - Pavlovsk Residential Area
!! 2 - Student dorms in the city
!! 3 - St. Petersburg Residential Area
!! 4 - St. Petersburg City Center


	npc_residence[$npclastgenerated] = temp_location

	if temp_location = 1:
		npc_finance[$npclastgenerated] = 0
	elseif temp_location = 2:
		npc_finance[$npclastgenerated] = 0
	elseif temp_location = 3:
		npc_finance[$npclastgenerated] = rand(1,2)
	elseif temp_location = 4:
		npc_finance[$npclastgenerated] = 2
	end
	
	if npc_finance[$npclastgenerated] = 0:
		if npc_residence[$npclastgenerated] ! 1 and npc_residence[$npclastgenerated] ! 4 and npctempgage < 22:
			npc_student[$npclastgenerated] = rand(0,1)
			npc_apt_type[$npclastgenerated] = rand(1,4)
		elseif npc_residence[$npclastgenerated] = 2:
			npc_student[$npclastgenerated] = 1
			npc_apt_type[$npclastgenerated] = 2
		else
			npc_apt_type[$npclastgenerated] = rand(2,4)
		end
		npc_occupation[$npclastgenerated] = rand(1,7)
		
	elseif npc_finance[$npclastgenerated] = 1:
		npc_apt_type[$npclastgenerated] = rand(2,5)
		npc_occupation[$npclastgenerated] = rand(7,15)
	elseif npc_finance[$npclastgenerated] = 2:
		npc_apt_type[$npclastgenerated] = rand(5,6)
		npc_occupation[$npclastgenerated] = rand(14,18)
	end
	
	
!	npc_style determines generally how they dress and what their "persona" is
!	1 - "normal"
!	2 - Gopnik
!	3 - nerdy
!	4 - sporty
!	5 - fashionable
!	6 - businessman
	if npc_occupation < 15:
		npc_style[$npclastgenerated] = rand(1,5)
	else
		npc_style[$npclastgenerated] = (rand(2,6) mod 6) + 1
	end
	
	if npc_apt_type = 6:
		!! high rise
		
		!! this is to determine what their spare room is used for based on their personality type
		if npc_style = 3:
			npc_apt_spare = 1
		elseif npc_style = 2 or npc_style = 4:
			npc_apt_spare = 2
		else
			npc_apt_spare = rand(1,2)
		end
		if npc_apt_spare = 1:
			$npc_apt_spare = 'gaming'
		elseif npc_apt_spare = 2:
			$npc_apt_spare = 'gym'
		end
		npc_apt_number[$npclastgenerated] = rand(1,2)
		$npc_apt_bedroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/high_rise/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_kitchen[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/high_rise/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_livingroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/high_rise/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_bathroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/high_rise/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_hall[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/high_rise/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'		
	elseif npc_apt_type = 4 or npc_apt_type = 5:
		!! multi-bedroom
		!! npc_apt_type = 4 will one day be living with roommates but for now we''re just making it easy on ourselves. No roommates until later.
		
		!! this is to determine what their spare room is used for based on their personality type
		if npc_style = 3:
			npc_apt_spare = 1
		elseif npc_style = 2 or npc_style = 4:
			npc_apt_spare = 2
		else
			npc_apt_spare = rand(1,2)
		end
		if npc_apt_spare = 1:
			$npc_apt_spare = 'gaming'
		elseif npc_apt_spare = 2:
			$npc_apt_spare = 'gym'
		end
		
		npc_apt_number[$npclastgenerated] = rand(1,2)
		$npc_apt_bedroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_kitchen[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/kitchen.jpg"></center>'
		$npc_apt_livingroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
		$npc_apt_bathroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/bath.jpg"></center>'
		$npc_apt_hall[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
		$npc_apt_spare[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/multibedroom/<<npc_apt_number[$npclastgenerated]>>/<<$npc_apt_spare[$npclastgenerated]>>.jpg"></center>'
	elseif npc_apt_type = 3:
		!! one bedroom
		npc_apt_number[$npclastgenerated] = rand(1,3)
		$npc_apt_bedroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_kitchen[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/kitchen.jpg"></center>'
		$npc_apt_livingroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
		$npc_apt_bathroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/bath.jpg"></center>'
		$npc_apt_hall[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
	elseif npc_apt_type = 2:
		!! studio apartment
		npc_apt_number[$npclastgenerated] = rand(1,2)
		$npc_apt_bedroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_kitchen[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_livingroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_bathroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_hall[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
	elseif npc_apt_type = 1:
		!! student dorm
		npc_apt_number[$npclastgenerated] = rand(1,3)
		$npc_apt_bedroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/bedroom.jpg"></center>'
		$npc_apt_kitchen[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/kitchen.jpg"></center>'
		$npc_apt_livingroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
		$npc_apt_bathroom[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/1bedroom/<<npc_apt_number[$npclastgenerated]>>/bath.jpg"></center>'
		$npc_apt_hall[$npclastgenerated] = '<center><img <<$set_imgh>> src="images/shared/romance/lovers/homes/studio/<<npc_apt_number[$npclastgenerated]>>/living.jpg"></center>'
	end
	
!	if npc_occupation = 1: $npc_occupation = cashier at supermarket
!	if npc_occupation = 2: $npc_occupation = cashier at liquor store
!	if npc_occupation = 3: $npc_occupation = cashier at coffee shop
!	if npc_occupation = 4: $npc_occupation = barista
!	if npc_occupation = 5: $npc_occupation = cheap restaurant job
!	if npc_occupation = 6: $npc_occupation = taxi driver
!	if npc_occupation = 7: $npc_occupation = masseuse
	
!	if npc_occupation = 8: $npc_occupation = sexual masseuse
!	if npc_occupation = 9: $npc_occupation = factory job
!	if npc_occupation = 10: $npc_occupation = bartender
!	if npc_occupation = 11: $npc_occupation = mechanic
!	if npc_occupation = 12: $npc_occupation = line cook
!	if npc_occupation = 13: $npc_occupation = waiter
!	if npc_occupation = 14: $npc_occupation = personal trainer
!	if npc_occupation = 15: $npc_occupation = programmer

!	if npc_occupation = 16: $npc_occupation = businessman
!	if npc_occupation = 17: $npc_occupation = lawyer
!	if npc_occupation = 18: $npc_occupation = investment banker


	npc_humor[$npclastgenerated] = rand(0,3)
	
!! npc_fav_pos = 1: missionary
!! npc_fav_pos = 2: doggy
!! npc_fav_pos = 3: cowgirl
!! npc_fav_pos = 4: blowjobs
!! npc_fav_pos = 5: titjobs
!! npc_fav_pos = 6: 69
!! npc_fav_pos = 7: anal
	
	npc_fav_pos[$npclastgenerated] = rand(1,7)
	
	npc_cum_pref[$npclastgenerated] = rand(0,4)
 
	npc_tit_pref[$npclastgenerated] = rand(0,3)
	
	npc_bush_pref[$npclastgenerated] = rand(0,3)

	npc_style[$npclastgenerated] = rand(1,6)

	npc_smoker[$npclastgenerated] = rand(0,2)

! we will skip addit for now, have a variable just for smoking

!!	npc_addit[$npclastgenerated] = rand(0,1)

	npc_doors[$npclastgenerated] = rand(0,2)
	
	npc_goal[$npclastgenerated] = rand(1,3)
!!	npc_goal is what they want out of a relationship
!!	1 = just sex 
!!	2 = casual relationship 
!!	3 = serious relationship

	npc_fidelity[$npclastgenerated] = rand(1,10)

	npc_lover_days[$npclastgenerated] = 0

	npc_lover_keys[$npclastgenerated] = 0

	npc_residence[$npclastgenerated] = temp_location
	
!! traits

	if rand(0,2) > 0:
		if rand(0,1) = 1:
			npc_earlyriser[$npclastgenerated] = 1
			npc_latesleeper[$npclastgenerated] = 0
		else
			npc_latesleeper[$npclastgenerated] = 1
			npc_earlyriser[$npclastgenerated] = 0
		end
	end
	
	if rand(0,2) > 0:
		if rand(0,1) = 1:
			npc_generous[$npclastgenerated] = 1
			npc_selfish[$npclastgenerated] = 0
		else
			npc_selfish[$npclastgenerated] = 1
			npc_generous[$npclastgenerated] = 0
		end
	end
	
	npc_argumentative[$npclastgenerated] = rand(0,2)
	npc_competitive[$npclastgenerated] = rand(-1,1)
	npc_insecure[$npclastgenerated] = rand(-1,1)
	
	if rand(0,1) = 1:
		npc_condom_conscious[$npclastgenerated] = rand(-1,1)
	else
		npc_no_condoms[$npclastgenerated] = rand(-1,1)
	end
	
	
	npc_childfree[$npclastgenerated] = rand(-3,1)
	npc_abusive[$npclastgenerated] = rand(-3,1)
	npc_sexdrive[$npclastgenerated] = rand(1,10)
	npc_pussyeater[$npclastgenerated] = rand(-2,1)
	npc_cum_cannon[$npclastgenerated] = rand(-3,1)

! {Variables are cleaned up.}
killvar '$npctempgn'
killvar 'npctempc1'
killvar 'npctempc2'
killvar 'npctempgsex'
killvar '$npctempgn'
killvar 'npctempgage'
killvar '$npctemparrc'
killvar 'temp_location'

--- npcgeneratec ---------------------------------

