local fish = {'Quara Mantassin'}
local str = 'This key holds the soul of a '
function onUse(cid, item, fromPosition, itemEx, toPosition)
local desc = getItemAttribute(item.uid, 'description')
local summon = string.sub(desc, string.len(str))
local creature = itemEx.uid
local name = isMonster(creature) and getCreatureName(creature)
-- Disallows use in protection zones
if getTilePzInfo(fromPosition) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You may not use this in a protection zone.')
return true
end
-- If the key string is in the description, it will summon the monster
if string.match(desc, str) then
doSummonCreature(summon, getClosestFreeTile(cid, fromPosition, true))
doItemSetAttribute(item.uid, 'description', '')
end
-- If itemEx is a creature and its name is in the array, then it will remove and set description
if name and isInArray(fish, name) then
doItemSetAttribute(item.uid, 'description', str .. name)
doRemoveCreature(creature)
end
return true
end
this belongs in requests since you're asking for a script, not one that needs fixing
i put 'this key' but you can obviously change it to fish bowl or whatever you likeCode:local fish = {'Quara Mantassin'} local str = 'This key holds the soul of a ' function onUse(cid, item, fromPosition, itemEx, toPosition) local desc = getItemAttribute(item.uid, 'description') local summon = string.sub(desc, string.len(str)) local creature = itemEx.uid local name = isMonster(creature) and getCreatureName(creature) -- Disallows use in protection zones if getTilePzInfo(fromPosition) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You may not use this in a protection zone.') return true end -- If the key string is in the description, it will summon the monster if string.match(desc, str) then doSummonCreature(summon, getClosestFreeTile(cid, fromPosition, true)) doItemSetAttribute(item.uid, 'description', '') end -- If itemEx is a creature and its name is in the array, then it will remove and set description if name and isInArray(fish, name) then doItemSetAttribute(item.uid, 'description', str .. name) doRemoveCreature(creature) end return true end
this is just an example script of how to do it, you can add effects, animated text or whatever you want to it
this belongs in requests since you're asking for a script, not one that needs fixing
i put 'this key' but you can obviously change it to fish bowl or whatever you likeCode:local fish = {'Quara Mantassin'} local str = 'This key holds the soul of a ' function onUse(cid, item, fromPosition, itemEx, toPosition) local desc = getItemAttribute(item.uid, 'description') local summon = string.sub(desc, string.len(str)) local creature = itemEx.uid local name = isMonster(creature) and getCreatureName(creature) -- Disallows use in protection zones if getTilePzInfo(fromPosition) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, 'You may not use this in a protection zone.') return true end -- If the key string is in the description, it will summon the monster if string.match(desc, str) then doSummonCreature(summon, getClosestFreeTile(cid, fromPosition, true)) doItemSetAttribute(item.uid, 'description', '') end -- If itemEx is a creature and its name is in the array, then it will remove and set description if name and isInArray(fish, name) then doItemSetAttribute(item.uid, 'description', str .. name) doRemoveCreature(creature) end return true end
this is just an example script of how to do it, you can add effects, animated text or whatever you want to it
getting this error:
[31/10/2016 09:55:54] [Error - Action Interface]
[31/10/2016 09:55:54] data/actions/scripts/tools/bowl.luanUse
[31/10/2016 09:55:54] Description:
[31/10/2016 09:55:54] data/actions/scripts/tools/bowl.lua:6: bad argument #1 to 'sub' (string expected, got nil)
[31/10/2016 09:55:54] stack traceback:
[31/10/2016 09:55:54] [C]: in function 'sub'
[31/10/2016 09:55:54] data/actions/scripts/tools/bowl.lua:6: in function <data/actions/scripts/tools/bowl.lua:4>
add print(desc) before local sub
it should be getting description of the item 0.0
might be a 0.4 function
is it the same sub error?still gives me the error probably missing function
is it the same sub error?
does it not print anything?
does it say attempt to call global doItemGetAttribute?
edit: if it does say attempt to call global: consider upgrading to 0.4
https://otland.net/threads/8-60-the-forgotten-server-0-4.240240/
it's pretty much the same as 0.3.6, except the times for globalevents and shit are in milliseconds instead of seconds
+ it has more functions