Jump to content

Quest Stage by door opening


antstubell

Recommended Posts

Hi all.

Can anybody write me a short script that advances a quest by a door being opened/activated, I'm half way there with what I have in mind, would I be correct in saying its something like this...

 

Event

OnActivate.SetStage(40)

 

Considering I've already added a property to the door that links it to a quest, I am probaly miles off I know.

Link to comment
Share on other sites

Hi antstubell,

 

There's an event called OnOpen that might work for you here, as OnActivate would fire whenever the door is activated whether or not it is actually opened (like if it's locked, for example).

 

Something like this would probably do the trick:

ScriptName SetStageOnOpen extends ObjectReference

Quest Property MyQuest Auto
{In the CK, set this to the Quest whose stage you want to set}
Int Property StageIndex Auto
{In the CK, set this to the stage index you want to use in SetStage}

Event OnOpen(ObjectReference akActionRef)
GoToState("Done")
MyQuest.SetStage(StageIndex)
EndEvent

State Done
Event OnOpen(ObjectReference akActionRef)
	; Do nothing
EndEvent
EndState

 

Cipscis

Link to comment
Share on other sites

Hi antstubell,

 

There's an event called OnOpen that might work for you here, as OnActivate would fire whenever the door is activated whether or not it is actually opened (like if it's locked, for example).

 

Something like this would probably do the trick:

ScriptName SetStageOnOpen extends ObjectReference

Quest Property MyQuest Auto
{In the CK, set this to the Quest whose stage you want to set}
Int Property StageIndex Auto
{In the CK, set this to the stage index you want to use in SetStage}

Event OnOpen(ObjectReference akActionRef)
GoToState("Done")
MyQuest.SetStage(StageIndex)
EndEvent

State Done
Event OnOpen(ObjectReference akActionRef)
	; Do nothing
EndEvent
EndState

 

Cipscis

It complied, haven't tested it yet, does it need any properties?

 

Edit- Stage didn't increase. This is the script.

 

Quest Property linetteQST Auto

Int Property StageIndex Auto

 

Event OnOpen(ObjectReference akActionRef)

GoToState("Done")

linetteQst.SetStage(StageIndex)

EndEvent

 

State Done

Event OnOpen(ObjectReference akActionRef)

; Do nothing

EndEvent

EndState

 

Property - Name=linetteqst, Type=Quest, Value=linetteqst

Property - Name=StageIndex, Type=Int, Value=40

Edited by antstubell
Link to comment
Share on other sites

You don't need to re-enter a Event in the "Done" state.

 

I'm guessing that the script doesn't work because you go to the empty state before calling the SetStage?

 

Try swapping SetStage and GoToState

You'd guess correctly maestro.

Edit- Just encountered a new issue. The door is actually a wardrobe with a secret panel behind it, the script you corrected works fine no problem there, behind the secret panel is a thief hiding. The Innkeeper has the key but in dialouge denys any knowledge of a thief hiding there. I pickpocker the innkeeper while he#s asleep SetStage(30), I open the wardrobe with the key SetStage(40) all is well. But on a couple of run throughs when the innkeeper's sleep package comes into effect at 12.00am he should, I chose specific reference in package, a bed upstairs and in search radius also the bed upstairs, should go upstairs but 2 out of 10 times he opens the wardrobe because there is a bedroll in the room behind SetStage(40) - damn. Would deleting the bedroll stop him doing this even though in his package I "told him" to sleep in a specific bed? Will he open the wardrobe whenever he wants to and let the thief out because on 2 occasions the thief wasn't there.

Edited by antstubell
Link to comment
Share on other sites

You don't need to re-enter a Event in the "Done" state.

 

I'm guessing that the script doesn't work because you go to the empty state before calling the SetStage?

 

Try swapping SetStage and GoToState

I'm surprised that apparently worked, since GetStage is not redefined in the "Done" state so will work in exactly the same way if called after the script is sent to that State. If swapping those 2 lines worked, then the original script should also work.

 

Cipscis

Link to comment
Share on other sites

@Cipscis: what i'm guessing is that when you call a GoToState, the script suddenly jumps in the new state, without even finishing running itself in the old state.

 

So calling the SetStage before it ensures that the 1st thing done is calling the stage, then it can safely run the empty state.

 

Also, maybe, putting the 1st event in a Auto State wouls do the trick, dunno.

 

@antstunbell: try putting a radius of 0 in your sleep package. The bed you select isn't the "target of the package". It is just the starting point of it. So if you select that bed with a big enough radius, what the NPC will do is this:

 

- travel to the bed

 

- gather all the beds in the radius

 

- select a random bed among the list

 

- go to that bed and sleep

 

So to fix your issue you can either set the radius to 0, or maybe removing the furniture marker from the bedroll behind the wardrobe, so the bedroll won't be treaten as a sleeping furniture

Edited by gasti89
Link to comment
Share on other sites

@Cipscis: what i'm guessing is that when you call a GoToState, the script suddenly jumps in the new state, without even finishing running itself in the old state.

 

So calling the SetStage before it ensures that the 1st thing done is calling the stage, then it can safely run the empty state.

 

Also, maybe, putting the 1st event in a Auto State wouls do the trick, dunno.

 

@antstunbell: try putting a radius of 0 in your sleep package. The bed you select isn't the "target of the package". It is just the starting point of it. So if you select that bed with a big enough radius, what the NPC will do is this:

 

- travel to the bed

 

- gather all the beds in the radius

 

- select a random bed among the list

 

- go to that bed and sleep

 

So to fix your issue you can either set the radius to 0, or maybe removing the furniture marker from the bedroll behind the wardrobe, so the bedroll won't be treaten as a sleeping furniture

Thanks guys, I replaced the bedroll furniture with a static one, this should solve the problem. My final request for this quest is that the thief hiding in the secret room is VeryAggressive and Foolhardy because I want him to attack the player on sight i.e. as soon as the secret panel behind the wardrobe is opened. This works fine the thief does go berserk but before that when the player enters the inn where the secret room is with the thief, you can hear the thief say something, an attack shout I guess, and he appears as a red dot on the HUD. I'm guessing that disabling the thief until SetStage(30), key to wardrobe pickpocketed successfully is reached might achieve this. But that's assuming the player after acquiring the key goes directly to open the wardrobe as the thief is now enabled he would appear in the HUD. How do I disable/enable a NPC depending on quest stage? Should he be enabled at Stage 30 or 40 when the wardrobe is opened?

Link to comment
Share on other sites

Factions also make him display as a red dot.

 

Remove player-enemy factions, set his behavior to normal (aggressive).

 

Update the door script with this:

 

ScriptName SetStageOnOpen extends ObjectReference

Quest Property MyQuest Auto
{In the CK, set this to the Quest whose stage you want to set}
Int Property StageIndex Auto
{In the CK, set this to the stage index you want to use in SetStage}
Actor property HiddenThief auto
{Fill this property with your thief}

Event OnOpen(ObjectReference akActionRef)
      MyQuest.SetStage(StageIndex)
      HiddenThief.StartCombat(Game.GetPlayer())
      GoToState("Done")
EndEvent

State Done
       Event OnOpen(ObjectReference akActionRef)
               ; Do nothing
       EndEvent
EndState

 

I added a property to be filled with the thief and a scripted StartCombat.

Edited by gasti89
Link to comment
Share on other sites

  • Recently Browsing   0 members

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