Feanara Posted May 21, 2020 Share Posted May 21, 2020 So I'm trying to create a new action for 'DRINK'...it's very similar to eat, but doesn't rot or get removed after use. I've attached both component files, and here's the action code in ModMain: -- ACTIONS GLOBAL.ACTIONS.DRINK = GLOBAL.Action({mount_enabled=true}) GLOBAL.ACTIONS.DRINK.id = "DRINK" GLOBAL.ACTIONS.DRINK.str = "Drink" GLOBAL.ACTIONS.DRINK.fn = function(act) local obj = act.target or act.invobject if act.doer.components.drinker and obj and obj.components.drinkable then print("doing drink action") return act.doer.components.drinker:Drink(obj) end end AddAction(GLOBAL.ACTIONS.DRINK) When I start up with my custom character (who is a drinker and starts with a flask in her inventory), the flask's action does show 'drink' like it should. But when I click it, nothing happens. Here's a snippet for the log file when I only clicked the flask twice: [00:01:07]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:07]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:07]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:07]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:15]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:15]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:15]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:15]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:16]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:17]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:17]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:17]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:17]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:18]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:18]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:18]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:27]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:27]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:27]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:27]: cSoundEmitterComponent::PlaySound() already playing sound named [flyin] [00:01:28]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:30]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:30]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action [00:01:30]: ../mods/MightyNein/scripts/components/drinkable.lua(41,1) inserting drink action none of my other print statements are firing, which means it's calling Drinkable:CollectInventoryActions but nothing else? I've tried to hunt down other mods with custom actions to try and understand this, but I'm pretty stuck at this point. drinker.lua drinkable.lua Link to comment https://forums.kleientertainment.com/forums/topic/118421-creating-new-action-need-help-debugging/ Share on other sites More sharing options...
Feanara Posted May 22, 2020 Author Share Posted May 22, 2020 I was over-complicating it...I scrapped all that and decided to make the drink action redirect to Eat, which worked beautifully. So I no longer need help on this one Link to comment https://forums.kleientertainment.com/forums/topic/118421-creating-new-action-need-help-debugging/#findComment-1335619 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