Jump to content

What am I missing: GlobalVariables, aren't they, uhh global?


Recommended Posts

So, I'm trying to transfer GlobalVariable Property VCSL_DamageLevel Auto from CombatStripLite.esp to AAF_Violate.

 

Spoiler

GlobalVariable Property VCSL_DamageLevel Auto

					If !HasCSL
						CheckRace(false)
					Else
						float OnHitDamageCheck = VCSL_DamageLevel.GetValue()
						If !ShowCSL && OnhitDamageCheck < 6
							Debug.notification("I still have some fight left in me!")
							Debug.notification(OnHitDamageCheck)
							ShowCSL = true
							RegisterForHitEvent(akActor)
						ElseIf OnHitDamageCheck < 6
							RegisterForHitEvent(akActor)
						ElseIf OnHitDamageCheck > 5
							Debug.notification("Eek! My clothes are gone!")
							Debug.notification(OnHitDamageCheck)
							ShowCSL = false
							CheckRace(false)					
						EndIf
					EndIf

 

 

Yet, no matter the damage level, the debug notifcation shows 0.000

 

What else do I need to do to properly transfer globalvariables?

Link to comment

From what I am aware of global variables are global to that specific mod not to the whole game, for it to work I think you would need to make combatstriplite.esp a masterfile for aaf_violate, so that violate can call on the variables from combat strip.

 

Though in fallout 4 you can not do this through the ck, (edit to this you did not used to be able to do this a while back, no idea if they changed it at any point), as it will remove master files that are esps from a mod, leaving errors and null values behind it when you save the mod.

Link to comment
17 minutes ago, Varithina said:

From what I am aware of global variables are global to that specific mod not to the whole game, for it to work I think you would need to make combatstriplite.esp a masterfile for aaf_violate, so that violate can call on the variables from combat strip.

 

Though in fallout 4 you can not do this through the ck, (edit to this you did not used to be able to do this a while back, no idea if they changed it at any point), as it will remove master files that are esps from a mod, leaving errors and null values behind it when you save the mod.

Thanks for the reply, and I tried to create an oride instance of VCSL_DamageLevel in AAF_Violate. Still get 0.000. When I was compiling, in one of the configurations I was using, I got a shadow variable error, so I know it sees it and I've heard that globalvariables are active while the game is playing as a 32-bit float. I just don't know what syntax I need to pull that float.

 

*edit* Does CombatStrip need to be ESM'ified?

Link to comment
1 hour ago, Varithina said:

From what I am aware of global variables are global to that specific mod not to the whole game,

Mmmm... not how I'd put it, but you aren't far off track.  Nothing that isn't linked through a proper dependency chain will work, regardless of whether it is a global or not.

 

1 hour ago, StaticPhobia2 said:

Thanks for the reply, and I tried to create an oride instance of VCSL_DamageLevel in AAF_Violate. Still get 0.000.

See below.

1 hour ago, StaticPhobia2 said:

*edit* Does CombatStrip need to be ESM'ified?

Yes and no.  The CK cannot create a dependency chain from an esp to another esp.  Esm-ifying CombatStrip would solve the issue, though it isn't the only way to go.

 

(Note that the CK is more limited than the game in this sense -- there is no functional reason you cannot have esp dependencies, but saving from the CK will erase them.  xEdit is fine for making these dependency chains and doesn't suffer from this issue, and the game doesn't care, either.)

 

You could also use "GetFormFromFile" to look it up without needing the dependency.  Keep in mind this is computationally inefficient though.  Especially if this is happening in combat, you don't want to jump through that many hoops all the time.

 

Another option is to use GetFormFromFile in another quest whose only purpose is to look this up, set it as a globalvariable of your own (give it a different name) and then use only your own from that point on.  Basically this would exist only to sync up with whatever that global was, and would likely only fire once on game load, and maybe in some other conditions you deem necessary.

 

EDIT: --- nvm, coffee hasn't started working yet ---

Link to comment
15 hours ago, Seijin8 said:

Mmmm... not how I'd put it, but you aren't far off track.  Nothing that isn't linked through a proper dependency chain will work, regardless of whether it is a global or not.

 

See below.

Yes and no.  The CK cannot create a dependency chain from an esp to another esp.  Esm-ifying CombatStrip would solve the issue, though it isn't the only way to go.

 

(Note that the CK is more limited than the game in this sense -- there is no functional reason you cannot have esp dependencies, but saving from the CK will erase them.  xEdit is fine for making these dependency chains and doesn't suffer from this issue, and the game doesn't care, either.)

 

You could also use "GetFormFromFile" to look it up without needing the dependency.  Keep in mind this is computationally inefficient though.  Especially if this is happening in combat, you don't want to jump through that many hoops all the time.

 

Another option is to use GetFormFromFile in another quest whose only purpose is to look this up, set it as a globalvariable of your own (give it a different name) and then use only your own from that point on.  Basically this would exist only to sync up with whatever that global was, and would likely only fire once on game load, and maybe in some other conditions you deem necessary.

 

EDIT: --- nvm, coffee hasn't started working yet ---

Okay, I will make a local variable access it on hit, then use that local variable as a condition check. Might not be terribly efficient but noob is as noob does.

13 hours ago, Adetu said:

The Creation Kit has some good pages about intermod communication and how to prevent script dependencies.

In contrast to Skyrim the intermod communication in Fallout 4 is much more complicated.

If it is done the (simple) way as in Skyrim it can happen that the Fallout engine invalidates a script with too much dependencies. 

Sometimes it works but sometimes it doesn't.

Unfortunately, I already had to find it out for myself

Interesting. My only background in programming is that I took a C++ class way back in highschool which I failed, but I do remember it was much easier to intercommunicate between scripts.

Link to comment
10 hours ago, StaticPhobia2 said:

Okay, I will make a local variable access it on hit, then use that local variable as a condition check.

Careful with OnHit, it only triggers once, and if multiple things are waiting for it, only one gets to use it.

1 hour ago, StaticPhobia2 said:

Worked like a charm, much appreciated

Glad it worked.

Link to comment

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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use