Bedroll Script

Post » Mon Jun 18, 2012 2:33 pm

So currently I am following along using the Bag of Holding mod as an example. Currently I have an BedrollARMO set up with a object and an armor property. Also I have a BedrollACTI set up that has the BedRollARMO as a property and a message property. When clicking on the ACTI I get a message box that either Sleeps( keeps the bed roll ACTI In place) or picks up ( returns the BedrollARMO to the inventory). Two problems, when dropped or equipped from the inventory the BedrollARMO disappears and two, when Sleeps is selected from the message box nothing happens. I assume this is because sleeping is handled by a furniture animation marker as opposed to an activate marker. I have two opens, forcibly open the sleep for how long dialogue when Sleeps is chosen from the activator, or use a place at me sort of thing that cause a bedroll furniture marker to appear.

Which function will work the best and what do I need in between to allow for the transistion.
User avatar
Steph
 
Posts: 3469
Joined: Sun Nov 19, 2006 7:44 am

Post » Mon Jun 18, 2012 11:40 pm

Could you please post the scripts you're using at the moment?

I don't think there's a Papyrus function to force the player to sleep, but you should be able to just create a bed, use http://www.creationkit.com/MoveTo_-_ObjectReference to move it to the player's cell, and then force the player to http://www.creationkit.com/Activate_-_ObjectReference it.

Cipscis
User avatar
Roberto Gaeta
 
Posts: 3451
Joined: Tue Nov 06, 2007 2:23 am

Post » Mon Jun 18, 2012 9:34 pm

Scriptname BedRollInventory extends ObjectReference

Int iCount
ObjectReference Property SleepingRollActivatorREF Auto
Armor Property SleepingRollARMO Auto

Event OnLoad() ; ARMO Item dropped. Switch w/ ACTI

SleepingRollActivatorREF.MoveTo(Self) ; Move persistent ACTI here

If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI
SleepingRollActivatorREF.Enable()
EndIf

Disable() ; Garbage disposal
Delete()

EndEvent

;=========================

Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)

If akNewContainer
If akOldContainer
If (akOldContainer == Game.GetPlayer())
akNewContainer.RemoveItem(SleepingRollARMO, 1, True, akOldContainer) ; Player put the item in a container. Put it back
EndIf
ElseIf (akNewContainer == Game.GetPlayer())
iCount = akNewContainer.GetItemCount(SleepingRollARMO)
If (iCount > 0)
iCount -= 1
akNewContainer.RemoveItem(SleepingRollARMO, iCount, True) ; Player has more than one. Fix
EndIf
EndIf
EndIf

EndEvent

;==========================

Event OnEquipped(Actor akActor)

SleepingRollActivatorREF.BlockActivation(False) ; We want a message box, not the sleep menu
Utility.Wait(0.5) ; Wait 'til out of menu(s)
Game.GetPlayer().UnequipItem(SleepingRollARMO, False, True) ; unequip item
SleepingRollActivatorREF.MoveTo(Game.GetPlayer()) ; Move persistent ACTI to player
If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI
SleepingRollActivatorREF.Enable()
EndIf

EndEvent
Thats the code that is on the Armor item.
User avatar
Hearts
 
Posts: 3306
Joined: Sat Oct 20, 2007 1:26 am

Post » Tue Jun 19, 2012 12:51 am

Not to make you upset, but could you use the CODE tags?
User avatar
AnDres MeZa
 
Posts: 3349
Joined: Thu Aug 16, 2007 1:39 pm

Post » Mon Jun 18, 2012 10:18 am

Scriptname BedRollInventory extends ObjectReference
Int iCount
ObjectReference Property SleepingRollActivatorREF Auto
Armor Property SleepingRollARMO Auto
Event OnLoad() ; ARMO Item dropped. Switch w/ ACTI
SleepingRollActivatorREF.MoveTo(Self) ; Move persistent ACTI here
If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI
SleepingRollActivatorREF.Enable()
EndIf
Disable() ; Garbage disposal
Delete()
EndEvent
;=========================
Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)
If akNewContainer
If akOldContainer
If (akOldContainer == Game.GetPlayer())
akNewContainer.RemoveItem(SleepingRollARMO, 1, True, akOldContainer) ; Player put the item in a container. Put it back
EndIf
ElseIf (akNewContainer == Game.GetPlayer())
iCount = akNewContainer.GetItemCount(SleepingRollARMO)
If (iCount > 0)
iCount -= 1
akNewContainer.RemoveItem(SleepingRollARMO, iCount, True) ; Player has more than one. Fix
EndIf
EndIf
EndIf
EndEvent
;==========================
Event OnEquipped(Actor akActor)
SleepingRollActivatorREF.BlockActivation(False) ; We want a message box, not the sleep menu
Utility.Wait(0.5) ; Wait 'til out of menu(s)
Game.GetPlayer().UnequipItem(SleepingRollARMO, False, True) ; unequip item
SleepingRollActivatorREF.MoveTo(Game.GetPlayer()) ; Move persistent ACTI to player
If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI
SleepingRollActivatorREF.Enable()
EndIf
EndEvent
User avatar
Ross Zombie
 
Posts: 3328
Joined: Wed Jul 11, 2007 5:40 pm

Post » Mon Jun 18, 2012 10:32 pm

That sounds like it might have some rich formatting. Try clicking the switch in the upper left of the posting box to switch to a simpler mode, or paste your text into a text editor like Notepad++ first, then copy it again from there.

Cipscis
User avatar
Daddy Cool!
 
Posts: 3381
Joined: Tue Aug 21, 2007 5:34 pm

Post » Mon Jun 18, 2012 9:31 am

Its being wonky I've tried to paste it every way possible but I still am getting the jumbled code tags...
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Mon Jun 18, 2012 11:36 am

Its ok, im starting to work on a Code Indent / Format for Papyrus to be a plugin for Notepad++
User avatar
Jake Easom
 
Posts: 3424
Joined: Sun Jul 29, 2007 4:33 am

Post » Mon Jun 18, 2012 3:56 pm

Ooh, that sounds exciting and useful! Please keep us up to date on your progress :)

Cipscis
User avatar
Mr.Broom30
 
Posts: 3433
Joined: Thu Nov 08, 2007 2:05 pm

Post » Mon Jun 18, 2012 7:43 pm

Ooh, that sounds exciting and useful! Please keep us up to date on your progress :smile:

Cipscis

I am developing it in lua i hope this ok with everyone, so far its working really good except for a few problems gotta work out the comment lexical errors other than that its good. Ill upload it to mediafire once i am done fixing the error (also side tracked with my mods)
User avatar
Kari Depp
 
Posts: 3427
Joined: Wed Aug 23, 2006 3:19 pm

Post » Mon Jun 18, 2012 10:26 pm

Think the moveto function is bugged or at least inaccurate, I tried to do something similar with an droppable container and moveto and
item2.moveto(item1,true) does not put item2 in item1 place then they was dropped or spawned.

you might want to use moveto(Game.GetPlayer()) this will spawn the bedroll under you,
User avatar
k a t e
 
Posts: 3378
Joined: Fri Jan 19, 2007 9:00 am

Post » Mon Jun 18, 2012 8:47 pm

Ok i think i have managed to get it to work, here is the above code that was not formatted now replaced with formatted code from my SkyIndent.lua (going to upload some time today) so its easier on the eyes. Ill also place a tutorial with step by step on how to get this to work with Notepad++
Spoiler

Scriptname BedRollInventory extends ObjectReferenceInt iCountObjectReference Property SleepingRollActivatorREF AutoArmor Property SleepingRollARMO AutoEvent OnLoad() ; ARMO Item dropped. Switch w/ ACTI	SleepingRollActivatorREF.MoveTo(Self) ; Move persistent ACTI here	If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI		SleepingRollActivatorREF.Enable()	EndIf	Disable() ; Garbage disposal	Delete()EndEvent;=========================Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	If akNewContainer		If akOldContainer			If (akOldContainer == Game.GetPlayer())				akNewContainer.RemoveItem(SleepingRollARMO, 1, True, akOldContainer) ; Player put the item in a container. Put it back			EndIf		ElseIf (akNewContainer == Game.GetPlayer())			iCount = akNewContainer.GetItemCount(SleepingRollARMO)			If (iCount > 0)				iCount -= 1				akNewContainer.RemoveItem(SleepingRollARMO, iCount, True) ; Player has more than one. Fix			EndIf		EndIf	EndIfEndEvent;==========================Event OnEquipped(Actor akActor)	SleepingRollActivatorREF.BlockActivation(False) ; We want a message box, not the sleep menu	Utility.Wait(0.5) ; Wait 'til out of menu(s)	Game.GetPlayer().UnequipItem(SleepingRollARMO, False, True) ; unequip item	SleepingRollActivatorREF.MoveTo(Game.GetPlayer()) ; Move persistent ACTI to player	If SleepingRollActivatorREF.IsDisabled() ; If disabled from last time dropped, enable the ACTI		SleepingRollActivatorREF.Enable()	EndIfEndEvent
User avatar
Blessed DIVA
 
Posts: 3408
Joined: Thu Jul 13, 2006 12:09 am


Return to V - Skyrim