Jump to content

Perk Script fragment


blackarchan

Recommended Posts

So im trying to make a mod with two functions from Horizon more exactly the Power Armor Locking mechanism and the Lock and Hacking options.But every time i try to compile the scripts im getting an error

 

Script:

ScriptName Fragments:Perks:PRKF_bkn_PowerArmorMenu extends Perk Const hidden

Keyword Property KeywordPowerArmor Auto Const
Keyword Property KeywordDisable Auto Const
Message[] Property MsgMenus Auto Const

Function Fragment_Entry_00(ObjectReference akTargetRef, Actor akActor)
	Self.MainMenu(akTargetRef, akActor, 0)
EndFunction

Function Fragment_Entry_01(ObjectReference akTargetRef, Actor akActor)
	Self.MainMenu(akTargetRef, akActor, 1)
EndFunction

Function MainMenu(ObjectReference akTargetRef, Actor akActor, int inMenu)
	int return = 0
	If (inMenu == 1)
		return = MsgMenus[1].Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	Else
		return = MsgMenus[0].Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	EndIf
	
	If (return == 1)
		akTargetRef.AddKeyword(KeywordDisable)
		akTargetRef.RemoveKeyword(KeywordPowerArmor)
	ElseIf (return == 2)
		akTargetRef.AddKeyword(KeywordPowerArmor)
		akTargetRef.RemoveKeyword(KeywordDisable)
	ElseIf (return == 3)
		int inputreturn2 = MsgMenus[2].Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	EndIf
EndFunction

Error:

Compiling "Fragments:Perks:PRKF_bkn_Perk_LockBreach_Saf_01000F9C"...

C:\Users\blackarchan\AppData\Local\Temp\PapyrusTemp\Fragments\Perks\PRKF_bkn_Perk_LockBreach_Saf_01000F9C.psc(7,0): no viable alternative at input 'Scriptname'

C:\Users\blackarchan\AppData\Local\Temp\PapyrusTemp\Fragments\Perks\PRKF_bkn_Perk_LockBreach_Saf_01000F9C.psc(0,0): error while attempting to read script Fragments:Perks:PRKF_bkn_Perk_LockBreach_Saf_01000F9C: Object reference not set to an instance of an object.

No output generated for Fragments:Perks:PRKF_bkn_Perk_LockBreach_Saf_01000F9C, compilation failed.

What exaclty i am doing wrong ?? Im getting the same error on both scripts

Link to comment
Share on other sites

From the symptoms I would infer that you have tried to edit the script outside of the script fragment editor and create functions that script fragments do not support (well).

 

The actual script fragment is PRKF_bkn_Perk_LockBreach_Saf_01000F9C and it looks like you are trying to ram in a new script name of PRKF_bkn_PowerArmorMenu in the fragment editor. Cant be done. Use the [Advanced: Rename Script] button.

 

Also script fragments are the Functions, trying to define functions in script fragments is possible but massively fragile. If you need functions rather than pure logic trees, best to work with a full-fat external global script or quest script and call that from the perk fragment then you can do as you like.

 

Say your external quest is bkn_MenuQuest and the attached script is bkn_MenuQuestScript and the function is MainMenu, it is called from the perk fragment by;

(QuestName as ScriptName).FunctionName(Parameters)
...
(pbkn_MenuQuest as bkn_MenuQuestScript).MainMenu(akTargetRef, akActor, 1)

Advanced tip: Interestingly quests that are simply placeholder pointers for function scripts like this do not actually need to be started (e.g. start game enabled) or running for script functions to be available. Only if script events are needed.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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