Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

Feanara

Creating new action - need help debugging

Recommended Posts

Feanara    1

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

Share this post


Link to post
Share on other sites
Feanara    1

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

Share this post


Link to post
Share on other sites