Jump to content

Scripting help - Beginer


mounty1512

Recommended Posts

Hi guys

 

I'm pretty new to scripting although have some experience with the G.E.C.K and general use on the creation kit.

I'm currently writing a quest which requires the player to collect 10 firewood and bring it to a character (part of a long series of quests).

I tried to have a look at how the quest to collect 10 bear hides did this but it isn't very clear to me.

 

I'm stuck on scripting the detection of when the firewood is added to the players inventory.

 

Could anyone help with explaining how I would achieve this and what I would attach the quest to (i.e. item, actor or quest)?

 

Any help is much appreciated.

Thanks

Link to comment
Share on other sites

You would use the script command GetItemCount. Where you would put this is really up to you.

 

For example, you can choose to have it as the condition in a dialogue topic (if that's what you need for the quest to advance). Or you can add it to the script of your quest NPC. Or if you have a quest alias for the player, you could put it there. Just know that if you put it in a script, you will need to define an ObjectReference property for your firewood or else you can't use "Game.GetPlayer().GetItemCount(FireWood)".

Link to comment
Share on other sites

Thanks for the quick reply fg109!

 

I've used getitemcount in the dialogue so that the topic is only available when the player has the logs but couldn't work out how to implement it so that once 10 were collected the stage would change (outside of dialogue).

I'll have a go and add player as alias to see if I can get it to work.

I'll let you know how it goes.

 

Thanks again.

Link to comment
Share on other sites

So i've tried adding the script to the player alias but im getting error:

 

c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\woodcheck01.psc(6,0): missing EOF at 'if'

 

here's my script:

Scriptname woodcheck01   

MiscObject Property Firewood01  Auto  


if Game.GetPlayer().GetItemCount(Firewood01) > 10

getowningquest().setstage(20)
getowningquest.displaystage(20)

 

i've also tried with an event:

Scriptname checkforfirewood   

MiscObject Property wood1  Auto  

Event onitemadded(firewood01)

if Game.GetPlayer().GetItemCount(wood1) > 10

       getowningquest().setstage(20)
       getowningquest.displaystage(20)

endif

endevent

that give error:

(5,28): missing ID at ')'

 

I just cant see what's going wrong.

Any help is appreciated.

Link to comment
Share on other sites

OK, if you're adding it to the player alias, your script should look like this:

 

Scriptname checkforfirewood extends ReferenceAlias

MiscObject Property wood1  Auto

Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer)

if akBaseItem == wood1
	if GetItemCount(wood1) >= 10
		getowningquest().setstage(20)
	endif
endif

EndEvent

 

You don't need to use "Game.GetPlayer()" since this script is supposed to be a ref alias on the player. As for all that stuff in the parentheses, those are just the parameters for the event. When an item is added to the inventory, the game gives 4 parameters to the script, so you need to assign variables to them. You don't need to name them akBaseItem, aiItemCount, etc. but they do have to be a form variable, integer variable, etc. in that order.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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