Lua recipe trait checking?
0

2 posts in this topic

Recommended Posts

So i've been trying to figure out how i can get a OnCreate:(This case "recipe_DoStuff") to successfuly check and fire a output if a trait is met.

I'm not too sure what i'm doing wrong here.

 

function recipe_DoStuff(items, result, player)
    --other stuff
        if player:hasTrait("WeakStomach") == true then
        player:Say("I Pooped my pants.");  --this would be my generic output.
        end
    --other stuff
end 

 

This file is in media/lua/server, if that makes a difference.

Share this post


Link to post
Share on other sites

You will want to move this file to media/lua/client rather than media/lua/server/. You'll also want to verify your recipe in your txt file has the OnCreate: line calling this function.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
0