Game.GetPlayer().Additem(Torch01) causes erratic behavior (S

Post » Wed Jun 20, 2012 7:19 pm

When trying to add a torch to the player via Game.GetPlayer().AddItem(Torch01), a few strange things happen:
  • When navigating to the inventory, the model is missing from torches: http://i.imgur.com/L6mGm.jpg
  • If you navigate to the torch, then navigate away, and then back again, the model appears, but too large: http://i.imgur.com/BzUBE.jpg
  • Finally, if you equip the torch, the model isn't there, but is emitting light: http://i.imgur.com/4MLT5.jpg
Also, dropping the torch results in nothing being dropped on the ground (no model).

Also note that once I add one torch to my inventory via the above method, every torch from this point forward behaves this way, including any I already happened to have had in my inventory at the time of the AddItem. If I drop all of my torches and pick up a pre-existing torch world object, the behavior continues.

Any ideas? What should be relatively straight-forward seems not to be. I'm guessing this has something to do with the fact that it's technically a light source.

Thanks for any insight.
User avatar
jessica breen
 
Posts: 3524
Joined: Thu Aug 03, 2006 1:04 am

Post » Wed Jun 20, 2012 9:47 am

Can you verify, that in your script references, that your actually pointing to the 'light' object called 'torch01'?
It cannot be any other object type than 'Light'.

And can you verify that normal torchs are not also doing this to your game? Such as you have a mod installed that changes or messes around with 'weapons\torch\torch.nif'.
User avatar
JeSsy ArEllano
 
Posts: 3369
Joined: Fri Oct 20, 2006 10:51 am

Post » Wed Jun 20, 2012 5:37 am

Here is the actual script. It's short. It's purpose was to function as a work-around to another problem; I'm trying to create craftable torches, but Torch01, when specified as the result of a recipe, doesn't show up as craftable in a list. A miscellaneous object that uses the same mesh as a torch, however, does. The point of this script is to detect that such a miscellaneous object was added to the player's inventory, and swap it out with an actual torch. It runs on the MiscItem torch that would only exist after the crafting event (hence the OnInit block and not something else, like OnItemAdded). The Misc Item is being properly removed, and the "real" torch is being properly added.

scriptname _DE_SwapCraftedTorch extends ObjectReferencelight property Torch01 autoMiscObject property _DE_CampTorch_MISC autoEvent OnInit()	debug.notification("I swapped torches")	while Game.GetPlayer().GetItemCount(_DE_CampTorch_MISC) > 0		Game.GetPlayer().RemoveItem(_DE_CampTorch_MISC)		Game.GetPlayer().AddItem(Torch01)	endwhileendEvent

As you can see, I am pointing to torch01 of type "light" (otherwise, my properties wouldn't resolve properly in the CK). There are no other mods installed in the system, and there is no other mesh replacing weapons\torch\torch.nif.

All torches in-game behave exactly as they should before I execute this script. After that, all torches become affected as described above.

Edit: Tested from a new game. Same result.
User avatar
Melanie
 
Posts: 3448
Joined: Tue Dec 26, 2006 4:54 pm

Post » Wed Jun 20, 2012 3:15 pm

Its just a thought, but perhaps instead of the misc object using the 'torch01.nif', you could change that to any other mesh, just to see if using the torch NIF as a misc object is somehow messing up the actual torch light object?
It is a special type of object being a 'light' and may not play well as a different object.. :shrug:

And its not like the player should ever 'see' the misc objects visuals since its being removed on add.
User avatar
Chavala
 
Posts: 3355
Joined: Sun Jun 25, 2006 5:28 am

Post » Wed Jun 20, 2012 5:23 pm

Sure. I will test.
User avatar
^_^
 
Posts: 3394
Joined: Thu May 31, 2007 12:01 am

Post » Wed Jun 20, 2012 7:25 am

Well, I'll be damned. That worked.

Using the same .nif as the torch in this particular case causes strange behavior. When I switched the MiscObject model to a book mesh, the problem went away completely. It works perfectly as intended. Tested several different ways (torches already in inventory, no torches in inventory, viewing / not viewing the inventory first, crafting just one, crafting several quickly, etc), and I couldn't get it to break again.

Thanks! I just wish I knew why it broke in the first place, and why this fixed the problem :geek:

I'll try duplicating the torch .nif mesh and point the MiscObject to the duplicate instead of using the original torch.nif. Edit: Yep. Works just fine now. Thanks again!
User avatar
Charles Mckinna
 
Posts: 3511
Joined: Mon Nov 12, 2007 6:51 am

Post » Wed Jun 20, 2012 6:06 pm

I've had similar weirdness with the torch01 object... I found that if you copy Torch01, and the player equips this second torch, he randomly teleports to a new location.

I think theres somehing hardcoded in the torch01 model nif that makes skyrim go bonkers.
User avatar
Kyra
 
Posts: 3365
Joined: Mon Jan 29, 2007 8:24 am

Post » Wed Jun 20, 2012 1:59 pm

I've had my own suspicions about various aspects of previous games (legacy code) being left over in Skyrim. My work has come across pose01/02/03 (for mannequins)... when using those property NAMES, the poses don't work - no matter what the property is actually assigned to. Change the name, they work fine. My point in mentioning this is that "torch01" (as well as pose01/etc I believe) dates back probably before Oblivion (that's where I started the series). Since they made fundamental changes in Skyrim (and Fallout), there's bound to be leftovers causing issues.

Amazing how simply renaming something can solve the strangest issues.
User avatar
Nims
 
Posts: 3352
Joined: Thu Jun 07, 2007 3:29 pm


Return to V - Skyrim