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

Requesting proofread


ThomasKaira
 Share

Recommended Posts

The goal if this script is this:

Check if two specific actors are dead, if either one is not dead, unlock the door at this time, and lock it again at this other time. This is the first time I've written a script from scratch, and although the CS did not give me any compiling errors, I would just like for someone with more experience to look it over and see if anything should be changed.

scn TKBrinaCrossForumUnlock


short GameHour

ref TKBrinaCrossCouncilor1

ref TKBrinaCrossCouncilor2


begin gamemode

	if GetDead TKBrinaCrossCouncilor1 == 0

		if gamehour >=10

			unlock

		elseif gamehour >=21

			lock

		endif

	elseif GetDead TKBrinaCrossCouncilor2 == 0

		if gamehour >=10

			unlock

		elseif gamehour >=21

			lock

		endif

	endif

end

Edited by ThomasKaira
Link to comment
Share on other sites

DSoS is on the right track - it should be if TKBrinaCrossCouncilor1.GetDead == 0 though. Same format for the other.

It's also a good idea to have a space after a >= check. So >= X instead of >=X

Hana is also correct that in a gamemode block that script will be executing every frame. Probably not a major issue though since locking and unlocking doors isn't performance sensitive.

Link to comment
Share on other sites

:( sorry, I ended up changing it to a OnDeath script...

Hana is correct though I think, the Begin GameMode will make that run non-stop. --- Arthmoor said it first!

Change the "Begin Gamemode" to "Begin OnActivate Player"

I can't remember those pesky 1's and 0's sometimes XD Thanks Arthmoor

Link to comment
Share on other sites

        if TKBrinaCrossCouncilor1.GetDead == 1 || TKBrinaCrossCouncilor2.GetDead == 1
if gamehour >= 10 && gamehour < 21
unlock
else
lock
endif
endif[/code]

You also do not define the REF in the script, that would be set on the two NPC's you want to check if they are dead or not.

The reason for keeping it in a gamemode block is you want the door to unlock 'when' either of the NPC's are dead and the time is the right time. If you put it in an onActivate block, it will only check the conditions 'when' you click on the locked door.

Link to comment
Share on other sites

OK, I'm about ready to give up here. I've recently discovered the AI method is causing the door to mysteriously re-lock itself whenever I visit the cell, and despite everything I try, the script fails to work.

This is the current script:

scn TKBrinaCrossForumUnlock


begin gamemode


if TKBrinaCrossCouncilor1.GetDead == 0 || TKBrinaCrossCouncilor2.GetDead == 0

		if gamehour >= 10 && gamehour < 21 

		unlock  

	else 

		lock  

	endif

endif


end

Both of the NPCs have had their EDIDs set to TKBrinaCrossCouncilorXREF, and I have tried several iterations, but no matter what, the door just will... not... open....

All persistent reference flags are ticked (the refs are two NPCs and a load door, so they have to be persistent).

I don't want to have to set it to be permanently unlocked, but if things come to that, I don't see too many other options. I have one last debug option at my disposal, but after that... I don't know what else to do for this.

Edited by ThomasKaira
Link to comment
Share on other sites

You need to change the getDead check from == 0 to == 1.

Then kill one or both of the NPCs and it should work.

And make sure the proper script is actually on the door you have in the cell. This is IMPORTANT because its easily missed as, 'of course it is' and it really isnt. ;)

Link to comment
Share on other sites

OK, I'm about ready to give up here. I've recently discovered the AI method is causing the door to mysteriously re-lock itself whenever I visit the cell, and despite everything I try, the script fails to work.

This is the current script:

scn TKBrinaCrossForumUnlock


begin gamemode


if TKBrinaCrossCouncilor1.GetDead == 0 || TKBrinaCrossCouncilor2.GetDead == 0

		if gamehour >= 10 && gamehour < 21 

		unlock  

	else 

		lock  

	endif

endif


end

Both of the NPCs have had their EDIDs set to TKBrinaCrossCouncilorXREF, and I have tried several iterations, but no matter what, the door just will... not... open....

All persistent reference flags are ticked (the refs are two NPCs and a load door, so they have to be persistent).

I don't want to have to set it to be permanently unlocked, but if things come to that, I don't see too many other options. I have one last debug option at my disposal, but after that... I don't know what else to do for this.

Don't you need a reference to the door for the unlock and lock functions?

Link to comment
Share on other sites

Don't you need a reference to the door for the unlock and lock functions?

Not if the script is ON the door.

Well, that's the thing. I'm trying to check that they are ALIVE. I have no intention of killing them, and they are not intended to ever die at this point.

I had a reread of your OP. I see now that you were using negative logic. :lmao:

Yeah, make it == 0 if you want them alive. If you want them to both be alive, change the || to && in the IF condition.

If you can't get it to work, you may need to upload the ESP only here and I can take a look at it.

Link to comment
Share on other sites

Both of the NPCs have had their EDIDs set to TKBrinaCrossCouncilorXREF, and I have tried several iterations, but no matter what, the door just will... not... open....

Then this is how you need to reference them in the script. You're still using "if TKBrinaCrossCouncilor1.GetDead". Change it to the Ref ID.

  • Upvote 1
Link to comment
Share on other sites

Well, the script works... sorta.

It's only cycling the locks when it feels like doing so (which is to say it's only working about 25% of the time, and never consistently), but otherwise, it works.

edit: Thanks for that Hana, it's working consistently now.

All this trouble over a single door. What a night, eh? :bagged:

Edited by ThomasKaira
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...