DecompileScript

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender version 6.1.6.

Description

Decompiles a script to a file (path is in this format: Fallout New Vegas\DecompiledScripts\ModName\ScriptName.gek). Meant to be used as a console function. Handy if a script source has been removed from a script.

Syntax

[help]
(array) DecompileScript Script:form FileExtension:string (optional) 

Example

DecompileScript ArcadeScript

Creates and populates \Fallout New Vegas\DecompiledScripts\FalloutNV.esm\ArcadeScript.gek with

ScriptName ArcadeScript

Int Waiting
Int CombatStyleMelee
Int CombatStyleRanged
Int IsFollowingDefault
Int IsFollowingLong
Int FollowerSwitchAggressive

Begin OnDeath
	If VNPCFollowers.ArcadeHired == 1
		Set VNPCFollowers.nCurrentFollowers To VNPCFollowers.nCurrentFollowers - 1

		If VNPCFollowers.nCurrentFollowers == 0
			Set VNPCFollowers.bPlayerHasFollower To 0
		EndIf

		Set VNPCFollowers.ArcadeHired To 0
		Set VNPCFollowers.bHumanoidInParty To 0
		ShowMessage FollowerMessageDeadArcade
		RemovePerk BetterHealing
		ShowMessage FollowerMessagePerkArcadeRemove
	EndIf

	Set VNPCFollowers.bArcadeDead To 1

	If GetQuestCompleted VMS54 == 0
		SetStage VMS54 110
	EndIf

	If GetObjectiveDisplayed VMS35 50 == 1 && GetObjectiveCompleted VMS35 50 == 0
		SetObjectiveDisplayed VMS35 50 0
	EndIf

End

Begin OnCombatEnd
	If GetPlayerTeammate == 1
		ResetHealth
		RestoreActorValue PerceptionCondition 100
		RestoreActorValue EnduranceCondition 100
		RestoreActorValue LeftAttackCondition 100
		RestoreActorValue LeftMobilityCondition 100
		RestoreActorValue RightAttackCondition 100
		RestoreActorValue RightMobilityCondition 100
	EndIf

End

Begin OnLoad
	If CombatStyleMelee == 1
		SetCombatStyle FollowersCombatStyleMelee
	Else 
		SetCombatStyle FollowersCombatStyleRanged
	EndIf

End

Decompile All Scripts For A Specific Mod

foreach aIter <- GetLoadedTypeArray 17 (GetModIndex "INSERT MOD NAME HERE.esp")
    DecompileScript (*aIter)
loop

This should needless to be said placed behind a GetGameRestarted check or it will decompile all the files every frame.

Notes

  • This function can also take a TESPackage form, and can decompile it's Begin, End and Change scripts.
  • As of v6.3.3, it can now decompile result scripts for any applicable form type.

See Also