• 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 Text in a book

wsp

New Member
Joined
Feb 6, 2012
Messages
32
Reaction score
0
Good evening,

I have a problem that I can't fix myself, the problem is I have a crafting system, and I want to have the recipes in a book (not learning or w/e just the recipes wrote down in a book), when I place a book on the ground (in my map editor) and I write a recipe in it and I start the server, the text is showed, HOWEVER, when I place the book in a chest (to make it a "quest") and I write down the text in it.
When I get the reward of that quest (the recipe book) there is no text in it.

I hope someone knows the problem.

Thanks in advance,

Kind Regards~
 
Here is an example:

Code:
local book = doPlayerAddItem(cid,1970,1)
doSetItemText(book,"Banor I praise your name.\nBe with me in the battle.\nBe my shield, let me be your sword.\nI will honour the godly spark in my soul. May it flourish and grow.")

Enjoy it ;]
 
Thank you for the "script" I have 1 small question, where do I place this? 0,o

Thanks in advance, and I'll rep you or something like that what people are saying.

Regards~
 
The script is an action dude, like this:

Code:
function onUse(cid, item, frompos, item2, topos)

if item.uid == 123 then
  if getPlayerStorageValue(cid,1324) == -1 then
		doPlayerSendTextMessage(cid,22,'You have found a book.')
		local book = doPlayerAddItem(cid,1970,1)
		doSetItemText(book,"Banor I praise your name.\nBe with me in the battle.\nBe my shield, let me be your sword.\nI will honour the godly spark in my soul. May it flourish and grow.")
	else
		doPlayerSendTextMessage(cid,22,"The chest is empty.")
  end
else
  return FALSE
end

	return TRUE
end

Enjoy it ;]
 
were in actions do i put this under?? and what should i label it book1.lua?
In Map Editor, put actionid from actions.xml onto a chest/dresser/et cetera.

data/actions/actions.xml
Code:
<action actionid="45001" event="script" value="name_the_file_whatever_you_want.lua"/>
data/actions/name_the_file_whatever_you_want.lua
Code:
local config = {
    storage_value = 45001,
    book_id = 1970,
    book_text = "text inside\nthe book\n\nNew line."   
}

function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storage_value) == 1 then
        doPlayerSendTextMessage(cid, 22, "The chest is empty.")
        return true
    end

    doPlayerSendTextMessage(cid, 22, "You have found a book.")
    local book = doPlayerAddItem(cid, config.book_id, 1)
    doSetItemText(book, config.book_text)

    return true
end
 
Back
Top