J.Dre
Unity Games
Hey everyone,
I was searching through the support area and found a request for this. I thought it may be useful for others, so I released it.
It is a very basic script, that I am sure many of you could have created yourselves, but for those who can't - you're welcome!
TFS 0.3.7
This script does not effect the default healing with food!
data/actions/scripts/foods/food.lua
TFS 0.2.11
This script does not effect the default healing with food!
data/actions/scripts/other/food.lua
Please enjoy and spread some reputation (if I helped you)! :$
Sincerely,
J.Dre
I was searching through the support area and found a request for this. I thought it may be useful for others, so I released it.
It is a very basic script, that I am sure many of you could have created yourselves, but for those who can't - you're welcome!
TFS 0.3.7
This script does not effect the default healing with food!
Code:
[2328] = {84, "Gulp.",
hp = {
[COLOR="#0000FF"]"yes"[/COLOR], [COLOR="darkorange"]10[/COLOR]
},
mp = {
[COLOR="#0000FF"]"yes"[/COLOR], [COLOR="darkorange"]10[/COLOR]
}
},
- Blue:
This is to enable/disable, the "instant" HP or MP for each food type. yes = enable | no = disable. - Orange:
This is the amount that will be instantly given to the player, when eating.
data/actions/scripts/foods/food.lua
Lua:
local FOODS, MAX_FOOD = {
[2328] = {84, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2362] = {48, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2666] = {180, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2667] = {144, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2668] = {120, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2669] = {204, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2670] = {48, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2671] = {1, "Chomp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2672] = {720, "Chomp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2673] = {60, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2674] = {72, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2675] = {156, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2676] = {96, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2677] = {12, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2678] = {216, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2679] = {12, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2680] = {24, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2681] = {108, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2682] = {240, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2683] = {204, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2684] = {60, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2685] = {72, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2686] = {108, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2687] = {24, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2688] = {24, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2689] = {120, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2690] = {72, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2691] = {96, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2695] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2696] = {108, "Smack.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8112] = {108, "Urgh.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2769] = {60, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2787] = {108, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2788] = {48, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2789] = {264, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2790] = {360, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2791] = {108, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2792] = {72, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2793] = {144, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2794] = {36, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2795] = {432, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[2796] = {300, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[5097] = {48, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[5678] = {96, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6125] = {96, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6278] = {120, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6279] = {180, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6393] = {144, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6394] = {180, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6501] = {240, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6541] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6542] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6543] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6544] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6545] = {72, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6569] = {12, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[6574] = {60, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7158] = {300, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7159] = {180, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7245] = {84, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7372] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7373] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7374] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7375] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7376] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7377] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[7963] = {720, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8838] = {120, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8839] = {60, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8840] = {12, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8841] = {12, "Urgh.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8842] = {84, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8843] = {60, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8844] = {12, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8845] = {60, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[8847] = {132, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[9005] = {88, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[9114] = {60, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[9996] = {0, "Slurp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[10454] = {0, "Your head begins to feel better.",
hp = {
"no", 10
},
mp = {
"no", 10
}
},
[11246] = {310, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[11429] = {150, "Mmmm.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12415] = {360, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12416] = {130, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12417] = {60, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12418] = {80, "Crunch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12637] = {510, "Gulp.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12638] = {260, "Yum.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
},
[12639] = {18, "Munch.",
hp = {
"yes", 10
},
mp = {
"yes", 10
}
}
}, 1200
function onUse(cid, item, fromPosition, itemEx, toPosition)
if(item.itemid == 6280) then
if(fromPosition.x == CONTAINER_POSITION) then
fromPosition = getThingPosition(cid)
end
doCreatureSay(cid, getPlayerName(cid) .. " blew out the candle.", TALKTYPE_MONSTER)
doTransformItem(item.uid, item.itemid - 1)
doSendMagicEffect(fromPosition, CONST_ME_POFF)
return true
end
local food = FOODS[item.itemid]
if(food == nil) then
return false
end
local size = food[1]
if(getPlayerFood(cid) + size > MAX_FOOD) then
doPlayerSendCancel(cid, "You are full.")
return true
end
doPlayerFeed(cid, size)
doRemoveItem(item.uid, 1)
doCreatureSay(cid, food[2], TALKTYPE_MONSTER)
if(food.hp[1]) then
food.hp[1] = getBooleanFromString(food.hp[1])
end
if(food.mp[1]) then
food.mp[1] = getBooleanFromString(food.mp[1])
end
if food.hp[1] then
doCreatureAddHealth(cid, food.hp[2])
end
if food.mp[1] then
doCreatureAddMana(cid, food.mp[2])
end
return true
end
TFS 0.2.11
This script does not effect the default healing with food!
Code:
[7377] = {7, "Yum.",
hp = {[COLOR="#0000FF"]true[/COLOR],
[COLOR="#FF0000"]50[/COLOR], [COLOR="#00FF00"]10[/COLOR]
},
mp = {[COLOR="#0000FF"]true[/COLOR],
[COLOR="#FF0000"]50[/COLOR], [COLOR="#00FF00"]10[/COLOR]
}
}
- Blue:
This can be: true or false. It will turn on and off the HP or MP refill. - Red:
This is a required level, for the script to add the HP or MP when eating. Set to "0" to disable. - Green:
This is the amount that will be given to the player, instantly.
data/actions/scripts/other/food.lua
Lua:
local food, full = {
[2362] = {8, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2666] = {15, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2667] = {12, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2668] = {10, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2669] = {17, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2670] = {4, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2671] = {30, "Chomp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2672] = {60, "Chomp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2673] = {5, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2674] = {6, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2675] = {13, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2676] = {8, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2677] = {1, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2678] = {18, "Slurp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2679] = {1, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2680] = {2, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2681] = {9, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2682] = {20, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2683] = {17, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2684] = {8, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2685] = {6, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2686] = {9, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2687] = {2, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2688] = {9, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2689] = {10, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2690] = {3, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2691] = {8, "Crunch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2792] = {6, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2793] = {9, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
},
[2695] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2696] = {9, "Smack.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2787] = {9, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2788] = {4, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2789] = {22, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2790] = {30, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2791] = {30, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2792] = {6, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2794] = {3, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2795] = {36, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2796] = {5, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[2793] = {9, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[5097] = {4, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6125] = {8, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6278] = {10, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6279] = {15, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6393] = {12, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6394] = {15, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6501] = {20, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6541] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6542] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6543] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6544] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6545] = {6, "Gulp.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6569] = {1, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[6574] = {4, "Mmmm.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7158] = {15, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7159] = {13, "Munch.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7372] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7373] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7374] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7375] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7376] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
},
[7377] = {7, "Yum.",
hp = {true,
50, 10
},
mp = {true,
50, 10
}
}
}, 400
function onUse(cid, item, fromPosition, itemEx, toPosition)
local t = food[item.itemid]
if(t ~= nil) then
if(getPlayerFood(cid) + t[1]) >= full then
doPlayerSendCancel(cid, "You are full.")
else
doPlayerFeed(cid, t[1] * 4)
doCreatureSay(cid, t[2], TALKTYPE_ORANGE_1)
doRemoveItem(item.uid, 1)
end
local var {
a = t.hp[1],
b = t.mp[1],
c = t.hp[2],
d = t.mp[2],
e = t.hp[3],
f = t.mp[3]
}
if(var.a) then
if(getPlayerLevel(cid) >= var.c) then
doCreatureAddHealth(cid, var.e)
end
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
end
if(var.b) then
if(getPlayerLevel(cid) >= var.d) then
doPlayerAddMana(cid, var.f)
end
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
end
return true
end
return false
end
Sincerely,
J.Dre
Last edited: