Jump to content

Scripting Question


stgsoviet

Recommended Posts

Alright, so I'm useing 2 Washington monument gates in my mod, and want them to be able to be opened, or closed when you hit a switch. I basically copied the script the terminal uses to open/close the real Washington mon gate, but when I activate the switch, the gate opens, and on a second press loops back the opening animation. I figured the variable wasn't updating or something, but the kind of variable I used didn't matter, script, quest, another object, it didn't work. I didn't try a global variable as a here they cause bugs and such.

 

Any help is greatly apprenticed, thanks.

scn DullesGateSwitchScript

short openstate;old script varible

Begin OnActivate

if (GateDullesOuterRef.IsAnimPlaying == 0)
if (dullesmerchantquest.openstate) == 1;
	GateDullesOuterRef.Playgroup Backward 1
	GateDullesInnerRef.Playgroup Backward 1
	set dullesmerchantquest.openstate to 0
endif

if dullesmerchantquest.openstate != 1
	GateDullesOuterRef.Playgroup Forward 1
	GateDullesInnerRef.Playgroup Forward 1
	set dullesmerchantquest.openstate to 1
endif
endif

End

Link to comment
Share on other sites

I haven't gotten very deep into the scripting of Fallout 3 as of yet, but I do see a problem. I don't know if Forward or Backward opens, and which closes, but I can tell you one major problem. Whenever openstate equals 1, it will play both chunks of code and both animation sequences. When it equals 1, it will run the Playgroup Backward code then set openstate to 0, which will make the second chunk of code run right after the first, running the Playgroup Forward part, overwriting the first part. Might be your problem if Forward opens the gate.
Link to comment
Share on other sites

Thanks kjmarket, that was pretty simple. You were right, I added returns and it fixed the problem.

 

Script to open and close animating doors:

 

scn DullesGateSwitchScript

short openstate

Begin OnActivate

if (GateDullesOuterRef.IsAnimPlaying == 0)
if (openstate) == 1
	GateDullesOuterRef.Playgroup Backward 1
	GateDullesInnerRef.Playgroup Backward 1
	set openstate to 0
	return
endif

if openstate != 1
	GateDullesOuterRef.Playgroup Forward 1
	GateDullesInnerRef.Playgroup Forward 1
	set openstate to 1
	return
endif
endif

End

Link to comment
Share on other sites

  • Recently Browsing   0 members

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