Jump to content

Decon Chamber Script Help


3vilg3nius

Recommended Posts

Okay so I've set up a decontamination chamber in my mod...I was trying to create a timed sequence, 5 second timer on the Alarm, Klaxon Light, and Decon Sprays...I set the main script to an activator box, and tied that into the terminal. So in the terminal I've got the activator box to activate when the door (airlock) is closed via the terminal...then the main script sequence is supposed to run for 5 seconds...and I made a script for the second entrance door that denies access until the "DeconComplete" variable I put in the script equals 1. So here goes...in order from terminal to activator box to door.

 

Terminal Menu Script

AADoorAirLock001.setOpenState 0

AADoorAirLock002.setopenstate 0

AADoorAirLock003.setopenstate 0

 

AADoorAirLockSteps001.disable 0

AADoorAirLockSteps003.enable 0

 

AADeconSequenceTriggerREF.activate <----this one

 

 

This is the activator box script. on the AADeconSequenceTriggerREF

scn AADeconSequence01

float Timer
short Stage
short DeconComplete
short DeconInProgress

begin onactivate

if stage == 1
	set Stage to 2
	activate
elseif Stage == 3
	activate
	set Stage to 0
	AADeconSpray001.disable
	AADeconSpray002.disable
	AADeconSpray003.disable
	AADeconSpray004.disable
	AADeconSpray005.disable
	AADeconSpray006.disable
	AADeconSpray007.disable
	AADeconSpray008.disable
	AADeconSpray009.disable
	AADeconSpray010.disable
	AADeconKlaxonLight001.playgroup left 0
	AADeconKlaxonGlow001.playgroup left 0
	AASoundDeconAlarm001.disable
	AADoorDeconChamber001REF.unlock
	Set DeconComplete to 1
endif

end

Begin GameMode

if Stage == 0
	set Timer to 5
	set Stage to 1
endif

if Stage == 2 && Timer > 0
	set Timer to Timer - GetSecondsPassed

	if Timer < 5
		AADeconSpray001.enable
		AADeconSpray002.enable
		AADeconSpray003.enable
		AADeconSpray004.enable
		AADeconSpray005.enable
		AADeconSpray006.enable
		AADeconSpray007.enable
		AADeconSpray008.enable
		AADeconSpray009.enable
		AADeconSpray010.enable
		AADeconKlaxonLight001.playgroup left 1
		AADeconKlaxonGlow001.playgroup left 1
		AASoundDeconAlarm001.enable
		AADoorDeconChamber001REF.lock 255
		set DeconComplete to 0
	
	elseif Timer <= 0
		Set Stage to 3
	endif

endif

end

 

And this is the door script..

scn AADoorDeconChamber001REF

Begin OnActivate Player

if (player == AADoorDeconChamber001REF)
	if (AADeconSequence01.DeconComplete == 0)
		ShowMessage AADeconAccessWaitMSG
	else
		activate
	endif
endif

end
Link to comment
Share on other sites

If you do that, you're going to be calling Enable quite a few times per frame for 5 seconds. It'd be much easier if you just enabled them once, and used an Enable Parent so you only need to call Enable/Disable once.

 

I've written a tutorial that describes a script structure that can be used for making scripted sequences like this one. If you're interested, take a look - Staged Timers

 

Cipscis

Link to comment
Share on other sites

Thanks for the reply Cipscis...always a pleasure to hear from you. :biggrin: I went ahead and trimmed down the script and used an xmarker for all the enable/disable links. And I looked over the staged timers tutorial...

 

Still wont work though. I dont know what Im doing wrong here. I tied everything into a switch and tested to make sure all the linked items are being called at all...everything works, lights, sprays, sounds, door locks to 255...I just cant seem to get the stages and timers right. Second problem...the game recognizes the DeconComplete variable...but I still cant get the message to pop up when I use the door...

 

updated script for the Activator Box...

 

scn AADeconSequence02

float Timer
short Stage
short DeconComplete

begin onactivate

if Stage == 1    <---your validator is throwing this at me for this line "The variable "Stage" has not been assigned a value yet" cant figure it out.
	set Stage to 2
elseif Stage == 3
	set Stage to 0
	AADeconSequenceTriggerREF.disable
	AADeconKlaxonLight001.playgroup left 0
	AADeconKlaxonGlow001.playgroup left 0
	AADoorDeconChamber001.unlock
	set DeconComplete to 1
endif

end

Begin GameMode

if Stage == 0
	set Timer to 7
	set Stage to 1
endif

if Stage == 2 && Timer > 0
	set Timer to Timer - GetSecondsPassed

	if Timer > 0
		AADeconSequenceTriggerREF.enable
		AADeconKlaxonLight001.playgroup left 1
		AADeconKlaxonGlow001.playgroup left 1
		AADoorDeconChamber001.lock 255
		set DeconComplete to 0

	elseif Timer <= 0
		Set Stage to 3
	endif

endif

end

 

Thanks again Cypscis. Gave you some Kudos :thumbsup:

Link to comment
Share on other sites

I think that this variation on your script might work: I am assuming that the terminal only triggers the activator once per sequence, so with one activation the timer is set to 5, the door is locked and everything is enabled. When the 5 seconds is up everything is disabled, the door is unlocked and the stage is reset to 0 so that it can be triggered again.

 

scn AADeconSequence01

float Timer
short Stage
short DeconComplete

begin onactivate

       if stage == 0
               activate
               set Stage to 1
               set Timer to 5
               AADeconSequenceTriggerREF.enable
               AADeconKlaxonLight001.playgroup left 1
               AADeconKlaxonGlow001.playgroup left 1
               AASoundDeconAlarm001.enable
               AADoorDeconChamber001REF.lock 255
               set DeconComplete to 1

end

Begin GameMode

       if Stage == 1 && Timer > 0
               set Timer to (Timer – GetSecondsPassed)
               Set Stage to 2
       endif     
          
       if Timer <= 0 && Stage == 2
               set Stage to 0
               AADeconSequenceTriggerREF.disable
               AADeconKlaxonLight001.playgroup left 0
               AADeconKlaxonGlow001.playgroup left 0
               AASoundDeconAlarm001.disable
               AADoorDeconChamber001REF.unlock
               Set DeconComplete to 0
       endif

end

 

Remember that your variables always start at ground zero, so that is why you may be seeing "The variable "Stage" has not been assigned a value yet". So it is good to start with "If X equals 0 and Y happens then set X to (X+1) and make Z happen",

 

As for your door script, I'm not sure what you intend to mean by "if (player == AADoorDeconChamber001REF)". This statement will never be true. Also, I do not believe that you can call variables from one object script to another object script. You may need to include a start game activated quest script to oversee variables for your object scripts.

Link to comment
Share on other sites

Thanks BadPenny...that variation at least started, mine would never even start....I know it is how I am tying things together and not your script though. Here's how I have it set up.

 

The main script (long ones above) is on a red activator box. Under primitive menu, Ive tried both "TRIGGER" and "ACTORZONE" settings. Editor ID for Box is "AADeconSequenceTrigger01REF"

 

The Terminal script menu for close doors looks like this...

 

AADoorAirLock001.setOpenState 0

AADoorAirLock002.setopenstate 0

AADoorAirLock003.setopenstate 0

 

AADoorAirLockSteps001.disable 0

AADoorAirLockSteps003.enable 0

 

AADeconSequenceTrigger01REF.activate <---Stuck the activator box trigger here. I know the command isnt right...but I cant figure out how to do it.

 

If I put the script on a simple yellow electric switch and use it...the sequence starts and all the water sprays, alarm sounds, lights play...but it gets stuck and stays on.

 

I also tried using only a timer with out stages...but then the klaxon lights dont work right...they turn on but freeze up and wont animate...and once the sequence completes...everything shuts off, but the lights begin animating. I swear, scripting is stumbling around in a mine field drunk. Either way I do any of it...the door never unlocks.

 

As for the variable I was talking about...it works some what...the door script calls the "DeconComplete" variable in the script on the activator and shows the ACCESS DENIED message when I try to use the door. But Im going to have to play around with it.

 

Anyway...Pic of the area in question to sort of give you a feel for what Im working with. Water Spouts on the end of the pipes, and the three sound markers are tied to the red Xmarker. The xMarker's Editor ID is AADeconSequenceTriggerREF. the Klaxon Light is AADeconKlaxonLight001, Klaxon Glow is AADeconKlaxonGlow001, I removed AASoundDeconAlarm001 and just tied it into the xMarker, and the door under the Klaxon is the one that locks and unlocks in the script.

 

So the idea here is...the HUGE doors next to the terminal are opened...you go inside the room in the pic...use the terminal to close them. Once the HUGE doors are closed, the sequence is supposed to start. Flashing lights, water sprays, and alarm sound for a few seconds. During which the Wave Door is inaccessible till the process finishes. Then it can be accessed and can be used to teleport the player to the next cell.

 

One more thing...the blue line doesnt mean they are linked reference or anything. Didnt want any confusion there. Sorry

 

http://www.mediafire.com/imgbnc.php/ecb60c26a0813385ed9030796de4f73c6g.jpg

Link to comment
Share on other sites

....I know it is how I am tying things together and not your script though.

The solution will be an efficient combination of your setup and your scripts.

 

"A good designer knows he is finished not when there is nothing left to add, but when there is nothing left to take away."

Link to comment
Share on other sites

  • Recently Browsing   0 members

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