lofgren Posted September 2, 2014 Share Posted September 2, 2014 You don't need the global for any other use? It's good that you found a solution, but it bugs me that we don't know why the original script failed. Link to comment Share on other sites More sharing options...
Mattiewagg Posted September 2, 2014 Author Share Posted September 2, 2014 (edited) Would this function work? (Intends to get if the actor is one of the races within the array.) EDIT: Seems to work. Bool Function IsDogRace(Race[] dogArray, Actor WhichActor) ;is the actor this function is being called on one of the dog races in the array? Or any race Int dIndex = dogArray.Length While dIndex If WhichActor.GetRace() == dogArray[dIndex] ;is race Return True Else dIndex -= 1 EndIf EndWhile If dIndex == 0 Return False EndIf EndFunction Edited September 2, 2014 by Matthiaswagg Link to comment Share on other sites More sharing options...
Mattiewagg Posted September 2, 2014 Author Share Posted September 2, 2014 What quest holds the alias for Vigilance and Meeko? Or do they even have one? i.e. do they have a display name, and if so, where it the alias with the display name? Link to comment Share on other sites More sharing options...
Mattiewagg Posted September 2, 2014 Author Share Posted September 2, 2014 Well, it seems like maybe DialogueFollower? That doesn't have a display name though, so maybe not. Or maybe the bug very few of my users have been having is happening to me, but just for dogs. Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 You don't need the global for any other use? It's good that you found a solution, but it bugs me that we don't know why the original script failed.Yeah, I didn't need the global afterwards... I'm done working on that mod now, but my roommate asked me to make him a mod after I showed what I had done to him :pinch: The mod he asked me to make for him, unfortunately, is a "Gold Converter" mod - Essentially he wants an item added to his inventory that, when activated, will allow you to dump all your unwanted/excess items that you either don't feel like, or are unable to, sell to a merchant. He wants the item to "convert" the items put in it into gold, which can them be taken out of it. I said I would do what I can to make it for him. I built a new room, placed a chest in the middle of the room, and built a script based off the one I made previously, and tested it. It works brilliantly, if you don't mind that it only gives you the base item's value (if you put an enchanted item into it, it only gives you the value of the base un/non-enchanted item). My problem is that, as mentioned, he doesn't want to have to coc to a cell, or go somewhere and use a chest, but just use an item in his inventory to achieve what I have done with the chest. Thus, my question is - How do I link an item to a chest, so that it accesses the chest upon activation, and how do I automatically put that item in the player's inventory? Link to comment Share on other sites More sharing options...
lofgren Posted September 2, 2014 Share Posted September 2, 2014 The basic process is to add an OnEquipped event to an object that activates a remote container. So something like: ObjectReference property MyContainer Event OnEquipped(Actor akActor) utility.wait(0.1) ;necessary because you can't open a container from inside your inventory. ;If you want to get fancy you can boot the player out of the inventory screen instead. MyContainer.Activate(akActor) endEvent To add the item to the player's inventory, simply use a quest or make it craftable. Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 I'm so confused right now... I just reloaded my plugin that I'm working with... and realized that for some reason, it has Update.esm, and Dragonborn.esm as masters on top of Skyrim.esm... I only had Skyrim.esm loaded when I was making the plugin though... Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 Never Mind.... Link to comment Share on other sites More sharing options...
Darkxenoth Posted September 2, 2014 Share Posted September 2, 2014 Question: How do you make a container that has an OnClose Event in its script recognize that it has been opened/closed if it is being accessed by an item in the player's inventory? Scripts used: ScriptName ConverterSkullScript extends ObjectReference ObjectReference Property ConversionChestG Auto Event OnEquipped(Actor akActor) Utility.Wait(0.1) ConversionChestG.Activate(akActor) EndEvent ScriptName ConversionChestScript extends ObjectReference ObjectReference Property ConversionChestG Auto MiscObject Property Gold001 Auto Int Property myGoldValue = 0 Auto Int Property itemValue Auto Event OnItemAdded(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) If akSourceContainer == Game.GetPlayer() itemValue = akBaseItem.GetGoldValue() itemValue = (itemValue * aiItemCount) myGoldValue += itemValue EndIf EndEvent Event OnItemRemoved(Form akBaseItem, Int aiItemCount, ObjectReference akItemReference, ObjectReference akDestContainer) If akDestContainer == Game.GetPlayer() itemValue = akBaseItem.GetGoldValue() itemValue = (itemValue * aiItemCount) myGoldValue -= itemValue EndIf EndEvent Event OnClose(ObjectReference akActionRef) Utility.Wait(1.0) ConversionChestG.removeAllItems() Utility.Wait(1.0) ConversionChestG.addItem(Gold001, myGoldValue, true) Debug.MessageBox("Items in the chest have been turned into " + myGoldValue + " gold!") resetGoldValue() EndEvent Function resetGoldValue() myGoldValue = 0 Return EndFunction Link to comment Share on other sites More sharing options...
lofgren Posted September 2, 2014 Share Posted September 2, 2014 Skip the OnClose event and just put your OnClose stuff into ConverterSkullScript after the activate function. Since you've got a utility.wait(1.0) call it will execute when you close the chest and return to the game. Link to comment Share on other sites More sharing options...
Recommended Posts