0arisaka0 Posted April 7, 2017 Share Posted April 7, 2017 Hello ðI am creating a mod that will yield 'empties' when you use a consumable.. for example, then you eat a noodle cup, you get a ceramic bowl. I looked at the script Beth used to add a bottle cap when a Nuka-cola is drank and changed it for my use. My question is that I have scripts for each modified item and I'd like to combine them into one script so I'd like help in how I can have one, cohesive script that can handle it all, instead of having many. Thank you ðð Link to comment Share on other sites More sharing options...
werr92 Posted April 7, 2017 Share Posted April 7, 2017 You can put one script on every base object in the Object Window panel, simply fill out the properties differently for all of them. You can fill it as a bowl for one instance and as a bottlecap for another. The source code remains the same, no need to write and compile a new script. Link to comment Share on other sites More sharing options...
0arisaka0 Posted April 7, 2017 Author Share Posted April 7, 2017 ah I see, so instead of having the the name of the object I want to have spawn as the object name in the script (e.g. Bowl_02_ceramic), use another baribale name, like "emptyadder", then link to item inthe script property thatin the MGEF? Am I reading that right? Link to comment Share on other sites More sharing options...
caleb68 Posted April 7, 2017 Share Posted April 7, 2017 all you really need to do is duplicate the effect for the bottle cap adder, and give it a new name, i.e. mymod_bowladder edit the effect, and down in the script window, click on the nukacolabottlecapadderscript and click properties change caps001 to whatever item you want it to add. Repeat for each item type you want to add, i.e. emptybowls, bottles, milkcartons, etc. go to the item you want to add it to, in the results window, click 'new', and on the effect window that pops up, select the effect you created for the item. if it has two items, just add another effect to the results window. you really wouldn't have to write any new scripts that way and it would be compatable with both the xbox and ps4 (if the mod was only adding items for different things like that) sense the ps4 doesn't allow scripting. Things to keep in mind - if these are default items, other mods that change them will either be overriden by yours or override yours depending on the load order, i.e. there's a mod out there that changes the default names of the food / drink objects, so if yours was loaded after it it would override that mod. I did something similar in one im working on, that gives empty bottles along with the cap when they drink the drink. (however this mod won't be ps4 compatable as it has custom scripts for other things) Link to comment Share on other sites More sharing options...
0arisaka0 Posted April 7, 2017 Author Share Posted April 7, 2017 Thanks. That is what I did when I started. I will let ya know how it works ðð Link to comment Share on other sites More sharing options...
0arisaka0 Posted April 7, 2017 Author Share Posted April 7, 2017 It works, ty ð Link to comment Share on other sites More sharing options...
caleb68 Posted April 7, 2017 Share Posted April 7, 2017 np :) makes for a good little addition, I didn't like the idea of eating glass, is why I did the bottles lol, plus I made a still that allows the creattion of wine n' beer for this mod im working on, (yes i know you don't make beer at a still) which requires empty bottles for the various types :) Link to comment Share on other sites More sharing options...
0arisaka0 Posted April 8, 2017 Author Share Posted April 8, 2017 lol it's funny you say that! I've already written up my mod page, and talking about dubiousness of swallowing a whole bottle of water when drinking was commented on. ððð Link to comment Share on other sites More sharing options...
kitcat81 Posted April 9, 2017 Share Posted April 9, 2017 (edited) Maybe it`s too late to answer this but to combine them all in the same script you could use a reference alias for player. In this case you would have only 1 script running, you also would not need to alter any game objects and your mod would be compatible with other mods that can change them. Though the mod probably would not work for PS4 because of a new script. If you decide to try this way look at the ReconScopeQuest. You can duplicate it, remove all data from all tabs apart from ReferenceAlias Player, set quest priority something like 45. Open Alias Player, remove the recon scope script and add a new script. The script can be written in different ways, depends on wether you want to add the same item for different kinds of food ( i.e. a ceramic bowl for both noodles and different soups) or to add a different item for each kind of food (i.e. a ceramic bowl for noodles, plastic bowl for soup , etc).In the first case you need to create a few formlists for food groups . For example a formlist "CeramicBowlMeals" should include all food items that will add a ceramic bowl when equipped etc. The script can look like this : Formlist Property CeramicBowlMeals Auto Const Formlist Property CartonBoxMeals Auto Const ; you need to create such a property for each formlist replacing the name with your formlist`s name. I used CatronBoxMeals and CeramicBowlMeals just as an example. Form Property AnItemToAdd01 Auto Const Form Property AnItemToAdd02 Auto Const ; create such a property for each Item that can be added. Later you`ll need to fill them with different items such as ceramic bowl , carton box, etc. Event OnInit() Debug.Notification("Hello!") ; to check if your alias was filled; this event can be removed for release EndEvent Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) If CeramicBowlMeals.HasForm(akBaseObject) ; check if the equipped item is in the bowl list. Game.GetPlayer().AddItem(AnItemToAdd01) ElseIf CartonBoxMeals.HasForm(akBaseObject) ; check if the equipped item is in the box list Game.GetPlayer().AddItem(AnItemToAdd02) ; repeat the condition for every list EndIf EndEventIn the second case you`d need to create 2 formlists : A list of food items and a list of items to add. Make it so they have the appropriate index in the lists (i.e. If Noodles index in the FoodList = 5, Noodles Bowl index in the ItemsToAdList should be equal 5 )You will need to fill script properties with your formlists.The script itself can look like this :Scriptname EquippedItemScript extends ReferenceAlias Formlist Property MyConsumables Auto Const ;Formlist of food items Formlist Property MyItems Auto Const ; Formlist of Items to Add Event OnInit() Debug.Notification("Hello!") ; to check if your alias was filled EndEvent Event OnItemEquipped(Form akBaseObject, ObjectReference akReference) If MyConsumables.HasForm(akBaseObject) Int MyIndex = MyConsumables.Find(akBaseObject) Game.GetPlayer().AddItem(MyItems.GetAt(MyIndex)) EndIf EndEventYou also can combine these ways in the same script by adding "ElseIf" blocks. Edited April 9, 2017 by kitcat81 Link to comment Share on other sites More sharing options...
Recommended Posts