Jump to content

Changing a Variable by Script on a Non-Actor Reference


user826

Recommended Posts

Hey, everyone! Would any of you happen to know if it's possible to change a variable using a script on a reference that isn't an actor?

 

I have an activator (ED-E's pod from Lonesome Road) that is a persistent reference and it is running a script that toggles the door open or closed when you activate it. This script also has the variable IsPodOpen, so that I can store its open or closed state. Unfortunately, the pod uses Forward and Backward animation groups instead of Open and Close, so I can't use GetOpenState.

 

I also have a different activator, a chair inside the pod, that is linked to the pod and closes the door when the player sits down. I want the chair's script to be able to set the IsPodOpen variable to 0, so that the pod's script will play the opening animation next time it's activated instead of snapping the doors open and then playing the closing animation, at which point you have to activate the pod again to open it.

 

I hope I've done a good enough job explaining the issue I'm having and would appreciate any ideas!

Link to comment
Share on other sites

Oh, I figured it out! Even though GetOpenState and SetOpenState can't be used to control the animation (i.e. it won't play the Forward or Backward animation groups), apparently when the pod is closed, GetOpenState still returns 3, and when it's open, GetOpenState still returns 1. This means that you can still use the OpenState variable for conditioning. So, your pod script might look something like this:

begin OnActivate
	if (GetOpenState == 3)
		PlaySound DRSPodProtectronOpen
		PlayGroup Forward 0
		SetOpenState 1
	elseif (GetOpenState == 1)
		PlaySound DRSPodProtectronOpen
		PlayGroup Backward 0
		SetOpenState 0
	endif
end

And your seat script might have a section like this:

if (MyLink.GetOpenState == 1)
	MyLink.PlaySound DRSPodProtectronOpen
	MyLink.PlayGroup Backward 0
	MyLink.SetOpenState 0
endif
Edited by user826
Link to comment
Share on other sites

  • Recently Browsing   0 members

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