Jump to content

Any idea why my Global Variable isn't working?


ozziefire

Recommended Posts

I'm probably need to turn something on to activate my global variable, I've created it in Geck ok but it doesn't seem to work fo some reason

 

ScriptName 0RadTestSCRIPT

;GLOBAL aaLastRadCount
short intRadLevel
short intLastRadCount
ref refOwner

Begin GameMode
Set refOwner to player

Set intRadLevel to 0
Set intLastRadCount to aaLastRadCount

if refOwner.GetActorValue RadiationRads > intLastRadCount
Set intRadLevel to refOwner.GetActorValue RadiationRads - intLastRadCount
endif

refOwner.ForceActorValue EnergyResist intRadLevel

Set aaLastRadCount to refOwner.GetActorValue RadiationRads

End

Link to comment
Share on other sites

I'm probably need to turn something on to activate my global variable, I've created it in Geck ok but it doesn't seem to work fo some reason

 

ScriptName 0RadTestSCRIPT

;GLOBAL aaLastRadCount
short intRadLevel
short intLastRadCount
ref refOwner

Begin GameMode
Set refOwner to player

Set intRadLevel to 0
Set intLastRadCount to aaLastRadCount

if refOwner.GetActorValue RadiationRads > intLastRadCount
Set intRadLevel to refOwner.GetActorValue RadiationRads - intLastRadCount
endif

refOwner.ForceActorValue EnergyResist intRadLevel

Set aaLastRadCount to refOwner.GetActorValue RadiationRads

End

remove the periods . . .

Link to comment
Share on other sites

I'm probably need to turn something on to activate my global variable, I've created it in Geck ok but it doesn't seem to work fo some reason

 

ScriptName 0RadTestSCRIPT

;GLOBAL aaLastRadCount
short intRadLevel
short intLastRadCount
ref refOwner

Begin GameMode
Set refOwner to player

Set intRadLevel to 0
Set intLastRadCount to aaLastRadCount

if refOwner.GetActorValue RadiationRads > intLastRadCount
Set intRadLevel to refOwner.GetActorValue RadiationRads - intLastRadCount
endif

refOwner.ForceActorValue EnergyResist intRadLevel

Set aaLastRadCount to refOwner.GetActorValue RadiationRads

End

remove the periods . . .

Hmm strange that worked after I removed the refOwner too of course, I was trying to make this useable later for companions as well as the player though companions don't have a radcount AFAIK

Link to comment
Share on other sites

I'm probably need to turn something on to activate my global variable, I've created it in Geck ok but it doesn't seem to work fo some reason

 

ScriptName 0RadTestSCRIPT

;GLOBAL aaLastRadCount
short intRadLevel
short intLastRadCount
ref refOwner

Begin GameMode
Set refOwner to player

Set intRadLevel to 0
Set intLastRadCount to aaLastRadCount

if refOwner.GetActorValue RadiationRads > intLastRadCount
Set intRadLevel to refOwner.GetActorValue RadiationRads - intLastRadCount
endif

refOwner.ForceActorValue EnergyResist intRadLevel

Set aaLastRadCount to refOwner.GetActorValue RadiationRads

End

remove the periods . . .

Hmm strange that worked after I removed the refOwner too of course, I was trying to make this useable later for companions as well as the player though companions don't have a radcount AFAIK

always keep in mind, the game engine is set, it will tear any scripting you create 10 ways to sunday in a heart beat. There's no telling what will happen even after several hours of game play, changes will occur.

Link to comment
Share on other sites

Just a bit of advice - never use ForceActorValue on the player. You can never undo it and that stat will be messed up for the rest of the game. Use ModActorValue, damageActorValue, RestorActorValue, etc. It's also not a good idea to use it on vanilla actors. Use it all you want on your own NPCs and companions. I use it on my companion for all important stats, in order to over-ride the Object Effect stacking bug.

 

Other actors have the RadiationRads - it just doesn't accumulate. You can script a companion to have radiation effects. I did it once by tracking the player's exposure, then using DamageActorValue RadiationRads on the NPC. Then when it gets to a certain level, apply an effect. It's all scripted though.

Link to comment
Share on other sites

Just a bit of advice - never use ForceActorValue on the player. You can never undo it and that stat will be messed up for the rest of the game. Use ModActorValue, damageActorValue, RestorActorValue, etc. It's also not a good idea to use it on vanilla actors. Use it all you want on your own NPCs and companions. I use it on my companion for all important stats, in order to over-ride the Object Effect stacking bug.

 

Other actors have the RadiationRads - it just doesn't accumulate. You can script a companion to have radiation effects. I did it once by tracking the player's exposure, then using DamageActorValue RadiationRads on the NPC. Then when it gets to a certain level, apply an effect. It's all scripted though.

That's great info, and gives me heaps more crazy ideas too :)

Link to comment
Share on other sites

  • 6 months later...

i know i am resurrecting an old thread here but the reason this didnt work was because 'player' is not a reference.. you needed to use playerRef instead.

 

'player' & 'playerfemale' are actually referring to the baseID and you need the RefID to use a reference variable.

 

see any conditions panel in geck and try to find 'player' in the getIsReference function (not the getIsId function)

 

 

you actually had it right mostly, and removing the reference variable was not the best advice.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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