Silver Fred
New Member
- Joined
- Oct 19, 2010
- Messages
- 31
- Reaction score
- 0
Hey there everyone, this is my first script. Please evalute it.
Explanation:
You have to throw the meat on the campfire and it will be cooked.
Explanation:
You have to throw the meat on the campfire and it will be cooked.
Code:
<movevent type="AddItem" tileitem="1" itemid="[COLOR="gray"]1423[/COLOR]" event="script" value="cooking.lua"/>
campfire = Can change id.
cooked meat = Can change id for any other.
burned meat = Can change id for any other, but you have to change both.
food text = Write whatever you want.
burn text = /\
Code:
---ID LIST---
--2227 - Cooked Meat
--2666 - Raw Meat
--2241 - Fail
--------------------
local [B]raw meat[/B] = moveitem.itemid == [COLOR="#a0522d"]2666[/COLOR]
local [B]cooked meat[/B] = moveitem.itemid == [COLOR="#4b0082"]2227[/COLOR]
local [B]chance[/B] = math.random(1,10)
local [B]food[/B] = (cid,[COLOR="#4b0082"]2227[/COLOR],1)
local [B]burn[/B] = (cid,[COLOR="#2e8b57"]2241[/COLOR],1)
local [B]food text[/B] = (cid,22,"[COLOR="red"]You've cooked a Meat.[/COLOR]")
local [B]burn text[/B] = (cid,22,"[COLOR="#00bfff"]You've burned it.[/COLOR]")
function onAddItem(moveitem, tileitem, pos)
if raw meat and item.type == 1 and chance == 1 then
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem(cid,2227,1)
doSendTextMessage food text
elseif chance == 2
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 3
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 4
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 5
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 6
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 7
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 8
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 9
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_GREEN)
doPlayerAddItem food
doSendTextMessage food text
elseif chance == 10
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_RED)
doPlayerAddItem burn
doSendTextMessage burn text
elseif cooked meat and item.type == 1 then
doRemoveItem(moveitem.itemid, 1)
doSendMagicEffect(thing, CONST_ME_MAGIC_RED)
doPlayerAddItem burn
doSendTextMessage burn text
end
end