• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Help me on my script plx...

f@bio

Fudera Otserver
Joined
Jul 10, 2007
Messages
213
Reaction score
0
Location
Brasil
Hello, everyone, I need a very special help with my script ... I will explain what he does or would do that, and maybe someone there could give me a light ...

It is the following, you pull a lever and it removes a rock in a road closed after the stone has been removed you will have 1 minute to pass or return the stone to appear on the site, but ... when the time for the birth stone is an error in the console and the stone does not appear, please help me with this problem ... thanks:

Here's the script:
--Fudera Otserver - script by F@bio
function onUse(cid, item, frompos, item2, topos)

local gatepos = {x=1052, y=585, z=10, stackpos=1}
getgate = getThingfromPos(gatepos)
local time_to_pass = 20 -- in seconds
local stoneID = 1304

if item.uid == 2557 and item.itemid == 1945 and getgate.itemid == stoneID then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
doCreatureSay(cid, "Teleport Ativado, 1 minutos para fechar.", TALKTYPE_ORANGE_1)
addEvent(addStone, (1000*time_to_pass), stoneID)

elseif item.uid == 2557 and item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(stoneID,1,gatepos)
doTransformItem(item.uid,item.itemid-1)

else
doPlayerSendCancel(cid,"Sorry not possible.")
end
return 1
end

function addStone()

if getThingfromPos({x=1052, y=585, z=10, stackpos=1}).itemid == 0 then
doCreateItem(1304,1,getThingfromPos({x=1052, y=585, z=10, stackpos=1}))
doSendMagicEffect({x=1052, y=585, z=10, stackpos=1}, CONST_ME_POFF)

return 1
end

end

Here is the error in the console:
Lua Script Error: [Action Interface]
in a timer event called from:
data/actions/scripts/POI/poiquest1.lua:onUse

luaDoCreateItem(). Tile not found
 
It seemed that you had guided with one of my scripts xD

Try this..

Code:
[COLOR="Blue"]function onUse(cid, item, frompos, item2, topos)

local stonePos = {x=[COLOR="DarkGreen"]1052[/COLOR], y=[COLOR="DarkGreen"]585[/COLOR], z=[COLOR="DarkGreen"]10[/COLOR], stackpos=[COLOR="DarkGreen"]1[/COLOR]}
getStone = getThingfromPos(stonePos)
local timeToPass = [COLOR="DarkGreen"]60[/COLOR] -- in seconds
local stoneID = [COLOR="DarkGreen"]1304[/COLOR]

if item.uid == [COLOR="DarkGreen"]2557[/COLOR] and item.itemid == [COLOR="DarkGreen"]1945[/COLOR] and getStone.itemid == [COLOR="DarkGreen"]stoneID[/COLOR] then

	doRemoveItem(getStone.uid,1)
	doTransformItem(item.uid,item.itemid+1)
	doCreatureSay(cid, "Teleport Ativado, 1 minutos para fechar.", TALKTYPE_ORANGE_1)
	addEvent(doCreateStone, (1000*timeToPass))

elseif item.uid == 2557 and item.itemid == 1946 and getStone.itemid == 0 then

	doCreateItem(stoneID,1,stonePos)
	doTransformItem(item.uid,item.itemid-1)


else

	doPlayerSendCancel(cid,"Sorry not possible.")

		end
	return 1
end


function doCreateStone()

local stonePos2 = {x=[COLOR="DarkGreen"]1052[/COLOR], y=[COLOR="DarkGreen"]585[/COLOR], z=[COLOR="DarkGreen"]10[/COLOR], stackpos=[COLOR="DarkGreen"]1[/COLOR]}
local getStone2 = getThingfromPos(stonePos2)

if getStone2.itemid == 0 then

	doCreateItem([COLOR="DarkGreen"]1304[/COLOR],[COLOR="DarkGreen"]1[/COLOR],[COLOR="DarkGreen"]stonePos2[/COLOR])
	doSendMagicEffect([COLOR="DarkGreen"]stonePos2[/COLOR], CONST_ME_POFF)

	end
end[/COLOR]
 
Last edited:
@darkhaos

-- Great, good, wonderfull.... many thx for you man... work perfectly here, i'm happy with this... can you explain me how to use ADDEVENT function???

-- On lua doc, only show function but don't explain how to use then... however don't explain anything only show...

-- More time, thank you for your help...
 
"addEvent" must be used with a function, in the function created for the script it is necessary to specify that is going to be done when one adds the event.. for example:

Code:
[COLOR="Blue"]local time = [COLOR="DarkGreen"]10[/COLOR] -- in seconds
addEvent([COLOR="DarkGreen"]summonMonster[/COLOR], ([COLOR="DarkGreen"]1000*time[/COLOR]))

function [COLOR="DarkGreen"]summonMonster[/COLOR]()
	doSummonCreature("[COLOR="DarkGreen"]Lost Soul[/COLOR]", [COLOR="DarkGreen"]fromPosition.x+1[/COLOR])
	doCreatureSayWithDistance([COLOR="DarkGreen"]fromPosition.x+1[/COLOR], "[COLOR="DarkGreen"]Run![/COLOR]", [COLOR="DarkGreen"]TALKTYPE_ORANGE_1[/COLOR])
end[/COLOR]

Since you will be able to see, in the function "summonMonster" there is specified that will be done when one adds the event, in this case to summon a Lost Soul and to send a message.

When you use the function "addEvent", do not place the position in which the event will be activated, since the position must be specified in the function that is used in the event, in this case in the function "summonMonster". In this function since you will be able to see, the position already is specified "fromPosition.x+1".
 
Last edited:
Hum... understand... many thx for your explain.... ^^

-- I have one more script with a error...

See this... it's a BLOOD RAGE SPELL for 8.4 servers, but...
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)

local condition = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setConditionParam(condition, CONDITION_PARAM_SKILL_MELEEPERCENT, 135)
setConditionParam(condition, CONDITION_PARAM_BUFF, TRUE
setCombatCondition(combat, condition)

local disable = createConditionObject(CONDITION_DISABLE_DEFENSE)
setConditionParam(disable, CONDITION_PARAM_TICKS, 10000)

function onCastSpell(cid, var)
	doAddCondition(cid, disable)
	return doCombat(cid, combat, var)
end
-- I'm use a THE FORGOTTEN SERVER MISTIC SPIRIT 0.2 - Patch 22, and on DATA.lua don't have a BUFF parametrer, you know other function can be work on it???
 
"addEvent" must be used with a function, in the function created for the script it is necessary to specify that is going to be done when one adds the event.. for example:

Code:
[COLOR="Blue"]local time = [COLOR="DarkGreen"]10[/COLOR] -- in seconds
addEvent([COLOR="DarkGreen"]summonMonster[/COLOR], ([COLOR="DarkGreen"]1000*time[/COLOR]))

function [COLOR="DarkGreen"]summonMonster[/COLOR]()
	doSummonCreature("[COLOR="DarkGreen"]Lost Soul[/COLOR]", [COLOR="DarkGreen"]fromPosition.x+1[/COLOR])
	doCreatureSayWithDistance([COLOR="DarkGreen"]fromPosition.x+1[/COLOR], "[COLOR="DarkGreen"]Run![/COLOR]", [COLOR="DarkGreen"]TALKTYPE_ORANGE_1[/COLOR])
end[/COLOR]

Since you will be able to see, in the function "summonMonster" there is specified that will be done when one adds the event, in this case to summon a Lost Soul and to send a message.

When you use the function "addEvent", do not place the position in which the event will be activated, since the position must be specified in the function that is used in the event, in this case in the function "summonMonster". In this function since you will be able to see, the position already is specified "fromPosition.x+1".

Wrong, you can't write fromPosition.x as parameter for doCreatureSayWithDistance... Because it want a position and you give number :)

Second, DONT USE doCreatureSayWithDistance! Use:
doCreatureSay(cid, text, type, POSITION)
 
Back
Top