PC vampire faction detection for simple activator?

Post » Sun Nov 18, 2012 5:45 pm

I'm only new to CK and have been working my way through my first dungeon. I want to have a door open only when and activator is used and the PC is determined to belong to the vampire faction.

Is this possible with std. scripts available or does it require a custom script?

Oh I have never played with scripts before either.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

Post » Mon Nov 19, 2012 1:53 am

If you look in the WAREHOUSE Cells (they are Interior Cells, so select that in the drop down) you will see lots of example traps, ambushes and doors that open with levers and so on.

Find something that suits you can copy ALL of the related objects (usually just the door and the trigger!)

Then paste them into your cell.

Then check that the things are linked together in your cell.

There's help on how to set it all up, here: http://www.creationkit.com/Bethesda_Tutorial_Traps_and_Prefabs#Basic_Activation_Parenting


And yes, you would need to add a couple of lines of script, to the ACTIVATOR, to check that the NPC doing the activation was by the Player and that the player was in a vampire-faction



So, if you can get the door working WITHOUT that check, post again and me (or someone else, I've no doubt) will help you with the bit of scripting

:)
User avatar
Ownie Zuliana
 
Posts: 3375
Joined: Thu Jun 15, 2006 4:31 am

Post » Sun Nov 18, 2012 8:41 pm

Thanks very much for giving me a hand.

I was a bit longer getting back to you on this as I was trying to get the CasCoffinPuzzleSpike01 from Dawnguard to act as the activator, and I eventually worked out that I could get a NorPullChain01 to work from it by attaching it the same way as a manequin activator.

So for all intents and purposes it could just be treated like the Nord pull chain. I had a look over some of the script tutorials and got a basic one to work.
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Sun Nov 18, 2012 9:46 pm

Thanks very much for giving me a hand.

I was a bit longer getting back to you on this as I was trying to get the CasCoffinPuzzleSpike01 from Dawnguard to act as the activator, and I eventually worked out that I could get a NorPullChain01 to work from it by attaching it the same way as a manequin activator.

So for all intents and purposes it could just be treated like the Nord pull chain. I had a look over some of the script tutorials and got a basic one to work.
That's OK - Sounds like you're well on your way to having it work how you want, so well done :)
User avatar
Stacy Hope
 
Posts: 3391
Joined: Thu Jun 22, 2006 6:23 am

Post » Sun Nov 18, 2012 8:23 pm

I have been trying to find examples that I could use to give me an idea on where to start working on the script. I'm at a loss to know what parameters I should be checking and what ones to set when the condition is/isn't met.
User avatar
James Baldwin
 
Posts: 3366
Joined: Tue Jun 05, 2007 11:11 am

Post » Mon Nov 19, 2012 5:25 am

A script will need to go on the Activator (in an OnActivate() Event)

In the script/event you would need to check (if statements):

If the NPC using the activator is the PLAYER
If the PLAYER is in the correct Vampire Faction


If both of those were true, then you would allow the door to open.


Exactly how you go about it depends on how things are currently setup - Most importantly whether the Activator & Door combo are controlled by script, or by Activate-Parenting. So it's difficult for me to be precise with what you need to do.




Some examples:

How to make things work: http://www.creationkit.com/Complete_Example_Scripts#A_Fully_Functional_Dwemer_Button (this shows you how to setup a "Dwemer Button" to do things ... Your lever for your door would need a similar script)

Note: If you copied things from a warehouse cell, then you may well be currently using Parenting to activate ... you can read about that here: http://www.creationkit.com/Bethesda_Tutorial_Traps_and_Prefabs#Basic_Activation_Parenting

Detecting the Player http://www.creationkit.com/Complete_Example_Scripts#A_Trigger_That_Detects_When_The_Player_Enters (that is setup on a trigger box, but hopefully you see how you could use the same commands/syntax)

In a Faction: http://www.creationkit.com/IsInFaction_-_Actor (see the example ... only you would be testing the Player, not a guard)


Note that the examples assume you know about ALIASES & PROPERTIES for your quests


Note: If you are not very experienced at modding/scripting you may well find that doing the tutorial is well worth your while. It won't get this thing working, but it will allow you to start understanding how the whole thing hangs together. This is a very complex toy and it is little fun if you do not understand how it works behind the scenes. http://www.creationkit.com/Category:Tutorials (we - well, most of us - started off with Bendo!) :wink:
User avatar
Laura Simmonds
 
Posts: 3435
Joined: Wed Aug 16, 2006 10:27 pm

Post » Mon Nov 19, 2012 4:52 am

I pulled this together from a great many scripts so I'm not too sure how this looks to someone who has done scripting for some time.



Scriptname PlayerVampireTestScript extends ObjectReference
;Check to see if player is >= Lv20 and a Vampire

import game
import debug
import utility

int property minLevel = 20 auto

Auto STATE Waiting
Event OnActivate(ObjectReference akActionRef)
if akActionRef == Game.GetPlayer()
if Player.IsInFaction(VampireFaction)
if(game.getPlayer().getLevel() >= minLevel)
self.BlockActivation(true)
else
Debug.Trace("Only powerfull Vampires may enter")
endif
else
Debug.Trace("Perhaps Vampires may only enter")
endIf
endif
self.BlockActivation(false)
EndEvent
endState



I meant this to be a replacement of the NorPullBar01SCRIPT, I'm not sure about the faction naming or Debug.Trace (does it dump to screen?). Have yet to run it through CK, I put this together on a different computer (text is horrible on my game machine) I thought I'd post it first incase I need to make a major re-work.
User avatar
katie TWAVA
 
Posts: 3452
Joined: Tue Jul 04, 2006 3:32 am

Post » Mon Nov 19, 2012 7:42 am

Sorry about the lack of indents, messed it up importing it.
User avatar
Ross Zombie
 
Posts: 3328
Joined: Wed Jul 11, 2007 5:40 pm

Post » Mon Nov 19, 2012 6:02 am

Try:
Spoiler
ScriptName PlayerVampireTestScript Extends ObjectReference{Check to see if player is >= Lv20 and a Vampire}Import DebugImport GameImport UtilityActor Property PlayerREF Auto ; substantially faster than GetPlayerFaction Property VampireFaction AutoInt Property iMinLevel = 20 AutoAuto State Waiting	Event OnActivate(ObjectReference akActionRef)		If akActionRef == PlayerREF			If PlayerREF.IsInFaction(VampireFaction) ; 'Player' was undefined as was VampireFaction				If PlayerREF.GetLevel() >= iMinLevel					BlockActivation(True) ; 'Self' is exteraneous in this context				Else					Debug.Trace("Only powerful Vampires may enter")				EndIf			Else				Debug.Trace("Perhaps only Vampires may enter")			EndIf		EndIf		BlockActivation(False) ; 'Self' is exteraneous in this context	EndEventEndState
To retain indentation, turn off the WYSIWYG with the switch in the upper left when editing a post and wrap your script in:

[spoiler][code]