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

Script help needed


sockit2me66
 Share

Recommended Posts

Hello,

I am currently working on a small quest involving gathering 10 samples of two different ingredients. I cannot seem to properly script a method of keeping track of the number of the required items the player has in their possession (x/10). Also, I need the quest stage to advance stage upon the player acquiring the necessary amount of ingredients for each.

Any help would be greatly appreciated. Thanks guys

Link to comment
Share on other sites

I will start with a disclaimer, I don't do quests. So how the script works in quests is beyond my meager skills.
 
But...
 
You can use 'GetItemCount' to find out how many of each object the player has and advance the stage when the criteria are met with 'SetCurrentStageID'.

GetItemCount
http://www.creationkit.com/GetItemCount_-_ObjectReference

SetCurrentStageId
http://www.creationkit.com/SetCurrentStageID_-_Quest
 

Link to comment
Share on other sites

Scriptname QuestItems extends ObjectReference

ObjectReference Property FirstIngredient Auto     ;reference your first ingredient
ObjectReference Property SecondIngredient Auto    ;reference your second ingredient

Quest Property myQuest Auto                       ;reference your quest
Int Property iObjectiveCompleted Auto             ;set what stage would be completed on gathering all the stuff
Int Property iObjectiveToDisplay Auto
Int Property iStageNew Auto                       ;set the stage number of the new (next) stage

Bool myItem1 = False                              ;just some bools to track whether both have been gathered
Bool myItem2 = False

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)
  If (myQuest.GetStage() < iStageNew)            ; stage AFTER the player completed 
	If (akBaseItem == FirstIngredient)       ; Reference the first ingredient
		if aiItemCount >= 10             ; check to see if player has 10 or more
			myItem1 = True           ; set my first item to true is done
                endif
        endif
        if (akBaseItem == SecondIngredient)       ; check for second ingredient
	         if aiItemCount >= 10             ; check to see if player has 10 or more
		      myItem2 = True              ; set my second item to true
	         endif
        endif
        if ((myItem1 == True) && (myItem2 == True))
	     myQuest.SetObjectiveCompleted(iObjectiveCompleted) ;set quest objective done
	     myQuest.SetStage(iStageNew)                    ;set quest to new stage
             myQuest.SetObjectiveDisplayed(iObjectiveToDisplay) ;next objective
        endif
  Endif
EndEvent

If you're still having difficulty, I wrote this one up for you real quick.

I would actually prefer to write this with Alias as they are more 'temporary' but without your quest info, I can't do that here for you.

 

Leianne

Edited by Leianne
Link to comment
Share on other sites

You have to attach that script to the alias. The event gets fired when an item is put into the objects container. So you have to attach that to an player_alias.

 

For game smoothness I would add two global as a count and make the objectives show how much the player has gathered for each ingredient.

 

Check quest NN01 for details. :)

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