# 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.}
!! {A example to use this would be gs 'npcgeneratec', 0, 'stranger', rand(18,45) which would generate a male with a use name of stranger between 18 and 45.}

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


!! {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

! {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]

! {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_firstpart[$npclastgenerated] = 'U'
	$npc_lastpart[$npclastgenerated] = 'U'
	$npc_kidpater[$npclastgenerated] = 'N'
else
	$npc_firstpart[$npclastgenerated] = 'V'
	$npc_lastpart[$npclastgenerated] = 'V'
	$npc_kidpater[$npclastgenerated] = 'N'
	npc_sexskill[$npclastgenerated] = 0
end


! {Then we need to give it a name, and establish it''s official gender}
if npctempgsex = 0:
	! {Male}
	gs 'npcrnamefile', 'rusMale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 0
	npc_cyc[$npclastgenerated] = -1
	npc_fert[$npclastgenerated] = -1
	npc_spermpot[$npclastgenerated] = 10000
	$npc_thdick[$npclastgenerated] = $npctempgn[4]
	npc_dick[$npclastgenerated] = npctempgn[5]
	$npc_notes[$npclastgenerated] = 'A male.'
	npc_bust[$npclastgenerated] = 0
	npc_nips[$npclastgenerated] = 1
	if npctempc2[1] >= 20:
		npc_hymen[$npclastgenerated] = -1
	end
elseif npctempgsex = 1:
	! {Female}
	gs 'npcrnamefile', 'rusFemale'
	npc_gender[$npclastgenerated] = 1
	npc_cyc[$npclastgenerated] = rand(0,29)
	npc_fert[$npclastgenerated] = 1
	npc_spermpot[$npclastgenerated] = -1
	$npc_thdick[$npclastgenerated] = 'clitoris'
	npc_dick[$npclastgenerated] = rand(0,1)
	$npc_notes[$npclastgenerated] = 'A female.'
	npc_bust[$npclastgenerated]= rand(1,12)
	npc_nips[$npclastgenerated] = rand(2,6)
	if npctempc2[1] >= 20:
		npc_hymen[$npclastgenerated] = rand(4,6)
	else
		npc_hymen[$npclastgenerated] = 0
	end
elseif npctempgsex = 2:
	! {HermFemale}
	gs 'npcrnamefile', 'rusFemale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 1
	npc_cyc[$npclastgenerated] = rand(0,29)
	npc_fert[$npclastgenerated] = 1
	npc_spermpot[$npclastgenerated] = -1
	$npc_thdick[$npclastgenerated] = 'clitoris'
	npc_dick[$npclastgenerated] = npctempgn[5]
	$npc_notes[$npclastgenerated] = 'A female Hermaphrodite.'
	npc_bust[$npclastgenerated]= rand(1,10)
	npc_nips[$npclastgenerated] = rand(1,5)
	if npctempc2[1] >= 20:
		npc_hymen[$npclastgenerated] = rand(0,6)
		if npc_hymen[$npclastgenerated] < 4 and npc_hymen[$npclastgenerated] > 0: npc_hymen[$npclastgenerated] = 4
	else
		npc_hymen[$npclastgenerated] = 0
	end
else
	! {HermMale}
	gs 'npcrnamefile', 'rusMale'
	gs 'npcgenext', 'dick'
	npc_gender[$npclastgenerated] = 0
	npc_cyc[$npclastgenerated] = -1
	npc_fert[$npclastgenerated] = -1
	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,1)
	npc_nips[$npclastgenerated] = rand(1,3)
	if npctempc2[1] >= 20:
		npc_hymen[$npclastgenerated] = rand(0,6)
		if npc_hymen[$npclastgenerated] < 4 and npc_hymen[$npclastgenerated] > 0: npc_hymen[$npclastgenerated] = 4
	else
		npc_hymen[$npclastgenerated] = 0
	end
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_vit[$npclastgenerated] = rand(1,npctempc2)
npc_str[$npclastgenerated] = rand(1,npctempc2)
npc_int[$npclastgenerated] = rand(1,npctempc2)
npc_agil[$npclastgenerated] = rand(1,npctempc2)
npc_spirit[$npclastgenerated] = rand(1,npctempc2)

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

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

! {Random attractiveness}
npc_app[$npclastgenerated] = rand(30,60)
npc_lipstick[$npclastgenerated] = 0
npc_makeup[$npclastgenerated] = 0
npc_sweat[$npclastgenerated] = 0
npc_dye[$npclastgenerated] = 0
npc_hair[$npclastgenerated] = 0

! {Random skin quality and body hair}
npc_skin[$npclastgenerated] = rand(30,70)
npc_bodyhair[$npclastgenerated] = rand(0,4)
npc_breath[$npclastgenerated] = 0
npc_hipcurv[$npclastgenerated]  = 0
npc_hgt[$npclastgenerated] = 0
npc_fat[$npclastgenerated] = 0

! {Random pubic hair}
npc_pubes[$npclastgenerated] = rand(0,1)
npc_hairlng[$npclastgenerated] = 0
npc_haircol[$npclastgenerated] = 0
npc_haircurl[$npclastgenerated] = 0
npc_tan[$npclastgenerated] = 0
npc_lip[$npclastgenerated] = 0
npc_lashes[$npclastgenerated] = 0
npc_eyesize[$npclastgenerated] = 0
npc_eyecol[$npclastgenerated] = 0
npc_dom[$npclastgenerated] = 0
npc_sub[$npclastgenerated] = 0

! {Random glasses, grades, and other skills, based on age established above.}
npc_glasses[$npclastgenerated] = rand(0,1)
npc_grades[$npclastgenerated] = rand(40,100)
npc_run[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_vball[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_nerd[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_shoot[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_sew[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_serve[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_chess[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_dnc[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_erodnc[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_jab[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_punch[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_kick[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_def[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_sing[$npclastgenerated] = rand(0,(npctempc2 + 10))
npc_teach[$npclastgenerated] = rand(0,(npctempc2 + 10))

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

! {Start unemployed and unspecified location}
npc_job[$npclastgenerated] = 0
npc_cloc[$npclastgenerated] = 0

! {Unspecified dad and mom, and picture. We could have a stock group of pictures and have it pick based on certain attribute types, but...}
$npc_dad[$npclastgenerated] = 'U'
$npc_mom[$npclastgenerated] = 'U'
$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_syph[$npclastgenerated] = 0
npc_gon[$npclastgenerated] = 0
npc_chlam[$npclastgenerated] = 0
npc_Hiv[$npclastgenerated] = 0
npc_genwart[$npclastgenerated] = 0
npc_Thrush[$npclastgenerated] = 0
npc_Malen[$npclastgenerated] = 0

! {Chemestry and clothing preference are unspecified}
npc_Chem[$npclastgenerated] = 0
npc_Clothpref[$npclastgenerated] = 0

! {Personality is called up}
gs 'npcgenext', 'pers'
$npc_PersType[$npclastgenerated] = $npctempgn[6]
npclastgeneratedn = mid($npclastgenerated, 2)

! {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')

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

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

