Jump to content

Making a Vampire coffin with SLEEP.


antstubell

Recommended Posts

Title should be WITHOUT sleep.

 

I've tried a few ways around this without luck. I want a NPC to use a coffin - go to sleep in it as vampires do - but when player interacts with the coffin I don't want a message saying "Already being used" or the prompt "Sleep" . I want it to say "Open Coffin" and when you do there is sleeping NPC which you can wake up and chat with, etc. On all the coffins in my mod I don't want player to sleep in them just open and close them.

If I remove the marker model from the object then NPC can't use it. I removed the script from a coffin and unchecked the Sleep checkbox in Active Markers and still asks "Sleep?". I tried to finder the marker in CK, it isn't there. I though ok a static coffin with a lay down marker. The Lay Down marker makes NPC lie on her side like in a bed not like Vampire lying on her back.

I'm stuck! In my mod player will never sleep in a coffin or become a Vampire.

Edited by antstubell
Link to comment
Share on other sites

Sounds like coffin needs to be turned into an activator. The name of activator will also be the prompt in game.

 

Can also try making a perk that changes the activation prompt based on some conditions.

 

You could probably change the prompt on the furniture itself, but I can't open the CK right now to check.

Link to comment
Share on other sites

What I've done so far.

Attaching this script...

 

Event OnCellAttach()

Self.SetDestroyed(True)

EndEvent

 

To an activator, in my case furniture, prevents any text appearing but the object still retains complete functionality and appears as normal in game but as I said without any means of interaction. This can be reversed through script. maxarturo pointed me to this.

So now in order to make the coffin open/close requires a primitive activator, or other type, with a script that I am currently working on like this...

 

bool property isOpen = TRUE auto
objectReference property objectToAnimate auto
string property animClose auto
string property animOpen auto

bool busy

Event OnActivate(ObjectReference akActionRef)
if !busy
if animClose && isOpen == TRUE
busy = FALSE
objectToAnimate.playAnimationAndWait(animClose,"done")

ElseIf animClose && isOpen == FALSE
busy = TRUE
objectToAnimate.playAnimationAndWait(animOpen,"done")

Endif
Endif

EndEvent

 

Needs 'fine tuning' because coffin will close but not open.

Edited by antstubell
Link to comment
Share on other sites

Having issues with opening the coffin. Coffin starts open and player can close it but it won't open.

Shed some light on this?

 

bool property isOpen = TRUE auto
objectReference property objectToAnimate auto
string property animClose auto
string property animOpen auto

bool busy

Event OnActivate(ObjectReference akActionRef)
if !busy
if animOpen && isOpen == TRUE
busy = FALSE
objectToAnimate.playAnimationAndWait(animClose,"done")
isOpen == FALSE

ElseIf !busy
If animOpen && isOpen == FALSE
busy = TRUE
objectToAnimate.playAnimationAndWait(animOpen,"done")
isOpen == TRUE

Endif
Endif
Endif

EndEvent

 

Link to comment
Share on other sites

The
bool Function PlayAnimationAndWait(string asAnimation, string asEventName) native
requires :
asEventName: The name of the event to wait for.
Caution: If the event you send it doesn't exist, the function will never return.
Source :
Try this approach.
Your script simplified a little bit, you might need to tweak it a little according to what your needs might be.
* Did not test or compile it, i did it during a long boring break i had.
Example:

bool property StartClosed = False auto
{If checked TRUE it will start in a CLOSED state}
bool property DoOnce = false auto
{If check TRUE it will fire the StartClosed only the first time the cell loads}
bool Property isTriggered = false auto hidden
Auto STATE waiting
Event OnActivate(ObjectReference akActionRef)
If ( !isTriggered )
isTriggered = True
Self.PlayAnimation("YOUR ANIMATION NAME TO CLOSE")
elseif ( isTriggered )
isTriggered = False
Self.PlayAnimation("YOUR ANIMATION NAME TO OPEN")
EndIf
gotoState("waiting")
EndEvent
EndState
Event OnLoad()
If StartClosed == True
Self.PlayAnimation("YOUR ANIMATION NAME TO CLOSE")
isTriggered = True
Else
Self.PlayAnimation("YOUR ANIMATION NAME TO OPEN")
isTriggered = False
EndIf
if DoOnce == true
gotoState("waiting")
EndIf
EndEvent
If is going to be place in an external Activator that will send
the Open/Close animation to the coffin, then :
ObjectReference property objectToAnimate auto
bool property StartClosed = False auto
{If checked TRUE it will start in CLOSED state}
bool property DoOnce = false auto
{If check TRUE it will fire the StartClosed only the first time the cell loads}
bool Property isTriggered = false auto hidden
Auto STATE waiting
Event OnActivate(ObjectReference akActionRef)
If ( !isTriggered )
isTriggered = True
objectToAnimate.PlayAnimation("YOUR ANIMATION NAME TO CLOSE")
elseif ( isTriggered )
isTriggered = False
objectToAnimate.PlayAnimation("YOUR ANIMATION NAME TO OPEN")
EndIf
EndEvent
EndState
Event OnLoad()
If StartClosed == True
objectToAnimate.PlayAnimation("YOUR ANIMATION NAME TO CLOSE")
isTriggered = True
Else
objectToAnimate.PlayAnimation("YOUR ANIMATION NAME TO OPEN")
isTriggered = False
EndIf
if DoOnce == true
gotoState("waiting")
EndIf
EndEvent

 

Edit : Forgot a STATE

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...