Pap - Setting a quest stage based on previous quest state

Post » Thu Jun 21, 2012 10:52 am

I'm trying to set up a trigger where the player would begin a quest based on whether other quests have been completed. If the other quests have been completed then set stage to 10 for the new quest.

I really don't know the syntax for doing this in Papyrus and I hope someone can give me some ideas.

Here's a simple bit of code that should explain what I'm trying to do:

	If GetQuestCompleted(LBGQuest10ElisifsLetter) == 1	    myQuest = LBGQuest20FisherHouse	endif...bunch of codemyQuest.setStage(10)

I hope I explained what I'm trying to do well enough :smile:

Thank you for your help!
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Thu Jun 21, 2012 12:54 pm

The idea of what I am trying to do, overall, is to set several trigger boxes around the mod that would start various quests.

It would need to pull in a quest (maybe from a formlist I guess) and check whether the quest has been completed and if not go through some other stuff that I already have then set the stage to the new quest to 10 in order to start it.

Thanks!
User avatar
lauraa
 
Posts: 3362
Joined: Tue Aug 22, 2006 2:20 pm

Post » Thu Jun 21, 2012 1:27 pm

Ok...

I found a script that almost does what I need to do:

FormLIST property listOfObjectsFORMLIST auto;-------- VarsObjectReference curRefint curIndexint totalInt Property DoOnce = 0 Auto;--------Event onTriggerEnter(ObjectReference objRef)	if(objRef == game.getplayer()) && DoOnce == 0		    curRef = (listOfObjectsFORMLIST.getat(0) as ObjectReference)		;---------------------- Initialize ---------------------		total = listOfObjectsFORMLIST.GetSize()		curIndex = 0		;-------------------------------------------------------		if(curRef.isEnabled())			while(curIndex < total)				curRef = (listOfObjectsFORMLIST.getat(curIndex) as ObjectReference)				curRef.disable()				curIndex += 1			endWhile		else			while(curIndex < total)				curRef = (listOfObjectsFORMLIST.getat(curIndex) as ObjectReference)				curRef.enable()				curIndex += 1			endWhile		endif		;--------------	endifDoOnce = 1endEvent

Can someone help me with the syntax in making this test whether quests that would be in the formlist are either running or completed and if false pick a quest from the formlist and set the stage of it to 10?

Please?

Thanks!
User avatar
NEGRO
 
Posts: 3398
Joined: Sat Sep 01, 2007 12:14 am

Post » Thu Jun 21, 2012 7:31 am

It's been 30 years or so since I've programmed but wasn't there an RND() function in BASIC?

Does Papyrus have something similar?
User avatar
Genevieve
 
Posts: 3424
Joined: Sun Aug 13, 2006 4:22 pm

Post » Thu Jun 21, 2012 5:05 pm

by rnd() do you mean random (i am also an old fart, and i first started programming BASIC on a Apple II LOLLLLL). its been so long i totally forgot most of the syntax


in papyrus you can do random by using:

int whateverRandomIntVariable = Utility.RandomInt(0,5)

which will return a random ineger between 0 and 5, including 0 and 5 themselves (so a 1 in 6 chance total).



as for your syntax for formlists, it is actually listed there in your example code:

FormlistProperty.GetAt(integer)

FormlistProperty is the property you set to point at your formlist object

GetAt() is the function you use to parse the index of the formlist

and the integer you pass as an argument is the index number of the item in the formlist (which starts at 0)


so your formlist should look something like this:

0 - item1
1 - item 2
2 - item3


similar to an array, MyFormList.GetAt(1) will return the item2
User avatar
Kelli Wolfe
 
Posts: 3440
Joined: Thu Aug 23, 2007 7:09 am

Post » Thu Jun 21, 2012 7:46 am

Thanks Amethyst...ya old fart! :smile:

I learned on a UNIVAC 9030 at Cal State Fullerton in the mid-seventies. Did you know there is still a UNIVAC users group? The spokesperson told me that the UNIVAC 9030 was about the equivalent of a Pentium 286 or so. But the 9030 was about the size of a single car garage. It had reel-to-reel tape readers, punched card readers and all that. My 1st puter was an IBM 3086 latter with an NEC green screen paying Wolfenstein stick figures Woot!

In your example above would this work?

int whateverRandomIntVariable = Utility.RandomInt(0,5)FormlistProperty.GetAt(whateverRandomIntVariable)

I guess after that point I'd have to pull out that index number as an objref (the ID of the Quest)? er ... something?

It's the syntax of Papyrus that makes me stumble. Once I understand what is happening I pick it up pretty quick....except for making quests :/
User avatar
Cartoon
 
Posts: 3350
Joined: Mon Jun 25, 2007 4:31 pm

Post » Thu Jun 21, 2012 5:29 am

Can someone help me with the syntax in making this test whether quests that would be in the formlist are either running or completed and if false pick a quest from the formlist and set the stage of it to 10?
Something like...
FormList Property QuestFLST AutoFunction QuestThingymobopper(Int aiIndex = 0, Quest akQuest = None)	aiIndex = QuestFLST.GetSize()	While (aiIndex > 0)		aiIndex -= 1		akQuest = QuestFLST.GetAt(aiIndex) As Quest		If akQuest.IsCompleted()		ElseIf !akQuest.IsRunning()			aiIndex = QuestFLST.GetSize()			akQuest = QuestFLST.GetAt(Utility.RandomInt(0, aiIndex)) As Quest			akQuest.SetCurrentStageID(10)			akQuest.Start()			aiIndex = 0		EndIf	EndWhileEndFunction
...should do it.
User avatar
Gavin boyce
 
Posts: 3436
Joined: Sat Jul 28, 2007 11:19 pm

Post » Thu Jun 21, 2012 5:52 pm

The other way to do this would be via the Story Manager System.

At some point you should look at it (it's a bit daunting the first few times ... not the world's best ever interface - nor tutorials to go along with it).

There is an SM Node called "Script Event". You could use that (build a Quest Node off it) with a bunch of Quests added to the node. Everytime a script (attached to a trigger box) fired you would send it to that Node and it would select a random Quest from the Node-List

(Like I say, it's a bit daunting ... but this is exactly what it should be used for, so you might want to take a look ... Once you're OK with it, it's a great sub-system)

http://www.creationkit.com/Category:Story_Manager - An Overview of the SM System
http://www.creationkit.com/Bethesda_Tutorial_Story_Manager - A very basic tutorial about the whole system and how to use it
http://www.creationkit.com/SM_Event_Node - The Events it can trap

There's a few other wiki pages linked from those above




(And it's good not to be the oldest old-phart here ... My computing history doesn't go back passed the ZX81 - That's how young I am!!)
User avatar
lucile davignon
 
Posts: 3375
Joined: Thu Mar 22, 2007 10:40 pm

Post » Thu Jun 21, 2012 1:15 pm

Something like...
FormList Property QuestFLST AutoFunction QuestThingymobopper(Int aiIndex = 0, Quest akQuest = None)	aiIndex = QuestFLST.GetSize()	While (aiIndex > 0)		aiIndex -= 1		akQuest = QuestFLST.GetAt(aiIndex) As Quest		If akQuest.IsCompleted()		ElseIf !akQuest.IsRunning()			aiIndex = QuestFLST.GetSize()			akQuest = QuestFLST.GetAt(Utility.RandomInt(0, aiIndex)) As Quest			akQuest.SetCurrentStageID(10)			akQuest.Start()			aiIndex = 0		EndIf	EndWhileEndFunction
...should do it.

Dang JustinOther...that is some great scripting there!

I think it will fit right in with the idea of randomized questing.

I'm thinking of putting several trigger boxes in strategic areas of the town and have a bunch of unique "questing NPCs" that will run up to the player and give him/her a quest once the trigger box has been entered (and of course also have it randomized whether a quest will trigger at all).

I really don't think I could have done what you did there :smile:

Thank you!!
User avatar
ShOrty
 
Posts: 3392
Joined: Sun Jul 02, 2006 8:15 pm

Post » Thu Jun 21, 2012 7:02 pm

The other way to do this would be via the Story Manager System.

At some point you should look at it (it's a bit daunting the first few times ... not the world's best ever interface - nor tutorials to go along with it).

There is an SM Node called "Script Event". You could use that (build a Quest Node off it) with a bunch of Quests added to the node. Everytime a script (attached to a trigger box) fired you would send it to that Node and it would select a random Quest from the Node-List

(Like I say, it's a bit daunting ... but this is exactly what it should be used for, so you might want to take a look ... Once you're OK with it, it's a great sub-system)

http://www.creationkit.com/Category:Story_Manager - An Overview of the SM System
http://www.creationkit.com/Bethesda_Tutorial_Story_Manager - A very basic tutorial about the whole system and how to use it
http://www.creationkit.com/SM_Event_Node - The Events it can trap

There's a few other wiki pages linked from those above




(And it's good not to be the oldest old-phart here ... My computing history doesn't go back passed the ZX81 - That's how young I am!!)

The first two quests I'm finishing up are using the SM.

It's a great way to run some conditions before the quest starts.

Although I don't know how it could be used to randomize quest starting.
User avatar
John N
 
Posts: 3458
Joined: Sun Aug 26, 2007 5:11 pm

Post » Thu Jun 21, 2012 10:20 am

Although I don't know how it could be used to randomize quest starting.

StoryManager event nodes can be either Stacked (meaning the quests are processed in order) or Random (meaning they're processed in a random order). If all your quests could be put in the same node you'd just make it Random, and you could also say how many quests from the node should be started or run concurrently.
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Thu Jun 21, 2012 10:32 am

StoryManager event nodes can be either Stacked (meaning the quests are processed in order) or Random (meaning they're processed in a random order). If all your quests could be put in the same node you'd just make it Random, and you could also say how many quests from the node should be started or run concurrently.

Oh yea, I remember that option

But what about when you use different types of SM events?

For instance, my two quests that I've done are "Change Location Event" nodes.

If I then need to use other events I would then need something that would randomize whether the next quest would be the Change Location Event or Script Event or something else, wouldn't I?
User avatar
!beef
 
Posts: 3497
Joined: Wed Aug 16, 2006 4:41 pm

Post » Thu Jun 21, 2012 7:33 am

The events you wanted to randomize between would need to be in the same node. You could always make them all Script event quests, though, and just have a master OnChangeLocationEvent quest that started them with SendStoryEvent.
User avatar
maya papps
 
Posts: 3468
Joined: Mon Aug 07, 2006 3:44 pm


Return to V - Skyrim