Jump to content

Fallout New Vegas GECK & Scripting Help 101


Recommended Posts

Posted

Question for the more mathematically inclined:

 

I literally only just found out that if you let an int to a float, you'll get the floor of the float. What I want instead is the float rounded up or down according to regular rounding methods (eg the ceil if the float is  >= .5 , the floor if < .5). How do I go about doing that in as few lines as possible?

Damn hadn't realised that myself, I assume it's the same with Set too?

 

let i := f + 0.5

LOL, yeah I would have screwed around with testing on Excel spreadsheets to work out a more complex way of doing that :)
Posted

Yeah, figures banks would have their 'own' way of rounding numbers and then convince people it's regular rounding. :sleepy:

Haha well it's actually more fair that way. There's an imbalance if you just keep rounding halves upward and never downward, so that system rounds half of them up, and the other half down.

Posted

It seems this Powered Power Armor mod is a lot tougher than I anticipated. I may have chosen something that might be way more complicated for my current understanding of programming. Nonetheless, I believe I have three main issues to tackle in order to get somewhere with this mod. 

 

First, the initialization script, which was like this on the old mod: 

 

 

 

scn PPAPAInitQuestScript

short sAPACapAdapter
short sAPAMFExp
short sEPG
short sLCLower
short sLCUpper
short sNinja
short sNTI
short sPPCLower
short sPPCUpper
short sProx
short sROC
short sStimJak
short sT45dMFExp
short sT51bCapAdapter
short sT51bMFExp
short sTRO
short sHydraulics

float fSoundWait
float fWarnTimer
float fInstallTimer

float fAlpha

float fAlphaTimer1
float fAlphaTimer2
float fAlphaTimer3

float fPowerDownTimer

ref rArmor

short sPAEquipped
short sChargeState
short sTROState

float fAlphaTime
float fSoundTime
float fFadeTime
short sCalibrating

short sIndicator1
short sIndicator2
short sIndicator3

float fHealthPercentage
float fConditionTimer
ref rHelmet

begin gamemode
	getsecondspassed

	IF fAlphaTime != 4 || fSoundTime != 1.5 || fFadeTime != 2
		set fAlphaTime to 4
		set fSoundTime to 1.5
		set fFadeTime to 2
	ENDif

	IF fAlphaTimer1 > 0
		set fAlphaTimer1 to fAlphaTimer1 - getsecondspassed
		IF fAlphaTimer1 < fFadeTime && fAlphaTimer1 > 0
			set fAlpha to fAlphaTimer1 / fFadeTime
			setuifloat "HudMainMenu\_PPAInitImage1AlphaMult" fAlpha
			setuifloat "HudMainMenu\_PPAInitImage1Alert" 0
		ELSEif sIndicator1
			setuifloat "HudMainMenu\_PPAInitImage1Alert" 0
		ELSE
			setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
		ENDif
	ELSE
		setuifloat "HudMainMenu\_PPAInitImage1AlphaMult" 0
		set sIndicator1 to 0
	ENDif

	IF fAlphaTimer2 > 0
		set fAlphaTimer2 to fAlphaTimer2 - getsecondspassed
		IF fAlphaTimer2 < fFadeTime && fAlphaTimer2 > 0
			set fAlpha to fAlphaTimer2 / fFadeTime
			setuifloat "HudMainMenu\_PPAInitImage2AlphaMult" fAlpha
			setuifloat "HudMainMenu\_PPAInitImage2Alert" 0
		ELSEif sIndicator2
			setuifloat "HudMainMenu\_PPAInitImage2Alert" 0
		ELSE
			setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
		ENDif
	ELSE
		setuifloat "HudMainMenu\_PPAInitImage2AlphaMult" 0
		set sIndicator2 to 0
	ENDif

	IF fAlphaTimer3 > 0
		set fAlphaTimer3 to fAlphaTimer3 - getsecondspassed
		IF fAlphaTimer3 < fFadeTime && fAlphaTimer3 > 0
			set fAlpha to fAlphaTimer3 / fFadeTime
			setuifloat "HudMainMenu\_PPAInitImage3AlphaMult" fAlpha
			setuifloat "HudMainMenu\_PPAInitImage3Alert" 0
		ELSEif sIndicator3
			setuifloat "HudMainMenu\_PPAInitImage3Alert" 0
		ELSE
			setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
		ENDif
	ELSE
		setuifloat "HudMainMenu\_PPAInitImage3AlphaMult" 0
		set sIndicator3 to 0
	ENDif

	IF sCalibrating
		setuistring "HudMainMenu\_PPAInitTextFile" "PPA\Icons\PPA_Text_CSE.dds"
		setuifloat "HudMainMenu\_PPAInitTextAlphaMult" 1
	ELSEif fPowerDownTimer > 0
		set fPowerDownTimer to fPowerDownTimer - getsecondspassed
		setuistring "HudMainMenu\_PPAInitTextFile" "PPA\Icons\PPA_Text_SS.dds"
		setuifloat "HudMainMenu\_PPAInitTextAlphaMult" 1
	ELSEif sPAEquipped == 0
		setuifloat "HudMainMenu\_PPAInitTextAlphaMult" 0
	ENDif

	IF fSoundWait > 0
		set fSoundWait to fSoundWait - getsecondspassed
		return
	ENDif

	set rArmor to player.getequippedobject 2
	IF isPowerArmor rArmor

		;_________
		; power armor just equipped
		;_________
		IF sPAEquipped == 0
			set sPAEquipped to 1
			setuistring "HudMainMenu\_PPAInitTextFile" "PPA\Icons\PPA_Text_IA.dds"
			setuifloat "HudMainMenu\_PPAInitTextAlphaMult" 1
			set PPASound.sPlayInitializing to 1
			IF PPAThermalOverride
				set sTROState to 1
			ELSE
				set sTROState to 0
			ENDif
			set fSoundWait to 3
			return
		ELSEif fAlphaTimer1 <= 0 && fAlphaTimer2 <= 0 && fAlphaTimer3 <= 0
			setuifloat "HudMainMenu\_PPAInitTextAlphaMult" 0
		ENDif

		;_________
		; TRO status change
		;_________
		IF PPAThermalOverride
			IF sTROState == 0
				set sTROState to 1
				playsound PPADeepAlert
				return
			ENDif
		ELSEif sTROState
			set sTROState to 0
			playsound PPADeepAlert
			return
		ENDif

		;_________
		; report charge status
		;_________
		IF PPACharge == 0
			IF sChargeState != 3
				set sChargeState to 3
				set PPASound.sPlayChargeDepleted to 1
				set fSoundWait to 3
				return
			ENDif
		ELSEif PPACharge < 30000 && PPAMain.sUsesCharge
			IF sChargeState != 2
				set sChargeState to 2
				set fWarnTimer to 30
				set PPASound.sPlayChargeCritical to 1
				set fSoundWait to 3
				return
			ELSE
				IF fWarnTimer > 0
					set fWarnTimer to fWarnTimer - getsecondspassed
				ELSE
					set sChargeState to 1
				ENDif
			ENDif
		ELSE
			set sChargeState to 0
			set fWarnTimer to 0
		ENDif			

		;___________
		; report armor and helmet condition
		;___________
		IF PPACharge
			IF fConditionTimer > 0
				set fConditionTimer to fConditionTimer - getsecondspassed
			ELSE
				set fHealthPercentage to player.getequippedcurrenthealth 2
				set fHealthPercentage to fHealthPercentage / gethealth rArmor
				IF fHealthPercentage < 0.2
					set PPASound.sPlayArmorCondition to 1
					set fConditionTimer to 30
				ENDif
				set rHelmet to player.getequippedobject 0
				IF isPowerArmor rHelmet
					set fHealthPercentage to player.getequippedcurrenthealth 0
					set fHealthPercentage to fHealthPercentage / gethealth rHelmet
					IF fHealthPercentage < 0.2
						set PPASound.sPlayHelmetCondition to 1
						set fConditionTimer to 30
					ENDif
				ENDif
			ENDif
		ENDif
			

		;_________
		; report upgrades
		;_________
		IF sAPACapAdapter == 1		; 1
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sAPACapAdapter to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sAPAMFExp == 1		; 2
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
			ELSE
				set sAPAMFExp to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sEPG == 1		; 3
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sEPG to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_EPG.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_EPG.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_EPG.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sLCLower == 1		; 4
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sLCLower to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_LCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_LCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_LCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sLCUpper == 1		; 5
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sLCUpper to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_LCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_LCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_LCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sNinja == 1		; 6
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sNinja to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_Ninja.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_Ninja.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_Ninja.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sNTI == 1			; 7
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sNTI to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_NTI.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_NTI.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_NTI.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sPPCLower == 1		; 8
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sPPCLower to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_PPCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_PPCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_PPCL.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sPPCUpper == 1		; 9
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sPPCUpper to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_PPCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_PPCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_PPCU.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sProx == 1		; 10
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sProx to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_Prox.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_Prox.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_Prox.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sROC == 1			; 11
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sROC to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_ROC.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_ROC.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_ROC.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sStimJak == 1		; 12
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sStimJak to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_StimJak.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_StimJak.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_StimJak.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sT45dMFExp == 1		; 13
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sT45dMFExp to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sT51bCapAdapter == 1		; 14
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sT51bCapAdapter to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_Cap.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sT51bMFExp == 1		; 15
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sT51bMFExp to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_MFExp.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sTRO == 1			; 16
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sTRO to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_TRO.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_TRO.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_TRO.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif
		ELSEif sHydraulics == 1			; 17
			IF fInstallTimer <= 0
				set PPASound.sPlayOptimizing to 1
				set fInstallTimer to 30
				set sCalibrating to 1
				set fSoundWait to fSoundTime 
			ELSE
				set sHydraulics to 0
				playsound PPASteppedBeep
				set fInstallTimer to 30
				set fSoundWait to fSoundTime 
				IF fAlphaTimer1 <= 0
					setuifloat "HudMainMenu\_PPAInitImage1Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage1File" "PPA\Icons\PPA_Pic_Hydraulics.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage1AlphaMult" 1
					set fAlphaTimer1 to fAlphaTime
				ELSEif fAlphaTimer2 <= 0
					setuifloat "HudMainMenu\_PPAInitImage2Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage2File" "PPA\Icons\PPA_Pic_Hydraulics.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage2AlphaMult" 1
					set fAlphaTimer2 to fAlphaTime
				ELSE
					setuifloat "HudMainMenu\_PPAInitImage3Alert" 1
					SetUIString "HudMainMenu\_PPAInitImage3File" "PPA\Icons\PPA_Pic_Hydraulics.dds"
					SetUIFloat "HudMainMenu\_PPAInitImage3AlphaMult" 1
					set fAlphaTimer3 to fAlphaTime
				ENDif
			ENDif				
		ELSE
			set sCalibrating to 0
		ENDif
	ELSEif sPAEquipped
		set PPASound.sPlayShuttingDown to 1
		set fPowerDownTimer to 3
		set sPAEquipped to 0
		set fInstallTimer to 0
		set sCalibrating to 0

		set sAPACapAdapter to 0
		set sAPAMFExp to 0
		set sEPG to 0
		set sLCLower to 0
		set sLCUpper to 0
		set sNinja to 0
		set sNTI to 0
		set sPPCLower to 0
		set sPPCUpper to 0
		set sProx to 0
		set sROC to 0
		set sStimJak to 0
		set sT45dMFExp to 0
		set sT51bCapAdapter to 0
		set sT51bMFExp to 0
		set sTRO to 0
	ENDif

end 

 

 

 

The first thing that came to me when rewriting this was to do it through stages, but before that checking that the player is wearing power armor, if he doesn't then the script ends there. What the old script did, was to start the whole HUD icon sequence, along with all the sounds that came with it. It checks if the player is using any Power Armor mods, adds them to the HUD if they have anything to do with it and displays each particular icon associated with the armor mod on the HUD as well. What I'd do in the first stage, is to display everything that doesn't include the armor mods, I'd check for the mods in the second stage, unfortunately, each mod is unique in the way that all of them have their own icon, their own abilities, etc. I wanted to iterate over an array with the player's mods, and just add them like that, but it cannot be done that way since everything has its own thing. 

 

Onto the second problem, which is that the mods themselves are misc items when the player is not wearing power armor, I want that gone, and I want to just have them as armor items that can be equipped whenever the player decides to do so, instead of having the mod equip anything the player has on him. I don't suppose its possible to make items non-equipable unless wearing power armor, which is the reason I believe the previous author had them as misc items when not using power armor. 

 

Finally, making it work for NPCs, I mean sure you can set hot keys as the player, to use some of these abilities, but how would I go about making an NPC use these mods? As far as I'm aware when I added the items to some of the Power Armor wearing NPCs in New Vegas, they did nothing with them and I don't ever remember seeing any NPC every using them with the old mod either. 

 

Guest tomm434
Posted
I don't suppose its possible to make items non-equipable unless wearing power armor, which is the reason I believe the previous author had them as misc items when not using power armor.

Why? Vanilla Power armor script automaticly drops power armor from companions's inventory. But there is also unequip command.

 

Try

 

 

begin OnEquiop

 

   if Player is not wearing power armor

      unequipitem  ItemID 0 1

   endif

 

end

 

 

 

 

 

Posted

That will do, but it will have to be done for every power armor mod, although I don't care about that much, especially because it solves another of my problems, which is making it work with the UI, I'll just add another If to that OnEquip in order to get it to detect if the player is wearing power armor and as such initiate all the UI stuff. 

Guest tomm434
Posted

That will do, but it will have to be done for every power armor mod, although I don't care about that much, especially because it solves another of my problems, which is making it work with the UI, I'll just add another If to that OnEquip in order to get it to detect if the player is wearing power armor and as such initiate all the UI stuff. 

 

On the other hand yes, you shoudn't be worrying about other power armor mods. That's like having Sexual innuendo and Sexout at the same time and try to get them working together.

Posted

 

That will do, but it will have to be done for every power armor mod, although I don't care about that much, especially because it solves another of my problems, which is making it work with the UI, I'll just add another If to that OnEquip in order to get it to detect if the player is wearing power armor and as such initiate all the UI stuff. 

 

On the other hand yes, you shoudn't be worrying about other power armor mods. That's like having Sexual innuendo and Sexout at the same time and try to get them working together.

 

 

Not the type of mods I was referring to. I'm referring to mods as in weapon mods in game except they're for power armor, I've been meaning to find another way to address them but I can't find any. I'm talking about things like a long barrel except that its for power armor itself, think of an electromagnetic pulse  generator for example. One of the main features of this mod is that, having the ability to add power armor mods to power armor. These are misc items when not being used with power armor, which I want gone, no need for that as long as I can make the player not able to equip them without power armor. 

 

Other mods I'm not worried about, I already have that under control,  in fact the old mod did already. It classed other power armors in a certain type, and adding those mods to NPCs depends on if they're wearing power armor or not. 

Posted

Gotta little problem trying to make something appear on the HUD. After finally making a script that functions properly to initialize power armor, I'm still not getting it to display the image it should display on the HUD. I checked everything, from the texture to the XML to see if something was missing, I think nothing is wrong. I do use uHUD, and I suspect that might be causing the issue, but I'm not using anything but my mod, the DLC and FNV's esm. 

 

Anyway here's what I wrote: 

 

 

 

scn PPAPowerArmorInitialization

ref refArmor
int bPowerArmor
int bQuestStatus

Begin GameMode 

	Let refArmor := player.GetEquippedObject 2
	Let bPowerArmor := IsPowerArmor refArmor 
	Let bQuestStatus := GetQuestRunning PPAPAQuest
	
	If (bPowerArmor == 1 && bQuestStatus == 0)
		StartQuest PPAPAQuest 
		SetUIString "HudMainMenu\_PPAInitTextFile" "PPA\Icons\PPA_Text_IA"
		SetUIFloat  "HudMainMenu\_PPAInitTextAlphaMult" 1
		Let PPASound.bPlayInitializing := 1
	ElseIf(bPowerArmor == 0 && bQuestStatus == 1)
		StopQuest PPAPAQuest
		Let PPASound.bPlayShuttingDown := 1
	EndIf 
End 

 

 

 

I'm still not very sure what SetUIString and SetUIFloat are supposed to do. From what I gathered from the MCM guide, SetUIFloat makes things visible and invisible, SetUIString, sets a string into the XML as it appears. 

Posted

Side comment:

 

    Let refArmor := player.GetEquippedObject 2

 

'Player' is a base form, not a reference. You mean:

 

    .. PlayerREF.GetEquippedObject 2

 

--

 

Often using 'player' when you mean 'playerREF' works due to some unknown engine mechanic, but sometimes it will correctly fail.

Guest tomm434
Posted

Side comment:

 

    Let refArmor := player.GetEquippedObject 2

 

'Player' is a base form, not a reference. You mean:

 

    .. PlayerREF.GetEquippedObject 2

 

--

 

Often using 'player' when you mean 'playerREF' works due to some unknown engine mechanic, but sometimes it will correctly fail.

 

Interesting.. Thanks for the info. But player is not ordinary reference. I mean that if you type "player.placeatme 7 1" and "player.placeatme 14 1" it will spawn player clone in both cases and techically these two references are different (000007 and 000014).

Posted

It's mostly the NVSE stuff that cares about the difference. The built in scripting stuff in the geck doesn't, and neither does the console, but NVSE doesn't do the 'magic' conversion of player to playerRef when appropriate. Best to just use the correct one for the situation.

Posted

From jaam a few pages back:

 

player is supposed to be a baseForm and playerRef a ref. For reasons I don't understand, vanilla replace player by playerRef pretty much anywhere so you almost cannot "reference" the player object (formID 7). NVSE will translate player as the NPC_ except where a baseForm cannot be used in which case it will be translated to playerRef.

 

Anyway it's better to explicitly use playerRef when you mean playerRef :)

Posted

Side comment:

 

    Let refArmor := player.GetEquippedObject 2

 

'Player' is a base form, not a reference. You mean:

 

    .. PlayerREF.GetEquippedObject 2

 

--

 

Often using 'player' when you mean 'playerREF' works due to some unknown engine mechanic, but sometimes it will correctly fail.

 

I didn't know that, but it is working though, with the exception that it doesn't want to show text on the HUD which is strange, because the sound is playing and that is supposed to happen after that. I can only assume that it is not finding that line on the XML or the texture is missing or something but I already checked and neither of those are missing. 

Posted

OOOK. Companion question! :angel:

 

For my little captured sessions it would be lovely to be able to tell all companions to shut up and wait. Otherwise you get stupid stuff like companions in the way of animations and such. This is no trouble with vanilla companions (or vanilla NPCs turned into companions) but it gets annoying with mod-added companions.

 

Is there a way to optionally set the variable "Waiting" for a reference if it exists?

 

The simplified version of the plan would have been something like:

 

 

ref rPotentialRef 

        Label 10
            set rPotentialRef to GetFirstRef 200 0
            if rPotentialRef.GetPlayerTeammate == 1 && rPotentialRef.GetDead == 0
                let rPotentialRef.Waiting := 1 // Here we have the issue darn it! :-(
            endif
            
            set rPotentialRef to Pencil01   // Why is this even here? :-)
            set rPotentialRef to GetNextRef  
        GoTo 10

 

 

 

Any way to check if the "Waiting" variable exists, and if so, set it, then move on?

 

If there's no way around this, how would one tell a mod-added companion to wait without adding the mod as a master? Specifically Brisa and Willow?  Both of those companions do have a "Waiting" variable just waiting for my scripts to somehow tell them to stuff it er.. sit there.

 

I suppose I could put together 3 patches that have Brisa or Willow as masters. But more esp's is a pain with TTW. And I don't like the idea of having 3 separate main esp's depending on which companion is loaded. Ugh! :dodgy:

 

Any thoughts or suggestions on all of this? :cool:

Posted

Well it's about all you've got I think. There's nothing to check to see if a form has a given property, though NVSE or NX could probably cook up such a function. Top that with no exception handling of every kind so you can't just blindly try it and.. well yeah.

 

Even if they both had the var in a quest, even with the same name, it's the offset that counts (which var declaration in the script it is), not the name, so there's just no way to get there from here without making them all masters.

 

Restrained might be a bludgeon but it works, where something like a package restricting them to certain markers or whatever would fall victim to the automated EVP and whatnot.

Posted

Well just tested it out with Brisa at least. Works like a charm as long as I remember to deactivate the restraint at some point. Have to think about that though. Possibly store references that are restrained and then unrestrain everything when the quest gets shut off.

 

Companions are a major pain. :angel:

 

EDIT: Silly, just put a trigger that undoes all restraints on any followers. When the player escapes that frees up any non-vanilla followers just fine. Simple and DONE! Whew, I feel like this ONE scenario took longer to finish than the rest of the mod! :angel: Thanks for the suggestions!! :blush:

Posted

I did not check (meaning read the source), but I think there are functions to check if a variable exists and to get the value from the variable  name in the current NVSE.

But then you cannot be sure the moder named the variable waiting :)

 

Guest tomm434
Posted
set rPotentialRef to Pencil01   // Why is this even here? :-)
set rPotentialRef to GetNextRef  

Cipscis says that's called Apple bug and it comes from Oblivion - sometimes GetNextRef doesn't work properly without it.

 

Posted

In theory OBSE introduced a fix for that bug which was ported to NVSE. Never been confirmed, one way or the other.

 

Guest tomm434
Posted

Me too, I don't use this fix and my scanners always work fine. But I can't be 100% sure that no reference gets skipped because I won't notice it.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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