• 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!

[Action] Need a script

Tibia Rox

Member
Joined
Feb 4, 2009
Messages
1,181
Reaction score
9
Location
U.S.A
I need a script that when you step on x: y: x:, you get xxxx item, but you can only get it once.

Thanks in advance
 
This should work.
LUA:
pos = {x = 1, y = 1, z = 1}
item = {xxxx}
function onStepIn(cid, item, frompos, itemEx, topos)
	if getCreaturePosition(cid) == pos.x, pos.y, pos.z and getPlayerStorageValue(cid, 700) < 1 then
		doPlayerAddItem(uid, item)
		doPlayerSendTextMessage(cid, 17, "Congratulations!")
		doPlayerSetStorageValue(uid, 700, 1)
	else
		doPlayerSendCancel(cid, "You have already done this quest")
end
 
This should work.
LUA:
pos = {x = 1, y = 1, z = 1}
item = {xxxx}
function onStepIn(cid, item, frompos, itemEx, topos)
	if getCreaturePosition(cid) == pos.x, pos.y, pos.z and getPlayerStorageValue(cid, 700) < 1 then
		doPlayerAddItem(uid, item)
		doPlayerSendTextMessage(cid, 17, "Congratulations!")
		doPlayerSetStorageValue(uid, 700, 1)
	else
		doPlayerSendCancel(cid, "You have already done this quest")
end

this wont work lol..
 
[10/04/2010 18:25:26] [Error - LuaScriptInterface::loadFile] data/actions/scripts/items.lua:4: 'then' expected near ','
[10/04/2010 18:25:26] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/items.lua)
[10/04/2010 18:25:26] data/actions/scripts/items.lua:4: 'then' expected near ','

? :confused:
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="ItemReward" enabled="yes">
	<config name="ItemReward_config"><![CDATA[
		config = {
			itemid = xxxx,
			count = 1,
			storage = 500,
			message = ""
		}
	]]></config>
	<movevent type="StepIn" pos="100,100,7" event="buffer"><![CDATA[
		domodlib('ItemReward_config')
		if getPlayerStorageValue(cid, config.storage) < 1 then
			doPlayerAddItem(cid, config.itemid, config.count)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.message)
			setPlayerStorageValue(cid, config.storage, 1)
		end
	]]></movevent>
</mod>
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="ItemReward" enabled="yes">
	<config name="ItemReward_config"><![CDATA[
		config = {
			itemid = xxxx,
			count = 1,
			storage = 500,
			message = ""
		}
	]]></config>
	<movevent type="StepIn" pos="100,100,7" event="buffer"><![CDATA[
		domodlib('ItemReward_config')
		if getPlayerStorageValue(cid, config.storage) < 1 then
			doPlayerAddItem(cid, config.itemid, config.count)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.message)
			setPlayerStorageValue(cid, config.storage, 1)
		end
	]]></movevent>
</mod>

What would I do if I want multiple items?
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="ItemReward" enabled="yes">
	<config name="ItemReward_config"><![CDATA[
		config = {
[B]	[COLOR="Blue"]moar items ->[/COLOR]	items = {
[COLOR="Red"]				{2500, 1},
				{2152, 10},
				{2160, 1}[/COLOR]
			},[/B]
			storage = 500,
			message = ""
		}
	]]></config>			[B][COLOR="Blue"]moar tiles \/[/COLOR][/B]
	<movevent type="StepIn" pos="100,100,7[B][COLOR="Red"];101,100,7[/COLOR][/B]" event="buffer"><![CDATA[
		domodlib('ItemReward_config')
		if getPlayerStorageValue(cid, config.storage) < 1 then
	[B][COLOR="Blue"]more items ->[/COLOR][/B]	for _, v in ipairs(config.items) do
				doPlayerAddItem(cid, v[1], v[2] or 1)
			end
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.message)
			setPlayerStorageValue(cid, config.storage, 1)
		end
	]]></movevent>
</mod>
oops.
 
Back
Top