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

Lua Erro Action

dinhus2jaque

New Member
Joined
Oct 5, 2008
Messages
35
Reaction score
0
Hello again (lol) Ive been trying to make new quests chests of helmet of the ancients parts for my server. I followed a tutorial given here OTServ: How do I make a quest chest? - OpenTibia Fans.

I made the functions with no problems, I hope. Here is one example:
Code:
function onUse(cid, item, frompos, item2, topos)
  if item.uid == 40004 then
     queststatus = getPlayerStorageValue(cid, 7004)
     if queststatus == -1 then
        doPlayerSendTextMessage(cid, 22, "You have found a Helmet Adornment.")
      doPlayerAddItem(cid, 2341, 1)
      setPlayerStorageValue(cid, 7004, 1)

  else
     doPlayerSendTextMessage(cid, 22, "The chest is empty.")
     end
    end
end

Then. I put in the actions part the following:
Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua/"> -- Damaged Helmet
 <action uniqueid="40002" event="script" value="hota/hota2.lua"/> -- Helmet Ornament
 <action uniqueid="40003" event="script" value="hota/hota3.lua"/> -- Right Horn
 <action uniqueid="40004" event="script" value="hota/hota4.lua"/> -- Helmet Adornment
 <action uniqueid="40005" event="script" value="hota/hota5.lua"/> -- Helmet Piece
 <action uniqueid="40006" event="script" value="hota/hota6.lua"/> -- Gem Holder
 <action uniqueid="40007" event="script" value="hota/hota7.lua"/> -- Left Horn

However, when I try to substitute my old actions file with this one, when I run the server, the actions are unable to load. It seems there is an error with the ending tag in line 2 of the actions.
Can anyone help me?
 
ofc can help :D

Step it...

open you lua file that one... delete all shit what you got -- is the comment what you need do to.

1. paste this code

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

        if item.uid == 40001 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1900) 
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1900, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 40002 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1901)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1901, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 40003 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1902)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1902, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
        elseif item.uid == 40004 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1903)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1903, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end
		elseif item.uid == 40005 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1904)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1904, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end		
		elseif item.uid == 40006 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1905)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1905, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end	
		elseif item.uid == 40007 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1906)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1906, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end	
		elseif item.uid == 40008 then -- unique id of chest 
                queststatus = getPlayerStorageValue(cid, 1907)
                if queststatus < 1 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a xxx.") -- text what item you have found !
                        doPlayerAddItem(cid, xxx, 1) -- item id what item you should get !
                        doPlayerSetStorageValue(cid, 1907, 1) -- storage this one means you cant get that item more... if you try to take it again it will say for you "It is empty
                else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
                end		
        end
                return TRUE
end

2. click on this picture and write comment "thanks for helping"

 
Hi again! Well... there is still a problem with actions. The actions.xml itself!
I downloaded a server from Xvx Global V.0.9. It came with an action.xml ready. Then I tried to add these lines:

Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua/"> -- Damaged Helmet
 <action uniqueid="40002" event="script" value="hota/hota1.lua"/> -- Helmet Ornament
 <action uniqueid="40003" event="script" value="hota/hota1.lua"/> -- Right Horn
 <action uniqueid="40004" event="script" value="hota/hota1.lua"/> -- Helmet Adornment
 <action uniqueid="40005" event="script" value="hota/hota1.lua"/> -- Helmet Piece
 <action uniqueid="40006" event="script" value="hota/hota1.lua"/> -- Gem Holder
 <action uniqueid="40007" event="script" value="hota/hota1.lua"/> -- Left Horn

I saved it, everything seemed fine. When I try to run the server the following error occured:
[25/11/2009 23:17:25] [Warning - BaseEvents::loadFromXml] Cannot open actions.xml file.
[25/11/2009 23:17:25] Line: 487, Info: Premature end of data in tag actions line 2


[25/11/2009 23:17:25] > ERROR: Unable to load Actions!

I cant understand this. Why this doesnt work?
Hope someone can help me out this time ^^
thx for your time =p

If needed I can post all the actions.xml later. But I hope this can make you able to help me out!
 
Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua"/> <!-- Damaged Helmet -->
 <action uniqueid="40002" event="script" value="hota/hota1.lua"/> <!-- Helmet Ornament -->
 <action uniqueid="40003" event="script" value="hota/hota1.lua"/> <!-- Right Horn -->
 <action uniqueid="40004" event="script" value="hota/hota1.lua"/> <!-- Helmet Adornment -->
 <action uniqueid="40005" event="script" value="hota/hota1.lua"/> <!-- Helmet Piece -->
 <action uniqueid="40006" event="script" value="hota/hota1.lua"/> <!-- Gem Holder -->
 <action uniqueid="40007" event="script" value="hota/hota1.lua"/> <!-- Left Horn -->
 
Change:

Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua/"> -- Damaged Helmet
 <action uniqueid="40002" event="script" value="hota/hota1.lua"/> -- Helmet Ornament
 <action uniqueid="40003" event="script" value="hota/hota1.lua"/> -- Right Horn
 <action uniqueid="40004" event="script" value="hota/hota1.lua"/> -- Helmet Adornment
 <action uniqueid="40005" event="script" value="hota/hota1.lua"/> -- Helmet Piece
 <action uniqueid="40006" event="script" value="hota/hota1.lua"/> -- Gem Holder
 <action uniqueid="40007" event="script" value="hota/hota1.lua"/> -- Left Horn

by:

Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua/"> <!-- Damaged Helmet -->
 <action uniqueid="40002" event="script" value="hota/hota1.lua"/> <!-- Helmet Ornament -->
 <action uniqueid="40003" event="script" value="hota/hota1.lua"/> <!-- Right Horn -->
 <action uniqueid="40004" event="script" value="hota/hota1.lua"/> <!-- Helmet Adornment -->
 <action uniqueid="40005" event="script" value="hota/hota1.lua"/> <!-- Helmet Piece -->
 <action uniqueid="40006" event="script" value="hota/hota1.lua"/> <!-- Gem Holder -->
 <action uniqueid="40007" event="script" value="hota/hota1.lua"/> <!-- Left Horn -->
 
Shortened the script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid >= 40001 and item.uid <= 40007 then
		if getPlayerStorageValue(cid, item.uid - 38101) < 1 then
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a " .. getItemNameById(item.uid - 37666) .. ".")
			doPlayerAddItem(cid, item.uid - 37666, 1)
			setPlayerStorageValue(cid, item.uid - 38101, 1)
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		end
		return TRUE
	end
	return FALSE
end

Change:

Code:
<!-- Hota -->
 <action uniqueid="40001" event="script" value="hota/hota1.lua/"> -- Damaged Helmet
 <action uniqueid="40002" event="script" value="hota/hota1.lua"/> -- Helmet Ornament
 <action uniqueid="40003" event="script" value="hota/hota1.lua"/> -- Right Horn
 <action uniqueid="40004" event="script" value="hota/hota1.lua"/> -- Helmet Adornment
 <action uniqueid="40005" event="script" value="hota/hota1.lua"/> -- Helmet Piece
 <action uniqueid="40006" event="script" value="hota/hota1.lua"/> -- Gem Holder
 <action uniqueid="40007" event="script" value="hota/hota1.lua"/> -- Left Horn

by:

<!-- Hota -->
<action uniqueid="40001" event="script" value="hota/hota1.lua/"> <!-- Damaged Helmet -->
<action uniqueid="40002" event="script" value="hota/hota1.lua"/> <!-- Helmet Ornament -->
<action uniqueid="40003" event="script" value="hota/hota1.lua"/> <!-- Right Horn -->
<action uniqueid="40004" event="script" value="hota/hota1.lua"/> <!-- Helmet Adornment -->
<action uniqueid="40005" event="script" value="hota/hota1.lua"/> <!-- Helmet Piece -->
<action uniqueid="40006" event="script" value="hota/hota1.lua"/> <!-- Gem Holder -->
<action uniqueid="40007" event="script" value="hota/hota1.lua"/> <!-- Left Horn -->
fail
 
Back
Top