[Papyrus] Adding "Close Inventory Command" to my scr

Post » Sun May 18, 2014 4:43 am

Hello there

First of all, I would like to say, I'm a complete noobie at Papyrus. The coding is almost complete Chinese for me. I just don't understand it at all.

Now then, I'm making a mod which lets you breakdown soul gems to dust, and create new soul gems from that dust.

So far, I was able to make all constructable items in order and also make a "Soul Gem Apparatus" which lets you do the crafting by using it from your inventory menu.

This "Soul Gem Apparatus" is a Misc Item, which will need to have a script attached to it. That script will tell it to open a crafting menu.

So far by googling, (after a great hassle!) I have gotten to this script: (I don't know most of what it means, though...)

Scriptname SoulGemApparatusScript extends ObjectReference  Armor Property NullReferenceArmor AutoObjectReference Property CraftingStationReference AutoEvent OnEquipped(Actor akActor)    If( akActor == Game.GetPlayer() )        akActor.EquipItem( NullReferenceArmor, True, True )        Utility.Wait(0.1)        akActor.UnequipItem( NullReferenceArmor, False, True )        CraftingStationReference.Activate( Game.GetPlayer() )    EndIfEndEvent

I have bound the Property "CraftingStationReference" to a piece of Furniture in a random test cell which is in fact a workbench.

I won't bind NullReferenceArmor to anything.

I can get this to work in game. I can also craft my soul gems.

There's only 1 thing missing: When I activate the "Soul Gem Apparatus", I need to close my inventory menu manually.

My question: Is there a way to close the menu automatically? (by adding something to the script)

Thanks in advance

User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Sun May 18, 2014 4:53 pm

Input.TapKey(Input.GetMappedKey("Tween Menu"))

You might also consider just creating recipies. I assume that what you are ultimately after is to make greater soul gems from lesser. You could use the Workbench to smash any soul gem into an appropriate number of soul gem fragments and the Forge to meld a certain number of fragments into a soul gem. Might save you from monkeying around with null armors and such and it would be more intuitive to players.

User avatar
Hot
 
Posts: 3433
Joined: Sat Dec 01, 2007 6:22 pm


Return to V - Skyrim