[Q] Pull up a Portcullis only when you have a key?

Post » Thu Jun 21, 2012 12:27 pm

Hi,

I have a "Pull chain'' and a "Portcullis" in my room.
This is the code for my Pull Chain:
Spoiler
scriptName NorPullBar01SCRIPT extends ObjectReferenceimport debugimport utilityAuto STATE Waiting	EVENT onActivate (objectReference triggerRef)		   if (Game.GetPlayer().GetItemCount(A_LodronsBOSSKey) >= 1)		self.BlockActivation(true)		playAnimationandWait("Pull","Reset")		self.BlockActivation(false)		  else			 ErrorBox.Show()endifendEVENTendStateMessage Property ErrorBox AutoKey Property A_LodronsBOSSKey Auto

As you can see it checks if you have a certain key, and when you have that key it will be able to pull, else it will give a message to you that will say you don't have the key.
Now I've tried the 'Activate Parents', 'Linked From' and 'Linked Ref' tabs but the last two obiously do not work and the first one also opens my "Portcullis" when you don't have the key.

Is there any way I can open the "Portcullis" only when you have the key?
For example changing it's Script Property "isOpen" to "isOpen"?

Thanks in advance.
User avatar
Claudz
 
Posts: 3484
Joined: Thu Sep 07, 2006 5:33 am

Post » Thu Jun 21, 2012 9:00 pm

is this a vanilla skyrim script?

if so, do not overwrite it with your code, because now every single lever that also has this script requires that key.



instead, create a new script and don't link your portcullis by any method (no linked ref, no active parents no nothin)

just have the following inside your key-required conditional:

Portcullis.Activate(TriggerRef)



also the State in the script actually serves no purpose.

if you want to take advantage of the states, delete both blockActivation lines, and rewrite it this way:
(there is also no reason to import debug or utility)


Auto State Waiting   Event OnActivate(ObjectReference akActionRef)	  If (akActionRef.GetItemCount(A_LodronsBossKey) >= 1)		 GoToState("Busy")		 PlayAnimationAndWait("Pull", "Reset")		 Portcullis.Activate(akActionRef)		 GoToState("Waiting")	  Else		 ErrorBox.Show()	  EndIf   EndEventEndStateState BusyEndState

you will have to declare and fill Portcullis to point to your object in the render window
User avatar
Conor Byrne
 
Posts: 3411
Joined: Wed Jul 11, 2007 3:37 pm

Post » Thu Jun 21, 2012 8:54 pm

This is the script I use for it now:
Scriptname A_Lodron_BossChainScriptForKey extends ObjectReference  Auto State Waiting   Event OnActivate(ObjectReference akActionRef)		  If (akActionRef.GetItemCount(A_LodronsBossKey) >= 1)				 GoToState("Busy")				 PlayAnimationAndWait("Pull", "Reset")				 Portcullis.Activate(akActionRef)				 GoToState("Waiting")		  Else				 ErrorBox.Show()		  EndIf   EndEventEndStateState BusyEndStateMessage Property ErrorBox AutoKey Property A_LodronsBOSSKey AutoObjectReference Property Portcullis Auto

Actually most of the script works, but it does not activate the portcullis..
Can you explain EXACTLY how I must point to the portcullis?
I have set the message, key and portcullis now in the script's properties but it does not seem to work.
User avatar
Siidney
 
Posts: 3378
Joined: Fri Mar 23, 2007 11:54 pm

Post » Thu Jun 21, 2012 1:59 pm

i'm assuming the portcullis is some kind of door object, which is why i put Activate (activate function will swing the door open). if it is not a door object, and requires an animation event, you will have to specify that.

if the portcullis is a "nameless" activator object that has its own script to handle the animation, the akActionRef part in the Activate function will have no effect (player cannot activate a nameless activator).

instead you may have to use Portcullis.Activate(Portcullis)

which just means, you are instructing the portcullis to open itself, or...

Portcullis.Activate(Self)

which means the portcullis is being activated by the pullchain
User avatar
Mr. Allen
 
Posts: 3327
Joined: Fri Oct 05, 2007 8:36 am

Post » Thu Jun 21, 2012 1:51 pm

I will try that. What if it does not work? Is there anyone around here with some very good knowledge about Papyrus?
User avatar
Barbequtie
 
Posts: 3410
Joined: Mon Jun 19, 2006 11:34 pm

Post » Thu Jun 21, 2012 1:07 pm

If it doesn't work, then you need to tell us what object you are using for the portcullis.
User avatar
Marquis T
 
Posts: 3425
Joined: Fri Aug 31, 2007 4:39 pm

Post » Thu Jun 21, 2012 11:57 am

Like I said, I'm using a NorPullChain01 (copied) to activate the NorPortcullis
User avatar
Emily Graham
 
Posts: 3447
Joined: Sat Jul 22, 2006 11:34 am

Post » Thu Jun 21, 2012 10:51 pm

I checked the object, but I don't see anything that would stop it from working if you followed the directions from Amethyst Deceiver's last post. Are you saying it still doesn't work?
User avatar
jaideep singh
 
Posts: 3357
Joined: Sun Jul 08, 2007 8:45 pm

Post » Thu Jun 21, 2012 11:28 pm

I did what was said but it does not open.
User avatar
Janette Segura
 
Posts: 3512
Joined: Wed Aug 22, 2007 12:36 am

Post » Thu Jun 21, 2012 10:18 pm

Did you remember to uncheck "Parent Activate Only" on the portcullis?
User avatar
Chris BEvan
 
Posts: 3359
Joined: Mon Jul 02, 2007 4:40 pm

Post » Thu Jun 21, 2012 9:02 am

I have not set an Active Parent? Must I set an active parent?
User avatar
Racheal Robertson
 
Posts: 3370
Joined: Thu Aug 16, 2007 6:03 pm

Post » Thu Jun 21, 2012 9:17 pm

No you don't need one. It's just that you originally had the portcullis set with an activate parent, and you might have forgotten to uncheck that when you changed it.

If that's not the problem, then I don't know what's wrong. I'd tried the script on this topic and it works fine for me.
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Thu Jun 21, 2012 1:51 pm

Thanks it is working now.
You need to use this scipt and appoint the properties ofcourse:
Scriptname A_Lodron_BossChainScriptForKey extends ObjectReference  Auto State Waiting   Event OnActivate(ObjectReference akActionRef)		  If (akActionRef.GetItemCount(A_LodronsBossKey) >= 1)				 GoToState("Busy")				 PlayAnimationAndWait("Pull", "Reset")				 Portcullis.Activate(Portcullis)				 GoToState("Waiting")		  Else				 ErrorBox.Show()		  EndIf   EndEventEndStateState BusyEndStateMessage Property ErrorBox AutoKey Property A_LodronsBOSSKey AutoObjectReference Property Portcullis Auto
User avatar
Josh Sabatini
 
Posts: 3445
Joined: Wed Nov 14, 2007 9:47 pm


Return to V - Skyrim