Jump to content

GlobalVariable SetValue() Doesn't Seem To Work


Recommended Posts

GlobalVariable Property MinutemenMaxActiveRecruitmentQuests Auto
;
MinutemenMaxActiveRecruitmentQuests = Game.GetFormFromFile(0x0023888E, "Fallout4.esm") as GlobalVariable ;this is necessary to add new properties pre-GECK
;
;
int ButtonPressed = CGOMinutemenMaxQuestsMessage.Show(MinutemenMaxActiveRecruitmentQuests.GetValue(), 0, 0, 0, 0, 0, 0, 0, 0)
;
;
If (ButtonPressed == 0)
		MinutemenMaxActiveRecruitmentQuests.SetValue(1)

In the above code snippet, GlobalVariable.GetValue() works just fine but GlobalVariable.SetValue() does nothing. I also tried GlobalVariable.SetValueInt() and it didn't work either. Any ideas?

Link to comment
Share on other sites

It's a little known thing in xEdit. Hold Shift and double-click on the DESC and xEdit will bring up a multi-line dialog menu. It took me forever to figure that out, and I only came across it by sheer luck. It really should be put in the ReadMe or something.

Edited by Reneer
Link to comment
Share on other sites

So here's an odd issue, the following code in the If block worked just fine. I tried some new stuff in another part of the script and (accidentally) deleted it. When I put it back the script still compiles fine but now it doesn't work any more. I swear, I'm just gonna give up and wait for Beth to finally crap out the CK whenever they've decided it's strained their gut enough....

Perk Property LocalLeader1 Auto
;
;
;
LocalLeader1 = Game.GetFormFromFile(0x0004D88D, "Fallout4.esm") as Perk
;
;
;
If (Game.GetPlayer().HasPerk(LocalLeader1) == False)
    Game.GetPlayer().AddPerk(LocalLeader1, 1)
EndIf
Link to comment
Share on other sites

 

So here's an odd issue, the following code in the If block worked just fine. I tried some new stuff in another part of the script and (accidentally) deleted it. When I put it back the script still compiles fine but now it doesn't work any more. I swear, I'm just gonna give up and wait for Beth to finally crap out the CK whenever they've decided it's strained their gut enough....

Perk Property LocalLeader1 Auto
;
;
;
LocalLeader1 = Game.GetFormFromFile(0x0004D88D, "Fallout4.esm") as Perk
;
;
;
If (Game.GetPlayer().HasPerk(LocalLeader1) == False)
    Game.GetPlayer().AddPerk(LocalLeader1, 1)
EndIf
Might help if you could post the whole script, because after a cursory reading everything looks fine. :)
Link to comment
Share on other sites

That's what's confusing me also, since it DID work before I started messing with it. I wonder if Caprica is playing silly buggers....

 

Again, it compiles without any errors and everything works fine except the AddPerk line in Function ChooseWorkshopPerkRequirements()

ScriptName ConfigurableGameOverhaulScript extends ObjectReference

;-- Properties --------------------------------------
ActorValue Property Strength Auto
ActorValue Property Perception Auto
ActorValue Property Endurance Auto
ActorValue Property Charisma Auto
ActorValue Property Intelligence Auto
ActorValue Property Agility Auto
ActorValue Property Luck Auto

Message Property CGOMainOptionsMenuMessage Auto ;bobblehead options, workshop perk options, Minutemen quest options
Message Property CGOSPECIALRandomizerMessage Auto ;use Vanilla, use randomizer
Message Property YoureSpecialMessage Auto ;vanilla message
Message Property CGOSPECIALsRandomizedMessage Auto ;confirmation message
Message Property CGODisableBobbleheadsOptionMessage Auto ;disable all, disable SPECIAL, disable none
Message Property CGODisableBobbleheadsAllMessage Auto ;confirmation message
Message Property CGODisableBobbleheadsSPECIALMessage Auto ;confirmation message
Message Property CGODisableBobbleheadsNoneMessage Auto ;confirmation message
Message Property CGOWorkshopPerkRequirementsChoice Auto ;choose yes or no
Message Property CGOWorkshopPerkRequirementsDisabled Auto ;confirmation message
Message Property CGOWorkshopPerkRequirementsEnabled Auto ;confirmation message
Message Property CGOMinutemenQuestOptionsMessage Auto ;max quests, quest chance, exit
Message Property CGOMinutemenMaxQuestsMessage Auto ;1, 2, 3 (Default), 4, 5, 10, 15, 20, 30
Message Property CGOMinutemenEventChanceMessage Auto ;5%, 10%, 25% (Default), 50%, 75%, 95%

GlobalVariable Property CGODisableBobbleheads Auto
GlobalVariable Property MinutemenMaxActiveRecruitmentQuests Auto
GlobalVariable Property MinutemenRandomEventChance Auto
GlobalVariable Property CGOHasBeenRead Auto
GlobalVariable Property CGOWorkshopPerkRequirements Auto ;if true, need perks

Perk Property LocalLeader1 Auto

;-- Variables ---------------------------------------

;-- Functions ---------------------------------------

Function OnActivate(ObjectReference akActionRef)
	YoureSpecialMessage = Game.GetFormFromFile(0x0015E019, "Fallout4.esm") as Message ;this is necessary to add new properties pre-GECK
	CGOMainOptionsMenuMessage = Game.GetFormFromFile(0x01000832, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOSPECIALsRandomizedMessage = Game.GetFormFromFile(0x02000801, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGODisableBobbleheadsOptionMessage = Game.GetFormFromFile(0x01000804, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGODisableBobbleheadsAllMessage = Game.GetFormFromFile(0x01000805, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGODisableBobbleheadsSPECIALMessage = Game.GetFormFromFile(0x01000806, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGODisableBobbleheadsNoneMessage = Game.GetFormFromFile(0x01000807, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGODisableBobbleheads = Game.GetFormFromFile(0x02000803, "ConfigurableGameOverhaul.esp") as GlobalVariable ;this is necessary to add new properties pre-GECK
	CGOWorkshopPerkRequirements = Game.GetFormFromFile(0x01000837, "ConfigurableGameOverhaul.esp") as GlobalVariable ;this is necessary to add new properties pre-GECK
	CGOWorkshopPerkRequirementsChoice = Game.GetFormFromFile(0x0100082F, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOWorkshopPerkRequirementsDisabled = Game.GetFormFromFile(0x01000831, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOWorkshopPerkRequirementsEnabled = Game.GetFormFromFile(0x01000830, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOMinutemenQuestOptionsMessage = Game.GetFormFromFile(0x02000833, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOMinutemenMaxQuestsMessage = Game.GetFormFromFile(0x02000834, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	CGOMinutemenEventChanceMessage = Game.GetFormFromFile(0x02000835, "ConfigurableGameOverhaul.esp") as Message ;this is necessary to add new properties pre-GECK
	MinutemenMaxActiveRecruitmentQuests = Game.GetFormFromFile(0x0023888E, "Fallout4.esm") as GlobalVariable ;this is necessary to add new properties pre-GECK
	MinutemenRandomEventChance = Game.GetFormFromFile(0x00238B46, "Fallout4.esm") as GlobalVariable ;this is necessary to add new properties pre-GECK
	LocalLeader1 = Game.GetFormFromFile(0x0004D88D, "Fallout4.esm") as Perk ;this is necessary to add new properties pre-GECK
	CGOHasBeenRead = Game.GetFormFromFile(0x01000836, "ConfigurableGameOverhaul.esp") as GlobalVariable ;this is necessary to add new properties pre-GECK
	
	If ((CGOHasBeenRead.GetValue() < 1) && (Game.GetPlayer().GetLevel() < 2))
		Self.ChooseSPECIALSystem()
		CGOHasBeenRead.SetValue(1)
	EndIf
	Self.MainMenu()
EndFunction

Function ChooseSPECIALSystem()
	int SPECIALSystemChoice = CGOSPECIALRandomizerMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	If (SPECIALSystemChoice == 0) ;use vanilla system
		int VanillaSPECIALSystem = YoureSpecialMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
		If (VanillaSPECIALSystem == 0)
			Game.GetPlayer().SetValue(Strength, Game.GetPlayer().GetBaseValue(Strength) + 1)
		ElseIf (VanillaSPECIALSystem == 1)
			Game.GetPlayer().SetValue(Perception, Game.GetPlayer().GetBaseValue(Perception) + 1)
		ElseIf (VanillaSPECIALSystem == 2)
			Game.GetPlayer().SetValue(Endurance, Game.GetPlayer().GetBaseValue(Endurance) + 1)
		ElseIf (VanillaSPECIALSystem == 3)
			Game.GetPlayer().SetValue(Charisma, Game.GetPlayer().GetBaseValue(Charisma) + 1)
		ElseIf (VanillaSPECIALSystem == 4)
			Game.GetPlayer().SetValue(Intelligence, Game.GetPlayer().GetBaseValue(Intelligence) + 1)
		ElseIf (VanillaSPECIALSystem == 5)
			Game.GetPlayer().SetValue(Agility, Game.GetPlayer().GetBaseValue(Agility) + 1)
		ElseIf (VanillaSPECIALSystem == 6)
			Game.GetPlayer().SetValue(Luck, Game.GetPlayer().GetBaseValue(Luck) + 1)
		EndIf
	ElseIf (SPECIALSystemChoice == 1) ;use SPECIAL randomizer
		Game.GetPlayer().SetValue(Strength, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Perception, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Endurance, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Charisma, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Intelligence, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Agility, Utility.RandomInt(1, 10) as float)
		Game.GetPlayer().SetValue(Luck, Utility.RandomInt(1, 10) as float)
		int ButtonPressed = CGOSPECIALsRandomizedMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	EndIf
EndFunction

Function ChooseBobbleheadsOption()
	int BobbleheadsOptionChoice = CGODisableBobbleheadsOptionMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	If (BobbleheadsOptionChoice == 0) ;disable ALL bobbleheads
		CGODisableBobbleheads.SetValue(2)
		int ButtonPressed = CGODisableBobbleheadsAllMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	ElseIf (BobbleheadsOptionChoice == 1) ;disable SPECIAL bobbleheads ONLY
		CGODisableBobbleheads.SetValue(1)
		int ButtonPressed = CGODisableBobbleheadsSPECIALMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	ElseIf (BobbleheadsOptionChoice == 2) ;disable NO bobbleheads
		CGODisableBobbleheads.SetValue(0)
		int ButtonPressed = CGODisableBobbleheadsNoneMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	EndIf
	Self.MainMenu()
EndFunction

Function ChooseWorkshopPerkRequirements()
	int workshopperkrequirementschoice = CGOWorkshopPerkRequirementsChoice.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	If (workshopperkrequirementschoice == 0) ;no workshop perks required
		If (CGOWorkshopPerkRequirements.GetValue() == True)
			CGOWorkshopPerkRequirements.SetValue(0)
			If (Game.GetPlayer().HasPerk(LocalLeader1) == False)
				Game.GetPlayer().AddPerk(LocalLeader1, 1)
			EndIf
		EndIf
	ElseIf (workshopperkrequirementschoice == 1) ;workshop perks required
		If (CGOWorkshopPerkRequirements.GetValue() == False)
			CGOWorkshopPerkRequirements.SetValue(1)
		EndIf
	EndIf
	If (CGOWorkshopPerkRequirements.GetValue() == False)
		int ButtonPressed = CGOWorkshopPerkRequirementsDisabled.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	ElseIf (CGOWorkshopPerkRequirements.GetValue() == True)
		int ButtonPressed = CGOWorkshopPerkRequirementsEnabled.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	EndIf
	Self.MainMenu()
EndFunction

Function ChooseMinutemenQuestOptions()
	int ButtonPressed = CGOMinutemenQuestOptionsMessage.Show(MinutemenMaxActiveRecruitmentQuests.GetValue(),MinutemenRandomEventChance.GetValue(), 0, 0, 0, 0, 0, 0, 0)
	If (ButtonPressed == 0)
		Self.SetMinutemenMaxQuests()
	ElseIf (ButtonPressed == 1)
		Self.SetMinutemenQuestChance()
	EndIf
	Self.MainMenu()
EndFunction

Function SetMinutemenMaxQuests()
	int ButtonPressed = CGOMinutemenMaxQuestsMessage.Show(MinutemenMaxActiveRecruitmentQuests.GetValue(), 0, 0, 0, 0, 0, 0, 0, 0)
	If (ButtonPressed == 0)
		MinutemenMaxActiveRecruitmentQuests.SetValue(1)
	ElseIf (ButtonPressed == 1)
		MinutemenMaxActiveRecruitmentQuests.SetValue(2)
	ElseIf (ButtonPressed == 2)
		MinutemenMaxActiveRecruitmentQuests.SetValue(3)
	ElseIf (ButtonPressed == 3)
		MinutemenMaxActiveRecruitmentQuests.SetValue(4)
	ElseIf (ButtonPressed == 4)
		MinutemenMaxActiveRecruitmentQuests.SetValue(5)
	ElseIf (ButtonPressed == 5)
		MinutemenMaxActiveRecruitmentQuests.SetValue(10)
		
	ElseIf (ButtonPressed == 6)
		MinutemenMaxActiveRecruitmentQuests.SetValue(15)
	ElseIf (ButtonPressed == 7)
		MinutemenMaxActiveRecruitmentQuests.SetValue(20)
	ElseIf (ButtonPressed == 8)
		MinutemenMaxActiveRecruitmentQuests.SetValue(30)
	EndIf
	
;	Self.MainMenu()
EndFunction

Function SetMinutemenQuestChance()
	int ButtonPressed = CGOMinutemenEventChanceMessage.Show(MinutemenRandomEventChance.GetValue(), 0, 0, 0, 0, 0, 0, 0, 0)
	If (ButtonPressed == 0)
		MinutemenRandomEventChance.SetValue(5)
	ElseIf (ButtonPressed == 1)
		MinutemenRandomEventChance.SetValue(10)
	ElseIf (ButtonPressed == 2)
		MinutemenRandomEventChance.SetValue(25)
	ElseIf (ButtonPressed == 3)
		MinutemenRandomEventChance.SetValue(50)
	ElseIf (ButtonPressed == 4)
		MinutemenRandomEventChance.SetValue(75)
	ElseIf (ButtonPressed == 5)
		MinutemenRandomEventChance.SetValue(95)
	EndIf
;	Self.MainMenu()
EndFunction

Function MainMenu()
	int ButtonPressed = CGOMainOptionsMenuMessage.Show(0, 0, 0, 0, 0, 0, 0, 0, 0)
	If (ButtonPressed == 0)
		Self.ChooseBobbleheadsOption()
	ElseIf (ButtonPressed == 1)
		Self.ChooseWorkshopPerkRequirements()
	ElseIf (ButtonPressed == 2)
		Self.ChooseMinutemenQuestOptions()
	EndIf
EndFunction

Edited by digitaltrucker
Link to comment
Share on other sites

  • Recently Browsing   0 members

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