SImple Script but need your greenlight

Post » Wed Jun 20, 2012 11:44 pm

Hi guys, I am starting a quest

he quest is called: MAYadbaQuest

The following script is to be attached on a War Axe so when the players picks it up it updates the quest in the journal:
Two options the quest has already started (basically superior to 0) or the player has no clue about this quest but still stumble accross the Axe during his Skyrim exploration (quest < 0)

So is my script ok:

Scriptname YadbaWarAxe ObjectReference

Event OnActivate

if (MAYadaQuest < 0)
MAYadbaQuest.SetStage(5)
endif

MAYadbaQuest.SetStage(30)

EndEvent
User avatar
Charles Weber
 
Posts: 3447
Joined: Wed Aug 08, 2007 5:14 pm

Post » Thu Jun 21, 2012 11:24 am

so to make things clear: if you find the axe and you havn't started the quest, the stage should go to 5, if you have already started, it should go to 30?

I'm pretty sure you gonna need an "else" in front of MAYadbaQuest.SetStage(30)
if (MAYadaQuest < 0)  MAYadbaQuest.SetStage(5)else  MAYadbaQuest.SetStage(30)endifEndEvent

And when you go for "onactivate" you won't pick up the axe. You would need "itemcount" i think
User avatar
Samantha Jane Adams
 
Posts: 3433
Joined: Mon Dec 04, 2006 4:00 pm

Post » Thu Jun 21, 2012 6:54 am

ok thanks, you understood well.
Now I would like the script to fire when the player picks up the Axe so what blocktype should I use?
User avatar
Lilit Ager
 
Posts: 3444
Joined: Thu Nov 23, 2006 9:06 pm

Post » Thu Jun 21, 2012 1:47 am

I just started scripting with papyrus too, so its also new to me, but i would go with the getitemcount and by updating every so often... idk if it is the easiest way, but that is how i would try it... :)
User avatar
Lifee Mccaslin
 
Posts: 3369
Joined: Fri Jun 01, 2007 1:03 am

Post » Thu Jun 21, 2012 6:29 am

You could use the OnEquipped Event

(put the script on the axe)

http://www.creationkit.com/OnEquipped_-_ObjectReference

But that will only fire once it is actually equipped, not just picked up (and put in inventory)

Or the OnContainerChanged Event

(again, on the axe)

http://www.creationkit.com/OnContainerChanged_-_ObjectReference

(the example shows you how to check it has been placed in player inventory)


Note:
Whichever you use - In the script, you also need to do an IF test for the stage of your Quest

myQuest.GetCurrentStageID

and check that it is not higher than the appropriate stage already (or it will fire everytime the player equips it, or drops it and picks it up again)


So, something like:

Event XXXXif (myQuest.GetCurrentStageID<5)myQuest.setstage(5)endIfendEvent
User avatar
Jamie Lee
 
Posts: 3415
Joined: Sun Jun 17, 2007 9:15 am

Post » Thu Jun 21, 2012 1:27 am

You need to use the OnEquipped Event

(put the script on the axe)

http://www.creationkit.com/OnEquipped_-_ObjectReference

that would mean he has to equip it, it won't fire when it is in his inventory, right?
User avatar
james reed
 
Posts: 3371
Joined: Tue Sep 18, 2007 12:18 am

Post » Thu Jun 21, 2012 1:08 pm

You were too fast - Read it again ;)
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Thu Jun 21, 2012 8:49 am

I see, you added more ;)
that would work i think :)
User avatar
lexy
 
Posts: 3439
Joined: Tue Jul 11, 2006 6:37 pm

Post » Thu Jun 21, 2012 10:38 am

Thanks guys, really appreciate your help on this...

so that should be the final script?:

Scriptname YadbaWarAxe ObjectReferenceEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)		if akNewContainer == Game.GetPlayer()    		Debug.Trace("I just got put in the player's inventory!") 		elseif (MAYadbaQuest.GetCurrentStageID<0)		MAYadbaQuest.setstage(5)	else        		MAYadbaQuest.SetStage(30)	endifEndEvent
User avatar
Kortknee Bell
 
Posts: 3345
Joined: Tue Jan 30, 2007 5:05 pm

Post » Thu Jun 21, 2012 5:09 am

Thanks guys, really appreciate your help on this...

so that should be the final script?:

Scriptname YadbaWarAxe ObjectReferenceEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)		if akNewContainer == Game.GetPlayer()			Debug.Trace("I just got put in the player's inventory!")		elseif (MAYadbaQuest.GetCurrentStageID<0)		MAYadbaQuest.setstage(5)	else				MAYadbaQuest.SetStage(30)	endifEndEvent

Reading what you wanted to do, this would work better:

Scriptname YadbaWarAxeScriptScriptname [b]extends[/b] ObjectReferenceQuest Property MAYadbaQuest  AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)		if akNewContainer == Game.GetPlayer()			Debug.messagebox("I'm an Axe - I just got put in the player's inventory!")				   if (MAYadbaQuest.GetCurrentStageID<5)						 MAYadbaQuest.SetStage(5)				   else								 ;I don't understand what you mean by this stage 30?						 ;at the moment, when the axe is picked up if the quest is not already at stage 5 - or higher - then it will be set to stage 5						 ;so you could leave this else blank if that is all the axe needs to do				   endif	  endIfEndEvent

Note: You should really read up on ALIASES. Your axe should be an alias in your quest, then you would script on the alias ... that's good, because if you want to use the axe in another quest, this stuff will have disappeared from it when the Quest is complete ...

... but it will do as it is for now ... (I think)
User avatar
Matt Terry
 
Posts: 3453
Joined: Sun May 13, 2007 10:58 am

Post » Thu Jun 21, 2012 2:43 am

Reading what you wanted to do, this would work better:

Scriptname YadbaWarAxeScriptScriptname [b]extends[/b] ObjectReferenceQuest Property MAYadbaQuest  AutoEvent OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)		if akNewContainer == Game.GetPlayer()			Debug.messagebox("I'm an Axe - I just got put in the player's inventory!")				   if (MAYadbaQuest.GetCurrentStageID<5)						 MAYadbaQuest.SetStage(5)				   else								 ;I don't understand what you mean by this stage 30?						 ;at the moment, when the axe is picked up if the quest is not already at stage 5 - or higher - then it will be set to stage 5						 ;so you could leave this else blank if that is all the axe needs to do				   endif	  endIfEndEvent

Note: You should really read up on ALIASES. Your axe should be an alias in your quest, then you would script on the alias ... that's good, because if you want to use the axe in another quest, this stuff will have disappeared from it when the Quest is complete ...

... but it will do as it is for now ... (I think)
yep your right I am not familiar with ALIASES and that the reson I have a stage 30. I guess having an ALIASE for the Axe makes it available ONLY for the given Quest so I don't have to add in my script a stage in case the player found the Axe before the related quest has fired...
User avatar
Laura Shipley
 
Posts: 3564
Joined: Thu Oct 26, 2006 4:47 am


Return to V - Skyrim