Specific Script Help

Post » Mon Jun 18, 2012 12:17 pm

Well I have made it my personal learning goal to make a script that I am pretty sure is feasible and not too challenging. I have never studied nor used Python but have taken courses in Java and C#, within the C# course we have discussed events and event handling which I am pretty sure is very similar to the way Papyrus works. One thing I am finding tough is the fact that the scripts are being attached to objects ingame rather than just being code that I am generating from the ground up.

Anyways...I am trying to make a simple bed roll mod, here is my concept...

--BedRollDefault is misc item with physics enabled and able to be picked up, bought,sold, dropped by the player( It has the Deer Pelt Mesh and Texture as a placeholder for now).

Ideally, BedRollDefault has a script that runs onActivate, now here I can go two ways ( maybe). In a perfect world I could use an if statement to check if the player was crouched, thus, on I could have the bedrollDown( basic bedroll mesh, texture, with a script that would allow for picking up should the player be standing) appear where the players cursor is and then have the onActivate script for the bedrollDown give me back a BedRollDefault and remove the bedrollDown.

or...I could use a prompt box to ask the user if he/she would like to set up camp (anytime BedRollDefaul is activated/picked up) if yes is selected, then BedRollDefault is removed and bedRollDown appears offset from the player. Not sure how I would get the bed back though.

I'm trying my best but some of the naming conventions are not the easiest to learn. I understand the process that needs to happen but cannot find any reference as to the keywords/implemented code that I need to use.

Edit: Of course this is just a broad explanation, if you would like to see a bit of sample code( the syntax will probably look like C# events/eventhandler style), please let me know
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Mon Jun 18, 2012 2:24 pm

Please?
User avatar
Siobhan Wallis-McRobert
 
Posts: 3449
Joined: Fri Dec 08, 2006 4:09 pm

Post » Mon Jun 18, 2012 2:06 pm

I'm not all that sure I understand what you're looking for, but hopefully these links to some things you'll need to use will be helpful:
  • http://www.creationkit.com/OnActivate_-_ObjectReference
  • http://www.creationkit.com/Show_-_Message
  • http://www.creationkit.com/IsSneaking_-_Actor

Cipscis
User avatar
roxanna matoorah
 
Posts: 3368
Joined: Fri Oct 13, 2006 6:01 am

Post » Mon Jun 18, 2012 4:00 am

Great Help. I really was looking for a good link to the (I guess in Papyrus they're not methods) reference list.
User avatar
Toby Green
 
Posts: 3365
Joined: Sun May 27, 2007 5:27 pm

Post » Mon Jun 18, 2012 2:26 pm

This is one on my list, so please post if you figure it out (then it can come off the list :wink:)


The problem is that ONACTIVATE seems to be meant for items that are placed in world (as in, on the map), not dropped by the PC from their inventory. there is a tutorial on this, on the wiki, with a pillar/shrine

IF you can put an item in inventory that, when dropped has an onactivate capability, then it is easy ... You just get the objects onactivate script to offer two "dialogue" choices:

Sleep?
Pack Up?

On sleep, you just script in the player.sleep command (it probably isn't player.sleep(), but there SHOULD be a similar command to initiate the dialog box to choose for how long.)

On packup, you just script to put the bedroll object back in player inventory (just object pickup code, like any object)

Like I wrote, though, the issue is whether you can do ONACTIVATE for an item you drop from inventory?

(I think there were bedroll/tent/campfire mods for Oblivion & Morrowind?? Be interesting to see hear how those modders solved it in those TES)
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Mon Jun 18, 2012 1:38 pm

If you mean triggering some code when you click on an item in your inventory, then you'll need to use http://www.creationkit.com/OnEquipped_-_ObjectReference.

Note that not all types of object can be equipped like this. Also, you may need to add a http://www.creationkit.com/Wait_-_Utility so the rest of your script will wait until the player closes the inventory menu.

Cipscis
User avatar
CHANONE
 
Posts: 3377
Joined: Fri Mar 30, 2007 10:04 am

Post » Mon Jun 18, 2012 11:08 am

If you mean triggering some code when you click on an item in your inventory, then you'll need to use http://www.creationkit.com/OnEquipped_-_ObjectReference.

Note that not all types of object can be equipped like this. Also, you may need to add a http://www.creationkit.com/Wait_-_Utility so the rest of your script will wait until the player closes the inventory menu.

Cipscis

:smile:
This is how I was going to cheat. You basically have a night-shirt with an onEquip script. Because there is no third-person view when sleeping, you don't need to animate lie down ... onequip runs the sleep message box asking how long
...Scripting Reference to all (known) functions: http://www.creationkit.com/Category:Papyrus
User avatar
Lexy Corpsey
 
Posts: 3448
Joined: Tue Jun 27, 2006 12:39 am

Post » Mon Jun 18, 2012 2:43 am

I was hoping that I could differentiate between on active and onactive is sneaking. I know a mod from Oblivion did this. That way it could be picked up when you were standing or activated when sneaking. I guess the object played the role of acivator and misc. inventory item but only when onactive is sneaking is false...maybe with SKSE
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Mon Jun 18, 2012 4:55 am

If you call http://www.creationkit.com/IsSneaking_-_Actor in your http://www.creationkit.com/OnActivate_-_ObjectReference block, you could change how the object reacts when it's activated depending on whether the actor activating it is sneaking or not.

Cipscis
User avatar
Joie Perez
 
Posts: 3410
Joined: Fri Sep 15, 2006 3:25 pm

Post » Mon Jun 18, 2012 4:32 am

You can pull the switcharoo, Here's Bag of Holding's container and inventory item scripts, modified for a sleeping roll activator.

Inventory item
Spoiler
ScriptName SleepingRollArmorScript extends ObjectReferenceInt iCountObjectReference Property SleepingRollActivatorREF  AutoArmor Property SleepingRollARMO  AutoEvent OnLoad() ; ARMO Item dropped. Switch w/ ACTI	; Move persistent ACTI here	SleepingRollActivatorREF.MoveTo(Self)	; If disabled from last time dropped, enable the ACTI	If SleepingRollActivatorREF.IsDisabled()		SleepingRollActivatorREF.Enable()	EndIf	; Garbage disposal	Disable()	Delete()EndEvent;=========================Event OnContainerChanged(ObjectReference akNewContainer, ObjectReference akOldContainer)	If akNewContainer		If akOldContainer			If (akOldContainer == Game.GetPlayer())				; Player put the item in a container. Put it back from whence it came				akNewContainer.RemoveItem(SleepingRollARMO, 1, True, akOldContainer)			EndIf		ElseIf (akNewContainer == Game.GetPlayer())			iCount = akNewContainer.GetItemCount(SleepingRollARMO)			If (iCount > 0)				iCount -= 1				; Player has more than one. Fix				akNewContainer.RemoveItem(SleepingRollARMO, iCount, True)			EndIf		EndIf	EndIfEndEvent;==========================Event OnEquipped(Actor akActor)	; We want a message box, not the sleep menu	SleepingRollActivatorREF.BlockActivation(False)	; Wait 'til out of menu(s)	Utility.Wait(0.5)	; unequip item	Game.GetPlayer().UnequipItem(SleepingRollARMO, False, True)	; Move persistent ACTI to player	SleepingRollActivatorREF.MoveTo(Game.GetPlayer())	; If disabled from last time dropped, enable the ACTI	If SleepingRollActivatorREF.IsDisabled()		SleepingRollActivatorREF.Enable()	EndIfEndEvent
Activator
Spoiler
ScriptName SleepingRollActivatorScript extends ObjectReferenceInt bMessage = 0Int iCount = 0Int bShowOnce = 1Armor Property SleepingRollARMO AutoMessage Property SleepingRollMESG AutoEvent OnLoad()	bMessage = 1	BlockActivation(True)EndEvent;==========================================Event OnGrab()	bMessage = 1	BlockActivation(True)EndEvent;===========================================Event OnActivate(ObjectReference akActionRef)	If akActionRef == Game.GetPlayer()		If Game.GetPlayer().GetItemCount(SleepingRollARMO)			BlockActivation(False)		ElseIf bMessage			Int iButton = SleepingRollMESG.Show()			If (iButton == 0)  ; Sleep				BlockActivation(False)				Activate(Game.GetPlayer())				bMessage = 0				If bShowOnce					bShowOnce = 0					Debug.MessageBox("After dropping your sleeping roll, it will prompt the sleeping menu. To put it back in your inventory, grab it, let it go, then activate it again.")				EndIf			ElseIf (iButton == 1) ; Take				Disable()				bMessage = 1				Game.GetPlayer().AddItem(SleepingRollARMO, 1)				BlockActivation(False)			EndIf		EndIf	EndIfEndEvent

Should work with some finagling. As the above is set up, either dropping the item or equipping the inventory item should place the sleeping roll at the player. Might need to fine tune the positioning of the MoveTo stuff.
User avatar
Lisa
 
Posts: 3473
Joined: Thu Jul 13, 2006 3:57 am

Post » Mon Jun 18, 2012 4:36 am

Thank you sir, definately helps to have a script that references that.
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Mon Jun 18, 2012 11:05 am

Have a look at http://www.mediafire.com/download.php?si6e1dywqs577ic and drop the inventory item to see the switcharoo. An ACTI should work the same way.

*adds comments up there^
User avatar
Chris Ellis
 
Posts: 3447
Joined: Thu Jul 26, 2007 10:00 am

Post » Sun Jun 17, 2012 11:16 pm

Have a look at http://www.mediafire.com/download.php?si6e1dywqs577ic and drop the inventory item to see the switcharoo. An ACTI should work the same way.

*adds comments up there^
1000 internetz points for you. :)
User avatar
Julia Schwalbe
 
Posts: 3557
Joined: Wed Apr 11, 2007 3:02 pm

Post » Mon Jun 18, 2012 10:09 am

Any progress being made on this bedroll/campsite mod?
User avatar
Sarah Evason
 
Posts: 3507
Joined: Mon Nov 13, 2006 10:47 pm

Post » Mon Jun 18, 2012 12:16 am

bump
User avatar
Lucky Girl
 
Posts: 3486
Joined: Wed Jun 06, 2007 4:14 pm


Return to V - Skyrim