Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

[SKY] Help with first script please


RenKaos
 Share

Recommended Posts

Hey this is my first attempt at a script. I know that a lot of it is probably wrong but I would like for someone to fix it and then tell me what I did wrong. I've read several tutorials and understand loosely how scrips work but I only can guess how to write them. I have 26 buttons and 4 doors, I want the doors to be open by certain labeled buttons, essentially by the player typing "open." So the "O" button needs a script that says "Check all doors, if they are all closed open Door01 else close all doors." "P" would need to read "Check all doors if Door01 is open and the rest are closed open Door02 else close all doors." etc. Will I be able to do each door in one script or will I need a script for each door? I'm sure that what I have is pretty bad but thanks a lot for helping.


Scriptname OpenPuzzle01 extends ObjectReference  

{A script to check if four doors are closed and then open one}


ObjectReference property Door01 auto

{First door to be opened}


ObjectReference property Door02 auto

{Second door to be opened}


ObjectReference property Door03 auto

{Third door to be opened}


ObjectReference property Door04 auto

{Fourth door to be opened}


Function SetDefaultState()


	if (Door01.GetOpenState() != 0)

		(Door01.GetOpenState(false)

	if (Door02.GetOpenState() != 0)

		(Door02.GetOpenState(false)

	if (Door03.GetOpenState() != 0)

		(Door03.GetOpenState(false)

	if (Door04.GetOpenState() != 0)

		(Door04.GetOpenstate(false)


EndFuntion	


Function DisableDoors()


	Door01.BlockActivation()

	Door02.BlockActivation()

	Door03.BlockActivation()

	Door04.BlockActivation()


EndFunction


Function CloseDoors()


	if (Door01.GetOpenState() != 3)

		Door01.SetOpen(false)

	endif

	if (Door02.GetOpenState() != 3)

		Door02.SetOpen(false)

	endif

	if (Door03.GetOpenState() != 3)

		Door03.SetOpen(false)

	endif

	if (Door04.GetOpenState() != 3)

		Door04.SetOpen(false)

	endif


EndFunction


Function OpenDoor()


	if (Door01.GetOpenState() != 3)

	if (Door02.GetOpenState() != 3)

	if (Door03.GetOpenState() != 3)

	if (Door04.GetOpenState() != 3)

		Door01.SetOpen()

	endif


EndFunction


Event OnReset()


	SetDefaultState()

	DisableDoors()


EndEvent


Event OnLoad()


	SetDefaultState()

	DisableDoors()


EndEvent


Auto State Inactive


	Event OnActivate(ObjectReference akActivateRef)


		GoToState("Active")

		OpenDoor()

			elseif (CloseDoors())

		endif

		Utility.Wait(1)

		GoToState("Inactive")


	EndEvent


EndState

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...