Jump to content

Global Var Comparison


darthbdaman

Recommended Posts

I have been trying to adjust a bunch of leveled lists based on the states of various Global Vars. All of the globals are shorts. I have gotten the actual replacement part working, however the comparison between the global var and the number isn't working.

 

All of the NPC's spawn with the prostitute outfit, which is what happens if none if the variable comparisons return true. I assume it's something wrong with how I am trying to compare to the variable.

 

Any help would be appreciated,

 

Thanks

scn PADOTiersQuestScript

ref rObject

ref rTier
ref rTierHelmet
ref rTierLyons

int iTierPos

ref rTierVar 

int sVarInit

int sBosTier1Var
int sBosTier2Var
int sBosTier3Var
int sBosTier4Var
int sEnclaveTier1Var
int sEnclaveTier3Var
int sEnclaveTier2Var
int sEnclaveTier4Var
int sOutcastTier1Var
int sOutcastTier2Var
int sOutcastTier3Var
int sOutcastTier4Var

array_var aTierBos
array_var aTierOutcast
array_var aTierEnclave

array_var Entry

array_var aTierBosArmor
array_var aTierBosHelmet
array_var aTierLyonsArmor
array_var aTierOutcastArmor
array_var aTierOutcastHelmet
array_var aTierEnclaveArmor
array_var aTierEnclaveHelmet

Begin GameMode

	if(GetGameLoaded || GetGameRestarted)

		ar_erase aTierBos
		ar_erase aTierOutcast
		ar_erase aTierEnclave

		ar_erase aTierBosArmor
		ar_erase aTierBosHelmet
		ar_erase aTierLyonsArmor
		ar_erase aTierOutcastArmor
		ar_erase aTierOutcastHelmet
		ar_erase aTierEnclaveArmor
		ar_erase aTierEnclaveHelmet

		let aTierBos := Ar_List sBosTier1Var, sBosTier2Var, sBosTier3Var, sBosTier4Var
		let aTierOutcast := Ar_List sOutcastTier1Var, sOutcastTier2Var, sOutcastTier3Var, sOutcastTier4Var
		let aTierEnclave := Ar_List sEnclaveTier1Var, sEnclaveTier2Var, sEnclaveTier3Var, sEnclaveTier4Var

		let aTierBosArmor := Ar_List PADOBosTier1, PADOBosTier2, PADOBosTier3, PADOBosTier4
		let aTierBosHelmet := Ar_List PADOBosTier1Helmet, PADOBosTier2Helmet, PADOBosTier3Helmet, PADOBosTier4Helmet
		let aTierLyonsArmor := Ar_List PADOLyonsTier1, PADOLyonsTier2, PADOLyonsTier3, PADOLyonsTier4
		let aTierOutcastArmor := Ar_List PADOOutcastTier1, PADOOutcastTier2, PADOOutcastTier3, PADOOutcastTier4
		let aTierOutcastHelmet := Ar_List PADOOutcastTier1Helmet, PADOOutcastTier2Helmet, PADOOutcastTier3Helmet, PADOOutcastTier4Helmet
		let aTierEnclaveArmor := Ar_List PADOEnclaveTier1, PADOEnclaveTier2, PADOEnclaveTier3, PADOEnclaveTier4
		let aTierEnclaveHelmet := Ar_List PADOEnclaveTier1Helmet, PADOEnclaveTier2Helmet, PADOEnclaveTier3Helmet, PADOEnclaveTier4Helmet

	endif	

	if sVarInit == 0

		let PADOTiersQuest.sBOSTier1Var := 2
		let PADOTiersQuest.sBOSTier2Var := 3
		let PADOTiersQuest.sBOSTier3Var := 4
		let PADOTiersQuest.sBOSTier4Var := 5
		let PADOTiersQuest.sOutcastTier1Var := 1
		let PADOTiersQuest.sOutcastTier2Var := 3
		let PADOTiersQuest.sOutcastTier3Var := 4
		let PADOTiersQuest.sOutcastTier4Var := 5
		let PADOTiersQuest.sEnclaveTier1Var := 1
		let PADOTiersQuest.sEnclaveTier2Var := 2
		let PADOTiersQuest.sEnclaveTier3Var := 3
		let PADOTiersQuest.sEnclaveTier4Var := 4

		let sVarInit := 1

	endif

;BOS 

	foreach Entry <- aTierBos

	let rTierVar := Entry["value"]
	let iTierPos := Entry["key"]

	let rTier := aTierBosArmor[iTierPos]
	let rTierHelmet := aTierBosHelmet[iTierPos]
	let rTierLyons := aTierLyonsArmor[iTierPos]

	LeveledListClear rTier
	LeveledListClear rTierHelmet 
	LeveledListClear rTierLyons 

	if rTierVar == 1
		LeveledListAddForm rTier PADOTiersBOSRecon 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersBOSReconHelmet 1 1 1
		LeveledListAddForm rTierLyons PADOTiersLyonsRecon 1 1 1
	elseif rTierVar == 2
		LeveledListAddForm rTier PADOTiersBOSCombat 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersBOSCombatHelmet 1 1 1
		LeveledListAddForm rTierLyons PADOTiersBOSCombat 1 1 1
	elseif rTierVar == 3
		LeveledListAddForm rTier PADOTiersBOST45D 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersBOST45DHelmet 1 1 1
		LeveledListAddForm rTierLyons PADOTiersLyonsT45D 1 1 1
	elseif rTierVar == 4
		LeveledListAddForm rTier PADOTiersBOST51B 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersBOST51BHelmet 1 1 1
		LeveledListAddForm rTierLyons PADOTiersLyonsT51B 1 1 1
	elseif rTierVar == 5
		LeveledListAddForm rTier PADOTiersBOST60C 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersBOST60CHelmet 1 1 1
		LeveledListAddForm rTierLyons PADOTiersLyonsT60C 1 1 1
	else
		LeveledListAddForm rTier OutfitProstitute01 1 1 1
	endif

	loop

;Outcast

	foreach Entry <- aTierOutcast

	let rTierVar := Entry["value"]
	let iTierPos := Entry["key"]

	let rTier := aTierOutcastArmor[iTierPos]
	let rTierHelmet := aTierOutcastHelmet[iTierPos]

	LeveledListClear rTier
	LeveledListClear rTierHelmet 

	if rTierVar == 1
		LeveledListAddForm rTier PADOTiersOutcastRecon 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersOutcastReconHelmet 1 1 1
	elseif rTierVar == 2
		LeveledListAddForm rTier PADOTiersOutcastCombat 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersOutcastCombatHelmet 1 1 1
	elseif rTierVar == 3
		LeveledListAddForm rTier PADOTiersOutcastT45D 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersOutcastT45DHelmet 1 1 1
	elseif rTierVar == 4
		LeveledListAddForm rTier PADOTiersOutcastT51B 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersOutcastT51BHelmet 1 1 1
	elseif rTierVar == 5
		LeveledListAddForm rTier PADOTiersOutcastT60C 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersOutcastT60CHelmet 1 1 1
	else
		LeveledListAddForm rTier OutfitProstitute01 1 1 1
	endif

	loop

;Enclave

	foreach Entry <- aTierEnclave

	let rTierVar := Entry["value"]
	let iTierPos := Entry["key"]

	let rTier := aTierEnclaveArmor[iTierPos]
	let rTierHelmet := aTierEnclaveHelmet[iTierPos]

	LeveledListClear rTier
	LeveledListClear rTierHelmet 

	if rTierVar == 1
		LeveledListAddForm rTier PADOTiersEnclaveMk1 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveMk1Helmet 1 1 1
	elseif rTierVar == 2
		LeveledListAddForm rTier PADOTiersEnclaveMk1Tesla 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveMk1TeslaHelmet 1 1 1
	elseif rTierVar == 3
		LeveledListAddForm rTier PADOTiersEnclaveMk2 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveMk2Helmet 1 1 1
	elseif rTierVar == 4
		LeveledListAddForm rTier PADOTiersEnclaveMk2Tesla 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveMk2TeslaHelmet 1 1 1
	elseif rTierVar == 5
		LeveledListAddForm rTier PADOTiersEnclaveHellfire 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveHellfireHelmet 1 1 1
	elseif rTierVar == 6
		LeveledListAddForm rTier PADOTiersEnclaveReson 1 1 1
		LeveledListAddForm rTierHelmet PADOTiersEnclaveResonHelmet 1 1 1
	else
		LeveledListAddForm rTier OutfitProstitute01 1 1 1
	endif

	loop

end
Link to comment
Share on other sites

Careful with GetGameLoaded and building arrays, should destroy them first or it may make array bloat. You probably only need to build them once when the game is initially started.

 

Also I believe there is list to array functions in Lutana or JIP.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...