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

Help with Scripting


Shadowblade
 Share

Recommended Posts

Hi,

I wonder if anyone can help me with this?

I have a very simple mini-Quest mod which I want to work from either end without disabling the target NPC, who is Undead. The quest item is a book which has been lying there for a century, so it will not just "appear" for no reason, so I do not want to disable it.

Stage 10 (find and read a letter)

Adds Journal Entry, Update Map, Add Floating Quest Markers, SetStage(10), SetObjectiveDisplayed(10), Starts Quest

Journal Entry I have read a private letter to some guy…

Objective 10 Search the ruins for the book that interests some guy…

Stage 20 (search ruins, find and kill the revenant, take the book from his inventory)

Updates Journal Entry, Removes Floating Quest Markers, SetStage(20), SetObjectiveCompleted(10), SetObjectiveDisplayed(20)

Journal Entry I have found the ancient tome that interests Some Guy.

Objective 20 Study the Book Some Guy is interested in.

Stage 30 (Readthe Book)

Read the Book, Update Journal, acquire the secret knowledge as a hidden perk added to player, SetObjectiveCompleted(20), SetStage(30), End Quest

These all work fine.

In case the player just explores and find the book on his own, I added Stage 25

Stage 25 (find and kill the revenant, take book from his inventory)

Starts Quest, Updates journal, disables letter, Set Stage(25), SetObjectiveDisplayed(25)

Journal Entry I have found an ancient tome…

Stage 25 Read the Book…

Stage 35 (Read the Book)

Read the Book, Update Journal, acquire the secret knowledge as a hidden perk added to player, SetObjectiveCompleted(25), SetStage(35), End Quest

I've tweaked it as best I can and it works perfectly forwards, but if I find the book before reading the letter, it goes to Stage 20 instead of 35 when I read the book.

If I use If/Else, it won't compile, but if I use If/ElseIf it compiles fine. I suspect OnRead() won't allow arguments, though.

If I read the note it starts Stage 10, then when I take the book from the corpse, it goes to Stage 20 and updates the journal, then when I read the book and it goes to Stage 30 and completes with the correct journal entry.

If I do not read the note and take the book from the corpse, the Quest Starts and it displays Stage 25, then when I read the book it updates but with the Stage 20 journal entry instead of Stage 35 and completes.

Each journal entry has slightly different text so I can tell which Stage it belongs to.

Scriptname SWSQ_QuestStartSCRIPT extends ObjectReference

Quest Property SWSQ_Quest Auto

int Property SWSQ_Quest_Stage Auto

ObjectReference Property SWSQ_MapQuestMRKR Auto

ObjectReference Property SWSQ_Note Auto

Event onRead()

If SWSQ_Quest.GetStage() < 10

SWSQ_Quest.setStage(10)

SWSQ_Quest.SetObjectiveDisplayed(10)

SWSQ_MapQuestMRKR.addtomap()

ElseIf SWSQ_Quest.GetStage() > 10

SWSQ_Note.Disable()

EndIf

EndEvent

Scriptname SWSQ_QuestStopSCRIPT extends ObjectReference

Quest Property SWSQ_Quest Auto

Perk Property SWSQ_QuestPerk auto

ObjectReference Property SWSQ_Note Auto

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

; Letter was read first

If SWSQ_Quest.GetStage() == 10

SWSQ_Quest.SetObjectiveCompleted(10) ; "I have found THE book"

SWSQ_Quest.SetStage(20)

SWSQ_Quest.SetObjectiveDisplayed(20)

; Book is discovered first

ElseIf SWSQ_Quest.GetStage() < 10

SWSQ_Note.Disable()

SWSQ_Quest.SetStage(25) ; "I have found A book"

SWSQ_Quest.SetObjectiveDisplayed(25)

EndIf

EndEvent

Event onRead()

; Letter is read first

If SWSQ_Quest.GetStage() == 20

SWSQ_Quest.SetStage(30)

SWSQ_Quest.SetObjectiveCompleted(20)

Game.GetPlayer().AddPerk(SWSQ_QuestPerk)

; Book is discovered first

ElseIf SWSQ_Quest.GetStage() == 25

SWSQ_Quest.SetStage(35)

SWSQ_Quest.SetObjectiveCompleted(25)

Game.GetPlayer().AddPerk(SWSQ_QuestPerk)

EndIf

EndEvent

The Quest Fragments from the Aliases for the Map Marker and the NPC marker are:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 12

Scriptname QF_SWSQ_Quest_02000D7C Extends Quest Hidden

;BEGIN ALIAS PROPERTY SWSQ_NPCMRKR

;ALIAS PROPERTY TYPE ReferenceAlias

ReferenceAlias Property Alias_SWSQ_NPCMRKR Auto

;END ALIAS PROPERTY

;BEGIN ALIAS PROPERTY SWSQ_MapQuestMRKR

;ALIAS PROPERTY TYPE ReferenceAlias

ReferenceAlias Property Alias_SWSQ_MapQuestMRKR Auto

;END ALIAS PROPERTY

;END FRAGMENT CODE - Do not edit anything between this and the begin comment

Is there anything you can see that might cause this? Stage 20 is being completed even if it is set at Stage 25 and should go to Stage 35.

But if it IS at Stage 20, it goes to Stage 30 as intended.

I suspect that arguments don't work with OnRead(), but I can't find anything definitive about it either way.

Cheers!

~

Edited by Shadowblade
Link to comment
Share on other sites

Well, it saved my last post but still would not save my changes to the OP, so I reloaded the page and there it is - all code removed!

Weird... ???

So this forum's editor allows white space?

Cool!

So, I hope someone can help me with this. It's my first ever mod involving scripts, but I am thinking of giving up forever at the moment as the entire Universe seems to be against me getting it sorted.

Cheers!

~

Link to comment
Share on other sites

  • 2 weeks later...

Cheers,

I haven't checked back as I am following this topic and thought I'd get an e-mail if someone replied.

I have used the debug. thing, but I know which bits are executing because they have different text in the journal entries. It goes from stage 25 to 20, instead of 35. I was hoping someone could fix it.

Cheers

~

Edited by Shadowblade
Link to comment
Share on other sites

My suggestion would be to add conditions to the "setstage" commands. Add a line that requires you to be at the correct stage before moving on. I'd use this. :)

Thanks.

What is the difference between:

int Function GetCurrentStageID() native

int Function GetStage()

int sideQuestStage = SideQuestProperty.GetStage()

and

bool Function IsStageDone(int aiStage) native

bool Function GetStageDone(int aiStage)

bool sideQuestStage25Done = SideQuestProperty.IsStageDone(25)

When would you use one rather than the other?

Cheers!

~

Link to comment
Share on other sites

My suggestion would be to add conditions to the "setstage" commands. Add a line that requires you to be at the correct stage before moving on. I'd use this. :)

I don't get it penguinchao, I've been through it all again and if you read my script it's already got GetStage. But it is not working properly.

It's suppose to go:

10 read letter

20 find and study book

30 get perk and end quest

OR

25 find and read book on your own without reading the letter, disable the letter

35 get perk and end quest

If I do the quest without reading the letter, it's completing the quest but the Journal entry is going from 25 to 20, instead of 35. Each stage has different text so I know which is which. It's working almost perfectly except for the Journal entry.

Any one got any suggestions?

~

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