Beast transformation and inventory

Post » Sat Nov 17, 2012 12:18 pm

Hi all

I started a topic on the Mods forum as I was looking for a mod a the time, and instead, started down the line of scripting the effect myself.

Here is the link: http://www.gamesas.com/topic/1399485-empty-inventory-on-beast-transformation/

The short version is that I am trying to build a script that will force the player to leave all inventory behind when transforming into a werewolf.

In other words:

- detect a Beast transformation has happened
- move a unique container at the player's location
- transfer inventory items to that container.

Here is the script so far:

Scriptname LycanInventory extends ActiveMagicEffect  Race Property WerewolfRace autoEvent OnRaceSwitchComplete()    ; the race shift takes a few seconds to register   Utility.Wait(5)   if (Game.GetPlayer().GetRace() == WerewolfRace)    ; Place dummy storage at player. Use 0x.    ObjectReference LycanStorage = Game.GetPlayer().PlaceAtMe(Game.GetForm(0x010012C4))    Game.GetPlayer().PlaceAtMe(Game.GetForm(0x000C49ED))  ; Ribcage    ; Game.GetPlayer().PlaceAtMe(Game.GetForm(0x0003AD74))     ; move inventory to container     ; Game.GetPlayer().RemoveAllItems(akTransferTo = LycanStorage, abKeepOwnership = true,abRemoveQuestItems = false)   Else    Game.GetPlayer().PlaceAtMe(Game.GetForm(0x000FE6A9))   ; Werewolf pelt   EndIfendEvent

The script compiles without error but I cannot get it to trigger.

Edit: I got the script to trigger by adding it to the Werewolf Transform Effect. The issues now are that:

1- The script is dropping a wolf pelt and not the ribcage+unique container (so the script still thinks the current race is not Werewolf after transformation)
2- PlaceAtMe drops the item below ground.

Any comment?
User avatar
Betsy Humpledink
 
Posts: 3443
Joined: Wed Jun 28, 2006 11:56 am

Post » Sun Nov 18, 2012 1:25 am

First of all, you should be aware that PlaceAtMe creates a duplicate of every object that uses it, which eventually could lead to save game bloating, so that's something you want to consider. If it's a possibility to use MoveTo, I might suggest using that instead of PlaceAtMe for the inventory container (stuff like ribcages and werewolf pelts should be fine with PlaceAtMe, since the player can always collect and sell them, and PlaceAtMe would overall just work better for those items, assuming they don't always fall through the ground, that is). If you do end up using MoveTo on the container, and don't like the idea of the inventory stacking within the same container, then you can always add extra lines of code to deal with that later. For now you should just focus on making it work and having it be as optimized as possible.

Not sure about the issue with PlaceAtMe dropping the items below ground. Where are the places you tested the script, because sometimes items can end up falling through the ground in certain places anyway. If the issue happens every time without fail, regardless of the location, then I'm not sure exactly what should be done about it there, since PlaceAtMe cannot do the set coordinates like MoveTo can as far as I'm aware.

Also, you're saying that you are ending up with a wolf pelt and not the ribcage and container that's supposed to be showing up? Have you checked to see if you made a mistake in the form's ID for the ribcage yet? You also might want to check and see if it's even possible to access the container as well. I'm not sure if this holds true for PlaceAtMe, but I have read that in order to have the visuals for a container to show after MoveTo is used on it, it must be disabled and then re-enabled after MoveTo has been used on it. At least that's true for in-game console commands, anyway. I have no idea if it's true for MoveTo on containers through Papyrus scripting since I've never successfully gotten MoveTo to work on a container. If the container cannot be accessed at all, even after being disabled and re-enabled, then it must not be working properly, and the script needs editing there.

If you're still having trouble after that, then maybe someone who knows more about scripting can help you.
User avatar
OTTO
 
Posts: 3367
Joined: Thu May 17, 2007 6:22 pm

Post » Sat Nov 17, 2012 9:38 pm

Thanks for the tips.

I didn't know about the cloning issue with PlaceAtMe... I really meant to use it as a move.

The issue with dropped items going underground is a bummer. I will have to think about a solution to that one - maybe what I want to do is not possible (which would explain why nobody has done it yet :) ).

I guess I will have to find a creative workaround.
User avatar
David John Hunter
 
Posts: 3376
Joined: Sun May 13, 2007 8:24 am


Return to V - Skyrim