president vankk
Web Developer & AuraOT Owner
- Joined
- Jul 10, 2009
- Messages
- 5,719
- Solutions
- 9
- Reaction score
- 339
Code:
Name: System Forge
Version: 8.4x
Type of script: Action
Server Tested: TFS 0.3.4
Author: Flatronez
Edited some things : Beon
Funcionamento:
- The player must have a War Hammer, after pulling the lever becomes a Forge Hammer.
File: Alavanca1.lua
Must be in colocoda lever.
Code:
-- by Beon and Flatronez
function onUse(cid, item, fromPosition, itemEx, toPosition)
local martelo = getThingFromPos({x= 651, y= 849, z= 7, stackpos= 2})
if martelo.itemid == 2391 then
doSetItemActionId(martelo.uid, 9998)
setItemName(martelo.uid, "Forge Hammer")
doSetItemSpecialDescription(martelo.uid, "Can be used to forge weapons.")
doPlayerSendCancel(cid, "Now your hammer is able to forge.")
doSetItemActionId(item.uid, 9997)
else
doPlayerSendCancel(cid, "Only a war hammer can be prepared.")
end
- A piece of iron should be placed in the appropriate place to be prepared before forging. Then it is just to use the Forge Hammer and click on it to be prepared.
File: Hammer.lua
Automatically placed in the Hammer.
Code:
-- by Beon and Flatronez
function onUse(cid, item, fromPosition, itemEx, toPosition)
local player = getCreatureName(cid)
if getItemName(itemEx.uid) == "piece of iron" then
if toPosition.stackpos == 2 then
setItemName(itemEx.uid, "Prepared Metal")
doSetItemSpecialDescription(itemEx.uid, "Can be enchanted by a jewel.")
doPlayerSendCancel(cid, "The metal is prepared to receive the jewel.")
end
-- Se a pedra já estiver encantada ele continua
elseif getItemName(itemEx.uid) == "Enchanted Metal" then
if toPosition.stackpos == 2 then
doCreateItem(2392, 1, toPosition)
doPlayerSendCancel(cid, "Forge done successfully!")
doRemoveItem(itemEx.uid)
else
doPlayerSendCancel(cid, "This is not the correct metal.")
end
end
end
- The metal now ready to be placed in the correct position and also a jewel to be placed in a position so that the metal is delighted with this gem.
Code:
-- by Beon and Flatronez
function onUse(cid, item)
-- Jóia
local joia = getThingFromPos({x= 651, y= 849, z= 7, stackpos= 2})
-- Metal
local metal = getThingFromPos({x= 650, y= 849, z= 7, stackpos= 2})
local metalnew = {x= 650, y= 849, z= 7, stackpos= 3}
if getItemName(metal.uid) == "Prepared Metal" then
if joia.itemid == 2156 then
doCreateItem(2225, 1, metalnovo)
doRemoveItem(joia.uid)
doRemoveItem(metal.uid)
local metal2 = getThingFromPos(metal)
setItemName(metal2.uid, "Enchanted Metal")
doSetItemSpecialDescription(metal2.uid, "Can be forged with a Forge Hammer.")
doPlayerSendCancel(cid, "The metal was enchanted with a jewel.")
doSetItemActionId(item.uid, 9999)
else
doPlayerSendCancel(cid, "This is not the correct jewel.")
end
else
doPlayerSendCancel(cid, "This is not the correct metal")
end
end
For this to work, add this to your actions.xml:
Code:
<action actionid="9999" event="script" value="Alavanca1.lua"/>
<action actionid="9998" event="script" value="Hammer.lua"/>
<action actionid="9997" event="script" value="Alavanca2.lua"/>