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...

Levers and remote doors


Citrus
 Share

Recommended Posts

I'm trying to make a secret door be triggered by a book lever, just like the one in Castle Skingrad's cellar (the huge barrel and the little candle). I just used both scripts the way they were used originally (the barrel door was left unaltered and the book lever just uses the candle script in it). I checked both scripts and, I think, there's nothing that specifically references either the candle lever used in the cellar or the barrel door (none of them have unique reference IDs).

The barrel door is a persistent reference and the book lever is parented to the barrel door (just like in the Skingrad Castle cellar: the candle lever is parented to the barrel door). It works up until a certain point: the book, when activated, plays its animation but, when I reach the barrel, it isn't open.

The catch here is the barrel door and the book lever are in different cells. Does that affect the script in any way or am I missing something?

I'll leave both scripts here for reference.

Barrel door script

scn CastleSecretBarrelScript


; activated by linked child

; activates optionally linked parent after 1 sec delay


short init

short open

short next

short busy

short waiting

float timer



ref mySelf

ref myParent


begin onActivate


	if isActionRef mySelf == 0 && busy == 0 && isActionRef player == 0


		if open == 0

			playgroup forward 0

			set open to 1

			enableLinkedPathPoints

			set waiting to 1

		else

			playgroup backward 0

			set open to 0

			disableLinkedPathPoints

			set waiting to 0

		endif


		set next to 1

		set timer to 1

		set busy to 1


	endif


end


begin gameMode



	if init == 0 && open == 0

		; set up ref vars

		set mySelf to getSelf

		set myParent to getParentRef

		; prepare linked pathsgrid points

		disableLinkedPathPoints

		set init to 1

	endif


	; daisy-chain activation

	if next == 1 && timer <=0

		set next to 0

		myParent.activate mySelf 1

	endif


	if timer > 0

		set timer to timer - getSecondsPassed

	endif


	if isAnimPlaying == 0 && busy == 1

		set busy to 0

	endif


end


begin onReset


	reset3DState

	set open to 0

	set next to 0

	set busy to 0

	disableLinkedPathPoints


end
Candle lever script
scn SKsecretCandle01SCRIPT


short busy

short init


ref target

ref mySelf



begin onActivate

	if init == 0

		set target to getParentRef

		set mySelf to getSelf

		set init to 1

	endif


	if busy == 0 && target.isAnimPlaying == 0

		target.activate mySelf 1

		playgroup forward 0

		set busy to 1

	endif


	If Player.GetInCell SkingradCastleDungeon == 1

		AnvilPrisonDoorRef.Lock

		BravilPrisonDoorRef.Lock

		BrumaPrisonDoorRef.Lock

		CheydinhalPrisonDoorRef.Lock

		ChorrolPrisonDoorRef.Lock

		ICPrisonDoorRef.Lock

		LeyawiinPrisonDoorRef.Lock

		SkingradPrisonDoorRef.Lock

	EndIf


end


begin gameMode


	if isAnimPlaying == 0 && busy == 1

		set busy to 0

	endif


end

I noticed that, in the candle lever script, there's an If condition that checks if the player is in the cellar but all it does is lock the prison doors from all castles' dungeons if the player is in the Skingrad Castle Dungeon (because that same candle is also used in the Skingrad Castle dungeon to open a secret wall door). It seems to me that the script is made in the most general way possible to be able to be reused whenever such situation (the secret door with the candle lever) is required.

Link to comment
Share on other sites

Once I checked on that script and well... it's not the best way of doing such things me thinks, stock script or not...

You can make working secret door in much much simpler way (thus less prone to errors).

You need only three things:

- barrel door as persistent reference with unique name (eg. BarrelDoorRef)

- your activator (candle)

- script attached to your activator.

And here's such script:

scn HiddenEntranceScript


short Open


begin onActivate


	if BarrelDoorRef.isAnimPlaying == 1

		Return

	endif


	if Open == 0

		BarrelDoorRef.playgroup Forward 1

		set open to 1

	else

		BarrelDoorRef.playgroup Backward 1

		set open to 0

	endif


end

Pretty short, isn't it? Well, if you'll think for a while you may come to conclusion that all that junk in original script is not really necessary to make this work... of course disabling/enabling linked path points may be useful sometimes but that's another story...

  • Upvote 1
Link to comment
Share on other sites

Once I checked on that script and well... it's not the best way of doing such things me thinks, stock script or not...

You can make working secret door in much much simpler way (thus less prone to errors).

You need only three things:

- barrel door as persistent reference with unique name (eg. BarrelDoorRef)

- your activator (candle)

- script attached to your activator.

And here's such script:

scn HiddenEntranceScript


short Open


begin onActivate


	if BarrelDoorRef.isAnimPlaying == 1

		Return

	endif


	if Open == 0

		BarrelDoorRef.playgroup Forward 1

		set open to 1

	else

		BarrelDoorRef.playgroup Backward 1

		set open to 0

	endif


end

Pretty short, isn't it? Well, if you'll think for a while you may come to conclusion that all that junk in original script is not really necessary to make this work... of course disabling/enabling linked path points may be useful sometimes but that's another story...

It does makes things shorter and yes, the path points enabling/disabling isn't really necessary. It makes more sense now without all that clutter from the vanilla script. I just used it because I assumed it would work right away and that would be one less thing I'd have to add to the mod (sure, it's just a script...)

Thanks for the help.

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...