Jump to content

Modding issue

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")

Share this post

Link to post
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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...