• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Change Dracoyle Statue

Triarii

New Member
Joined
Jul 27, 2010
Messages
54
Reaction score
0
Location
Jamaica
63958381.jpg


Create a file in "actions/scripts/tools" called "DracoyleStatue.lua" and paste :

DracoyleStatue.lua
Code:
local changeStatue = {
    [9949] = {9948},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if changeStatue[itemEx.itemid] ~= nil then
            local newId = changeStatue[itemEx.itemid][math.random(#changeStatue[itemEx.itemid])]
            doTransformItem(itemEx.uid,newId)
            doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You change a "..getItemNameById(newId))
    end
    return FALSE
end

Now add this to actions.xml :

actions.xml
Code:
<action itemid="2149" event="script" value="tools/DracoyleStatue.lua"/>
 
There is no need for negation to nil, this is enough:
Code:
if changeStatue[itemEx.itemid] then

The message part should look like this:
Code:
'You change a ' .. getItemNameById(newId) .. '.'
So it ends with dot :p.

Also, a note, please use lower-case true/false.

Anyway, thanks for sharing :).
 
Back
Top