DarkKreepe Posted March 20, 2016 Share Posted March 20, 2016 (edited) Hi everyone. Please, can you help me with the context menu for my custom pills? I cant understad how work a "Take Pill" action for vanilla Painkillers... This is code of my item item AspirinBottle { Weight = 0.1, Type = Drainable, UseDelta = 0.02, DisplayName = Bottle of aspirin pills, Icon = OZMoreMeds_Aspirin500mg, Tooltip = Tooltip_Painkillers, UseWhileEquipped = FALSE, } I tried to make a custom context menu but my lua script still not working... Edited April 8, 2016 by DarkKreepe Link to comment Share on other sites More sharing options...
Svarog Posted March 20, 2016 Share Posted March 20, 2016 (edited) Vanilla action for it is hardcoded into Java as far as I can tell. Base game meds existed long before .lua modding was easily doable. There are ways to do it easily by using crafting, which I can make you a template for it if you want but to replicate the effect of base game meds would be a tad more difficult I imagine. Edited March 20, 2016 by Svarog DarkKreepe 1 Link to comment Share on other sites More sharing options...
Cyrrent Eiledoll Posted March 20, 2016 Share Posted March 20, 2016 why not use "food"? You can add many different actions to the item (and i think there is a function about Pain reduction or something like this) Link to comment Share on other sites More sharing options...
wintermuteai1 Posted March 20, 2016 Share Posted March 20, 2016 Speaking of this anyone know why the game freezes up if you try to have a drink or food item replicate itself? Was trying to make an item that would create another of itself on use instead of empty bottle and the game freezes no errors just locks up Link to comment Share on other sites More sharing options...
DarkKreepe Posted March 21, 2016 Author Share Posted March 21, 2016 (edited) 9 hours ago, Svarog said: Vanilla action for it is hardcoded into Java as far as I can tell. Base game meds existed long before .lua modding was easily doable. There are ways to do it easily by using crafting, which I can make you a template for it if you want but to replicate the effect of base game meds would be a tad more difficult I imagine. O my hero! I need your help! btw can you help me with this function? JustTookPill(InventoryItem Pill) I found it in ISTakePillAction.lua (TimedActions in lua folder) At least I need a example ... Edited March 21, 2016 by DarkKreepe Link to comment Share on other sites More sharing options...
Svarog Posted March 21, 2016 Share Posted March 21, 2016 (edited) Well, not really medicine but you could use this as a template for medicine. http://www.mediafire.com/download/3gemu3104rcx03g/SVGTestMod.zip What this is is a drainable bottle of Whiskey that isn't classified as food, doesn't have any of the typical food item stuff in the script, it applies the status effect through a lua call, the Drink action itself is actually a crafting recipe that produces a dummy item that is then removed. It's not the best way to implement such things I'm sure but it works for me. Edit: By the way, it doesn't replace the base whiskey and it doesn't spawn at all, you need to use NecroForge or something that can spawn an item via a console command or something to spawn it for yourself, I was too lazy to create a distribution script for a template :S Edited March 21, 2016 by Svarog DarkKreepe and wintermuteai1 2 Link to comment Share on other sites More sharing options...
DarkKreepe Posted March 21, 2016 Author Share Posted March 21, 2016 (edited) 6 hours ago, Svarog said: Well, not really medicine but you could use this as a template for medicine. http://www.mediafire.com/download/3gemu3104rcx03g/SVGTestMod.zip What this is is a drainable bottle of Whiskey that isn't classified as food, doesn't have any of the typical food item stuff in the script, it applies the status effect through a lua call, the Drink action itself is actually a crafting recipe that produces a dummy item that is then removed. It's not the best way to implement such things I'm sure but it works for me. Edit: By the way, it doesn't replace the base whiskey and it doesn't spawn at all, you need to use NecroForge or something that can spawn an item via a console command or something to spawn it for yourself, I was too lazy to create a distribution script for a template :S Svarog, many thanks! In gratitude, I will write about you in my mod. For example, the drug "Svarog". Edited March 21, 2016 by DarkKreepe Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now