I'm trying to make a mod for Nehrim that would add a companion to the game.
It works just fine, however, I am now trying to write a script that would allow me to access the inventory of the companion.
I first tried making it all one block, but I wasn't sure if it would continue even in the container menu or if it would pause after the "activate" step and wait until I exited the menu.
THE PROBLEM: The game crashes when I try to remove something from the companion's inventory container. :banghead:
I made it so you could choose the gender of the companion.
I have already had the script set the gender variable, so if you're wondering what that means:
CompanionGender 1 = male
CompanionGender 2 = female
Also, what could I add to make the container appear right behind the player?
You're the best. =)
Begin GameMode
If companioninventoryopen == 1 ;dialog sets this variable
If CompanionGender == 1
CompanionInventory.MoveTo Player 0 0 0
CompanionInventory.RemoveAllItems
CompanionMREF.DuplicateAllItems CompanionInventory ;companioninventory is the reference id for the container
CompanionInventory.Activate Player
set companioninventorymenu to 1
endif
If CompanionGender == 2
CompanionInventory.MoveTo Player 0 0 0
CompanionInventory.RemoveAllItems
CompanionFREF.DuplicateAllItems CompanionInventory
CompanionInventory.Activate Player
set companioninventorymenu to 1
endif
endif
end
begin gamemode
if companioninventorymenu == 1
If CompanionGender == 1
CompanionMREF.Removeallitems
CompanionInventory.DuplicateAllItems CompanionMREF
CompanionMREF.AddScriptPackage CompanionAIEquip ;I saw this used in someone else's script. Was hoping it'd cause the companion to equip any new clothes or armor. I selected Skip fallout, no idle anim, weap.armor unequip
CompanionInventory.moveto COMPINVTO
Set CompanionInventoryOpen to 0
Set CompanionInventoryMenu to 0
endif
If CompanionGender == 2
CompanionFREF.Removeallitems
CompanionInventory.DuplicateAllItems CompanionFREF
CompanionFREF.AddScriptPackage CompanionAIEquip
CompanionInventory.moveto COMPINVTO ;COMPINVTO is a marker I have created in a dummy cell
Set CompanionInventoryOpen to 0
Set CompanionInventoryMenu to 0
endif
endif
end