Script Help for a bottle swap.

Post » Tue Nov 20, 2012 10:37 am

I'm a little lost with scripting this event, this is where I am so far.
Player has just recieved a Knock out potion from an alchemist (paralyze 1hr). Player is going to swap a normal bottle of wine for the potion which is inside an identical bottle, all this is setup and now SetStage is set to 70, 70 is blank. The table on which there is a bottle of real wine and a copy of the counterfeit wine/potion disabled has a trigger box around it so when player enters the trigger box and Quest Stage is 70 they will get a debug message asking if they want to do the swap. The counterfeit wine will be removed from player's inventory, the REAL wine of the table will be disabled and the copy of the counterfeit wine which was initially disabled on the table will be enabled. The swap will be complete and SetStage will be set to 80, the triggerbox should never trigger again.
So I have this so far...

Scriptname BottleChangeScript extends ObjectReference
Quest Property myQuest auto

Event OnTriggerEnter(ObjectReference akActionRef)
If (akActionRef == Game.GetPlayer())
If (myquest==70)
debug.messagebox("Do you want to swap the wine for Hazel's potion?")


After this I need the script to offer a choice of Yes or No. No will not advance the quest of course, Yes will do all of the above I mentioned. I hope I explained my objective well enough and really appreciate any help with this, thank you.
User avatar
natalie mccormick
 
Posts: 3415
Joined: Fri Aug 18, 2006 8:36 am

Post » Tue Nov 20, 2012 5:38 pm

ScriptName BottleChangeScript Extends ObjectReferenceActor Property PlayerREF AutoMessage Property YourMESG AutoPotion Property RealWineALCH AutoPotion Property FakeWineALCH AutoQuest Property myQuest AutoObjectReference Property RealWineREF AutoEvent OnTriggerEnter(ObjectReference akActionRef)	If akActionRef == PlayerREF		If PlayerREF.GetItemCount(FakeWineALCH)			Int iButton = YourMESG.Show()			If iButton == 0 ; Yes				PlayerREF.RemoveItem(FakeWineALCH)				RealWineREF.SetScale(0.0)				ObjectReference FakeWineREF = RealWineREF.PlaceAtMe(FakeWineALCH)				RealWineREF.MoveTo(RealWineREF, 0.0, 0.0, -30000.0)				RealWineREF.SetScale(1.0)				RealWineREF.Activate(PlayerREF)				FakeWineREF.BlockActivation()				FakeWineREF.SetMotionType(FakeWineREF.Motion_Keyframed)				myQuest.SetObjectiveCompleted(70)				myQuest.SetStage(80)				Disable()			EndIf		EndIf	EndIfEndEvent
With comments:
Spoiler
ScriptName BottleChangeScript Extends ObjectReferenceActor Property PlayerREF AutoMessage Property YourMESG AutoPotion Property RealWineALCH AutoPotion Property FakeWineALCH AutoQuest Property myQuest AutoObjectReference Property RealWineREF AutoEvent OnTriggerEnter(ObjectReference akActionRef)	If akActionRef == PlayerREF ; MessageBox for Player only		If PlayerREF.GetItemCount(FakeWineALCH) ; Does the player have a counterfeit bottle?			Int iButton = YourMESG.Show() ; "Do you want to swap the wine for Hazel's potion?"			If iButton == 0 ; Yes				PlayerREF.RemoveItem(FakeWineALCH)				RealWineREF.SetScale(0.0) ; Coordinates will still be right on for PlaceAtMe				ObjectReference FakeWineREF = RealWineREF.PlaceAtMe(FakeWineALCH)				RealWineREF.MoveTo(RealWineREF, 0.0, 0.0, -30000.0) ; Move under floor for below...				RealWineREF.SetScale(1.0) ; ...that it will not knock the other bottle around				RealWineREF.Activate(PlayerREF) ; Give the real bottle to the player				FakeWineREF.BlockActivation() ; If it is important that bottle not be tampered with				FakeWineREF.SetMotionType(FakeWineREF.Motion_Keyframed) ; If it is important that bottle not be tampered with				myQuest.SetObjectiveCompleted(70) ; Out with the old				myQuest.SetStage(80) ; In with the new				Disable() ; Kill the trigger box on the way out			EndIf		EndIf	EndIfEndEvent
You'll need to set up a Message form asking the question with Yes/No buttons.
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Tue Nov 20, 2012 5:37 am

Brilliant job JustinOther, here's a quick vid to show your script in action http://www.youtube.com/watch?v=nH_Km4tQCmw&feature=plcp
User avatar
how solid
 
Posts: 3434
Joined: Mon Apr 23, 2007 5:27 am

Post » Tue Nov 20, 2012 10:40 am

Cool! :) I hadn't tried it, so I"m glad to hear/see the switcharoo works well enough.
User avatar
Anna Beattie
 
Posts: 3512
Joined: Sat Nov 11, 2006 4:59 am


Return to V - Skyrim