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

[request] need help with this simple script :D

healer007

New Member
Joined
Nov 11, 2008
Messages
174
Reaction score
0
Location
doesnt matter
Code:
local newpos = {x=98, y=117, z=7}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	
if itemuid == 5009 then
		
doTeleportThing(cid, newpos) 
doSendMagicEffect(pos, type12)
end
return TRUE
end

this is my script i know it looks bad cus im still learning =p
want it to work like this> use door from pos A and get teleported to pos B. Use door from pos B and get teleported to A simple.
havent tested the script yet but
this only work one way from A to B i want both ty
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposB = {x=98, y=117, z=7} --- Position B
local newposA = {x=99, y=115, z=7} --- Position A
	
      if item.uid == 5009 then		
         doTeleportThing(cid, newposB) 
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5010)
         
      elseif items.uid == 5010 then
         doTeleportThing(cid, newposA) 
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5009)
      end
      return TRUE
end
Set position A and position B. And the items you're using to telepor from B to A you need to set uniqueid 5010.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposB = {x=98, y=117, z=7} --- Position B
local newposA = {x=99, y=115, z=7} --- Position A
	
      if item.uid == 5009 then		
         doTeleportThing(cid, newposB) 
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5010)
         
      elseif items.uid == 5010 then
         doTeleportThing(cid, newposA) 
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5009)
      end
      return TRUE
end
Set position A and position B. And the items you're using to telepor from B to A you need to set uniqueid 5010.

doesn't work i get this error
[31/05/2009 15:13:57] Lua Script Error: [Action Interface]
[31/05/2009 15:13:57] data/actions/scripts/poidoor.lua:eek:nUse

[31/05/2009 15:13:57] attempt to index a nil value
[31/05/2009 15:13:57] stack traceback:
[31/05/2009 15:13:57] [C]: in function 'doSendMagicEffect'
[31/05/2009 15:13:57] data/actions/scripts/poidoor.lua:7: in function <data/actions/scripts/poidoor.lua:1>


note:Im using the same item (door) to teleport from each side
 
Lua:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposB = {x=98, y=117, z=7} --- Position B
local newposA = {x=99, y=115, z=7} --- Position A
local pos = getPlayerPosition(cid)
       
      if item.uid == 5009 then         
         doTeleportThing(cid, newposB)
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5010)
         
      elseif item.uid == 5010 then
         doTeleportThing(cid, newposA)
         doSendMagicEffect(pos, 12)
         doTransformItem(item.uid, 5009)
      end
      return TRUE
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} --- Position A
local newposB = {x=64, y=44, z=8} --- Position B
local pos = getPlayerPosition(cid)
       
      if item.uid == 5009 then        
         doTeleportThing(cid, newposB)
         doSendMagicEffect(pos, 10)
         doTransformItem(uid, 5010)

         
      elseif item.uid == 5010 then
         doTeleportThing(cid, newposA)
         doSendMagicEffect(pos, 10)
         doTransformItem(uid, 5009)
      end
      return TRUE
end
your one doesnt work it change item id instead of unique id so i changed this bit doTransformItem(item.uid, 5010) to doTransformItem(uid, 5010)
now it only one way and get this error

[31/05/2009 16:38:13] Lua Script Error: [Action Interface]
[31/05/2009 16:38:13] data/actions/scripts/poidoor.lua:eek:nUse

[31/05/2009 16:38:13] luaDoTransformItem(). Item not found
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} --- Position A
local newposB = {x=64, y=44, z=8} --- Position B
local pos = getPlayerPosition(cid)
       
      if item.uid == 5009 then        
         doTeleportThing(cid, newposB)
         doSendMagicEffect(pos, 10)
         doTransformItem(item.uid, 5010)

         
      elseif item.uid == 5010 then
         doTeleportThing(cid, newposA)
         doSendMagicEffect(pos, 10)
         doTransformItem(item.uid, 5009)
      end
      return TRUE
end
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} --- Position A
local newposB = {x=64, y=44, z=8} --- Position B
local pos = getPlayerPosition(cid)
       
      if item.uid == 5009 then        
         doTeleportThing(cid, newposB)
         doSendMagicEffect(pos, 10)
         doTransformItem(item.uid, 5010)

         
      elseif item.uid == 5010 then
         doTeleportThing(cid, newposA)
         doSendMagicEffect(pos, 10)
         doTransformItem(item.uid, 5009)
      end
      return TRUE
end

same thing happens when i use the door it turn to oriental wall which itemid is 5010 :S
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} --- Position A
local newposB = {x=64, y=44, z=8} --- Position B
local pos = getPlayerPosition(cid)

if item.uid == 5009 then
doTeleportThing(cid, newposB)
doSendMagicEffect(pos, 10)
doTransformItem(item.uid, 5010)


elseif item.uid == 5010 then
doTeleportThing(cid, newposA)
doSendMagicEffect(pos, 10)
doTransformItem(item.uid, 5009)
end
return TRUE
end


Change the red to the id of the door opened
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} -- Position A
local newposB = {x=64, y=44, z=8} -- Position B

	if item.uid == 50010 then     
		if getCreaturePosition(cid) == newposA then 
			doTeleportThing(cid, newposB)
			doSendMagicEffect(newposB, 10)
			doSendMagicEffect(newposA, 2)
		elseif getCreaturePosition(cid)== newposB then 
			doTeleportThing(cid, newposA)
			doSendMagicEffect(newposB, 10)
			doSendMagicEffect(newposA, 2)
		end
	end
	return TRUE
end

Give the door the Unique ID 5010 and set the positions ;).

Regards,
Shawak
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=62, y=44, z=8} -- Position A
local newposB = {x=64, y=44, z=8} -- Position B

        if item.uid == 5009 then    
                if getCreaturePosition(cid) == newposA then
                        doTeleportThing(cid, newposB)
                        doSendMagicEffect(newposB, 10)
                        doSendMagicEffect(newposA, 2)
                elseif getCreaturePosition(cid)== newposB then
                        doTeleportThing(cid, newposA)
                        doSendMagicEffect(newposB, 10)
                        doSendMagicEffect(newposA, 2)
                end
        end
        return TRUE
end

doesnt work nothing happens and no error in console
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local newposA = {x=xx, y=xx, z=x} -- Position A
local newposB = {x=xx, y=xx, z=x} -- Position B

        if item.uid == 50010 then    
                if getCreaturePosition(cid) == newposA then
                        doTeleportThing(cid, newposB)
                        doSendMagicEffect(newposB, 10)
                        doSendMagicEffect(newposA, 2)
                elseif getCreaturePosition(cid)== newposB then
                        doTeleportThing(cid, newposA)
                        doSendMagicEffect(newposB, 10)
                        doSendMagicEffect(newposA, 2)
                end
        else
                doPlayerSendTextMessage(cid,22,"I gave the door the false id")
        end
        return TRUE
end

:D

Regards,
Shawak
 
Back
Top