Jump to content

Modding issue


Regret

Recommended Posts

I am trying to make a mod that makes you vomit on throwup I have an idea of everything, but my problem is with checking if the player has ate a food item that is (Rotten) or (Uncooked)

Is there a method that allows me to check that under a boolean? Am I using the constructor wrong? here is my novice code: 

for playerIndex = 0, getNumActivePlayers() - 1 do
        local player = getSpecificPlayer(playerIndex)
        local food = Eat("Peach (Rotten)")
 
        if food then
            player:Say("I'm gonna be sick")
        end
 
    end
Link to comment
Share on other sites

You might be able to do something using the OnEat value, this is how the game handles cigarettes, berries and mushrooms.
 

See OnEat_Cigarettes and OnEat_WildFoodGeneric in /media/lua/server/recipecode.lua

 

For exampe, create your own function, set it as the OnEat value of every food item - it will then get called when the item is eaten.  Something like:

if food:isRotten() then
...
end

Link to comment
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
×
×
  • Create New...