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

OnUse

SasirO

Banned User
Joined
Apr 30, 2009
Messages
559
Reaction score
0
Heya, i need a simple script, so if a player use a vial of blood on a grave stone then he gets teleported.
 
This might work, Test it.

Lua:
local newPos = {x=100, y=100, z=7}
local stoneId = xxxx -- Item ID of the stone
local stoneUID = xxxx -- Unique ID of the stone
local liquidType = 2 -- Subtype of the liquid pool
local liquidId = 2016 -- Item ID of the liquid pool

function onUse(cid, item, frompos, item2, topos)
local liquid = getThingfromPos(splash)
    if(item.uid == stoneUID) and (liquid.itemid == liquidId) and (liquid.type == liquidType) and (stoneId.itemid == xxxx) then
        doSendMagicEffect(splash, CONST_ME_MAGIC_RED)
        doTeleportThing(cid, newPos)
        doPlayerSendTextMessage(cid, 22, "You have stained the stone with blood.")
    end
end
 
Last edited:
Its working only if a player Use the stone then he gets teleported, but i want to do it so if a player use vial of blood on the gravestoen then he gets teleported.
 
Lua:
local config = {
   stoneUnique = 34343, -- unique of the stone.
   stoneID = 35435, -- id of the stone
   storage = 34324, -- storage
   newPos = {x = 100, y = 100, z = 7}, -- pos
   AlreadyDone = "You already done this quest.", -- already done
   Done = "You have stained the stone with blood." -- quest done
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if itemEx.uid == config.stoneUnique and itemEx.itemid == config.stoneID then
      if getPlayerStorageValue(cid, config.storage) == -1 then 
         setPlayerStorageValue(cid, config.storage, 1)
         doPlayerSendTextMessage(cid, 22, config.Done)
         doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
         doTeleportThing(cid, config.newPos)		
         doRemoveItem(item.uid)
      else
         doPlayerSendCancel(cid, config.AlreadyDone) 		
      end	
   end
   return TRUE
end
 
isnt working, also Im using vial of blood on the gravestone and im not getting teleported, if i click on the gravestone after using the vial of blood on it then im getting teleported and gravestone is getting deleted...
 
Try this...

Lua:
local index =
{
	vialID = XXXX,
	stoneID = XXXX,
	storage = 65535,
	uniqueID = 6550
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.itemid == index.vialID and itemEx.itemid == index.stoneID and itemEx.uid = index.uniqueID then

	if getPlayerStorageValue(cid, index.storage) > 0 then
		return FALSE
	end
		local pos = { x = 100, y = 100, z = 7 }
		doTeleportThing(cid, pos)
		setPlayerStorageValue(cid, index.storage, 1)
		doRemoveItem(item.uid, 1)
		return TRUE
	end
end
 
Lua:
local newPos = { 
	x = 100, 
	y = 100, 
	z = 7 
}

local index = {
        vialID = XXXX,
        stoneID = XXXX,
        storage = 65535,
        uniqueID = 6550
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.itemid == index.vialID and itemEx.itemid == index.stoneID and itemEx.uid = index.uniqueID then
		if getPlayerStorageValue(cid, index.storage) == -1 then
		doSendMagicEffect(getCreaturePosition(cid),2)
		doTeleportThing(cid, newPos)
		doSendMagicEffect(getCreaturePosition(cid),10)
		setPlayerStorageValue(cid, index.storage, 1)
		doRemoveItem(item.uid, 1)
	end
	return TRUE
end

Regards,
Shawak
 
This cant work with VialId because all the vials got the same id, for example vial of blood id:2006, vial of slime id:2006 ;/

anyways, its not working
 
Last edited:
I can't seem to find a vial that accepts subtypes, so i used a bucket instead.

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

config = {

blood_type = 2,
vial_id = 2005,
actionid_on_stone = xxxx,
tp_pos = {}
}

if item2.actionid == config.actionid_on_stone then
if vial_id.count == 2 then --type?
doTeleportThing(cid, tp_pos) 
return TRUE
end
end
 
@UP
isnt working.
Code:
[26/06/2009 10:16:25] data/actions/scripts/other/gravestone.lua:11: attempt to index global 'item2' (a nil value)
[26/06/2009 10:16:25] stack traceback:
[26/06/2009 10:16:25] 	data/actions/scripts/other/gravestone.lua:11: in function <data/actions/scripts/other/gravestone.lua:1>

heres the line
Code:
if item2.actionid == config.actionid_on_stone then
 
Lol.. Fix:
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)

config = {

blood_type = 2,
actionid_on_stone = xxxx,
tp_pos = {}
}

if itemEx.actionid == config.actionid_on_stone then
if item.count == 2 then --type?
doTeleportThing(cid, tp_pos)
return TRUE
end
end
 
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)

config = {

blood_type = 2,
actionid_on_stone = 13444,
tp_pos = {x=32793, y=32334, z=9}
}

if itemEx.actionid == config.actionid_on_stone then
if item.count == 2 then --type?
doTeleportThing(cid, tp_pos)
return TRUE
end
end
end

Isnt working, no errors, no action
 
Back
Top