Progress quest when player picks up item

Post » Tue Aug 20, 2013 7:32 pm

I can't believe how much more complicated scripting is in skyrim. In oblivion, what I want to do is literally a gamemode block with one if statement and one command. I've been trying to get this to work in skyrim's bloated scripting language all day, and it is something that takes literally 15 seconds in oblivion.

What I want to do:

1.) Player picks up book, it's in his inventory.

2.) Progress a quest.

3.) That's it.

This might as well be developing a multiplayer plugin for oblivion, that features xbox kinect support and deposits $100 into your bank account upon installation.

I've tried this as a quest script, and as a script on the book itself.

Quest Property aaaQuestproperty AutoBook Property BookProp AutoFunction SomeFunction()RegisterForUpdate(5.0) ; Before we can use OnUpdate() we must register.EndFunctionEvent OnUpdate() ; This event occurs every five secondsif (Game.GetPlayer().GetItemCount(BookProp) == 1)aaaQuestProperty.setstage(6)aaaQuestProperty.setobjectivecompleted(5)aaaQuestProperty.setobjectivedisplayed(6)endIfEndEvent

Which I've assembled from tutorials. It compiles, but it doesn't do anything in game.

I'm also a little confused by the new property requirement. Why even have names for base objects at all if we have to give them another name EVERY time we use them in a script? That must be a lot of extra data for the engine to keep track of? What's the point?

Thanks for the help.

/misses oblivion

User avatar
Tikarma Vodicka-McPherson
 
Posts: 3426
Joined: Fri Feb 02, 2007 9:15 am

Post » Tue Aug 20, 2013 11:30 am

Look at bottom script in the tutorial where the player picks up an amulet. http://www.creationkit.com/Bethesda_Tutorial_Basic_Quest_Scripting

Event OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)    if (newContainer == Game.GetPlayer())        GSQ01.SetObjectivedisplayed(30)        GSQ01.SetStage(30)    endifEndEvent

Your code doesn't work because Function SomeFunction() isn't being triggered to run by anything. Event OnInit() may have been what you are looking for, but the above script is better as you aren't polling every 5 seconds and it will update immediately when the player picks up the item.

User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Tue Aug 20, 2013 9:47 am

Thank you, that helps me a lot.

User avatar
Haley Merkley
 
Posts: 3356
Joined: Sat Jan 13, 2007 12:53 pm

Post » Tue Aug 20, 2013 10:12 am

Here is the script:

Scriptname aaaTomeScript extends ObjectReferenceQuest Property aaaMainQuest01 AutoBook Property aaaTomeofUnlife AutoEvent OnContainerChanged(ObjectReference newContainer, ObjectReference oldContainer)if (newContainer == Game.GetPlayer())aaaMainQuest01.SetObjectiveCompleted(5)aaaMainQuest01.SetObjectivedisplayed(6)aaaMainQuest01.SetStage(6)endifEndEvent

Still, nothing happens. What now?

User avatar
Andrea P
 
Posts: 3400
Joined: Mon Feb 12, 2007 7:45 am

Post » Tue Aug 20, 2013 8:14 pm

Nevermind, it works. I thought that typing out my Properties would make them work automatically, but apparently you HAVE to use the menu and select the reference. Weird.

User avatar
+++CAZZY
 
Posts: 3403
Joined: Wed Sep 13, 2006 1:04 pm


Return to V - Skyrim