Well, use use any item id and any storage value, when you give me an example i will figure out to add more, do you agree?
local config = {
{["value"] = -1, ["text"] = "You must start the quest first"},
{["value"] = 1, ["text"] = "Go to basement and kill 10 rats"},
{["value"] = 2, ["text"] = "Back to Sam and talk with him"}
}
local storage = 8000 -- Quest storage ID
local itemID = 1950 -- Item ID showing in the left top corner of the text
function onUse(cid, item, fromPosition, itemEx, toPosition)
for i = 1, #config do
if getPlayerStorageValue(cid,storage) == config[i].value then
doShowTextDialog(cid, itemID, config[i].text)
end
end
return true
end
Here u are:
View attachment 14570
Lua:local config = { {["value"] = -1, ["text"] = "You must start the quest first"}, {["value"] = 1, ["text"] = "Go to basement and kill 10 rats"}, {["value"] = 2, ["text"] = "Back to Sam and talk with him"} } local storage = 8000 -- Quest storage ID local itemID = 1950 -- Item ID showing in the left top corner of the text function onUse(cid, item, fromPosition, itemEx, toPosition) for i = 1, #config do if getPlayerStorageValue(cid,storage) == config[i].value then doShowTextDialog(cid, itemID, config[i].text) end end return true end
local playerPos = getPlayerPosition(cid)
If getTileZoneInfo(playerPos) == 1 then
doSendMagicEffect(playerPos, CONST_ME_POFF)
doPlayerSendTextMessage(cid, 22, 'You cannot use that item in protection zone!')
else
--SCRIPT HERE--
end
<event type="look" name="rang" event="script" value="rang.lua"/>
registerCreatureEvent(cid, "rang")
function onLook(cid, thing, position, lookDistance)
local prefix = "" -- By Erexo
if isPlayer(thing.uid) then
prefix = "He is a"
else
return true
end
local ranga = ""
if getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 50 and getPlayerSkillLevel(thing.uid, SKILL_FISHING) <= 99 then
ranga = "Fisherman"
elseif getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 100 and getPlayerSkillLevel(thing.uid, SKILL_FISHING) <= 149 then
ranga = "Good Fisherman"
elseif getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 150 then
ranga = "Master Fisherman"
else
ranga = "Weak Fisherman"
end
doPlayerSetSpecialDescription(thing.uid, ". " .. prefix .. " " .. ranga)
return true
end
addEvent(function(itemid,pos)
local thing = getTileItemById(pos, itemid)
if(thing.uid > 0) then
doRemoveItem(thing.uid)
end
end,
5 * 60 * 1000,
itemidToRemove,
positionFromWhichWeWantRemove)
i wanna script action
when player use rune ItemID: 12570 than
the Position of player will save than
after 10 sec player will back to old Position and make player say bye bye
function onUse(cid, item, frompos, item2, topos)
local position = getCreaturePosition(cid)
local function back(cid)
doPlayerSay(cid,"bye bye",TALKTYPE_SAY)
doTeleportThing(cid, position, true)
doSendMagicEffect(getCreaturePosition(cid), 3)
return true
end
addEvent(back,10*1000,cid)
doSendMagicEffect(pos, 3)
end
Here u are,
creaturescripts.xml
XML:<event type="look" name="rang" event="script" value="rang.lua"/>
login.lua
Lua:registerCreatureEvent(cid, "rang")
rang.lua
Not tested but should works.Lua:function onLook(cid, thing, position, lookDistance) local prefix = "" -- By Erexo if isPlayer(thing.uid) then prefix = "He is a" else return true end local ranga = "" if getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 50 and getPlayerSkillLevel(thing.uid, SKILL_FISHING) <= 99 then ranga = "Fisherman" elseif getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 100 and getPlayerSkillLevel(thing.uid, SKILL_FISHING) <= 149 then ranga = "Good Fisherman" elseif getPlayerSkillLevel(thing.uid, SKILL_FISHING) >= 150 then ranga = "Master Fisherman" else ranga = "Weak Fisherman" end doPlayerSetSpecialDescription(thing.uid, ". " .. prefix .. " " .. ranga) return true end
Delete after time:
you must only set values of:
itemidToRemove
positionFromWhichWeWantRemove
addEvent(function(itemid,pos) local thing = getTileItemById(pos, itemid) if(thing.uid > 0) then doRemoveItem(thing.uid) end end, 5 * 60 * 1000, itemidToRemove, positionFromWhichWeWantRemove)
More readable version (both work):
delete time 5 min = 5 * 60 * 1000Lua:addEvent(function(itemid,pos) local thing = getTileItemById(pos, itemid) if(thing.uid > 0) then doRemoveItem(thing.uid) end end, 5 * 60 * 1000, itemidToRemove, positionFromWhichWeWantRemove)