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

Closed

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
Ello , Posible to make quest with reward book , and inside writed words ? if yes please script for it
 
Last edited:
Here, this should work (untested)

Code:
function givePlayerBookWithText(cid, itemid, text, originalWriter) --originalWriter is optional
   local item = doPlayerAddItem(cid, itemid)
   doItemSetAttribute(item, "text", text)
   if originalWriter ~= nil then
      doItemSetAttribute(item, "writer", originalWriter)
   end
   return item
end

Just call this function inside ur quest script and give it the parameters you want :)

you can use it like this:
Code:
givePlayerBookWithText(cid, 1952, "This is the story of ...")
or
Code:
givePlayerBookWithText(cid, 1952, "This is the story of ...", "Scarlet Ayleid")

both should make a book with the text "This is a story of ..." and the second one would make the original writer "Scarlet Ayleid"

Rep+ if I help :)
 
Last edited:
doesnt works,

its normal quest script
PHP:
function onUse(cid, item, frompos, item2, topos)

	if item.uid == 7916 then
 	queststatus = getPlayerStorageValue(cid,5020027)
 	if queststatus == -1 then
 	doPlayerSendTextMessage(cid,22,"You have found a frozen starlight.")
 	doPlayerAddItem(cid,2361,1)
 	setPlayerStorageValue(cid,5020027,1)
 	else
 	doPlayerSendTextMessage(cid,22,"It is empty.")
 	end
	else
	return 0
	end

	return 1
	end
 
Code:
local bookID = 1952
local text = "This is an example!"
local originalWriter = "Scarlet Ayleid"
local storageKey = 5020027

function onUse(cid, item, frompos, item2, topos) 
    if item.uid == 7916 then 
        queststatus = getPlayerStorageValue(cid, storageKey) 
        if queststatus == -1 then 
            doPlayerSendTextMessage(cid, 22, "You have found a book.") 
            givePlayerBookWithText(cid, bookID, text, originalWriter)
            setPlayerStorageValue(cid, storageKey, 1) 
        else 
            doPlayerSendTextMessage(cid, 22, "It is empty.") 
        end 
    else 
        return 0 
    end
    return 1 
end

Here's an example, this should work :)
 
17:28 You have found a book.
17:28 You have found a book.
17:28 You have found a book.
17:28 You have found a book.

doesnt works , it doesnt gives book / and like you see i can spam box and its saying all time you have found book
 
LUA:
function onUse(cid, item, frompos, item2, topos)

    if item.uid == 7916 then
     queststatus = getPlayerStorageValue(cid,5020027)
     if queststatus == -1 then
	doSetItemText(doPlayerAddItem(cid, 1950),"This is the story of ...")
     setPlayerStorageValue(cid,5020027,1)
     else
     doPlayerSendTextMessage(cid,22,"It is empty.")
     end
    else
    return 0
    end

    return 1
    end


I just modified your quest script from some post up, so remember to select good Storage and UID :P
 
Last edited:
doesnt work ,
now even got error on console
PHP:
[02/07/2011 17:36:56] [Error - Action Interface] 
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:onUse
[02/07/2011 17:36:56] Description: 
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: attempt to call global 'givePlayerBookWithText' (a nil value)
[02/07/2011 17:36:56] stack traceback:
[02/07/2011 17:36:56] 	data/actions/scripts/other/secretbook.lua:11: in function <data/actions/scripts/other/secretbook.lua:6>
 
doesnt work ,
now even got error on console
PHP:
[02/07/2011 17:36:56] [Error - Action Interface] 
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:onUse
[02/07/2011 17:36:56] Description: 
[02/07/2011 17:36:56] data/actions/scripts/other/secretbook.lua:11: attempt to call global 'givePlayerBookWithText' (a nil value)
[02/07/2011 17:36:56] stack traceback:
[02/07/2011 17:36:56] 	data/actions/scripts/other/secretbook.lua:11: in function <data/actions/scripts/other/secretbook.lua:6>


I havn't used "givePlayerBookWithText" in my script so you doing sth wrong ;o

If you modified sth in my script give it here again, and I will help you. Because my script should work ;)
 
PHP:
function onUse(cid, item, frompos, item2, topos)

    if item.uid == 7917 then
     queststatus = getPlayerStorageValue(cid,5020227)
     if queststatus == -1 then
	doSetItemText(doPlayerAddItem(cid, 1950),"Warfare Secret:We know one of warfare secrets! Go To Jungle And Find Hero Statue , from statue go 1 south 6 west 3 south 1 west. Here Is A Secret Passage , But we dont know where it leads cuz we dont know secret words to enter it! Find Another Secret Somewhere in Warfare City...")
     setPlayerStorageValue(cid,5020227,1)
     else
     doPlayerSendTextMessage(cid,22,"It is empty.")
     end
    else
    return 0
    end

    return 1
    end


this is how it looks now
 
@Nuha
that error he's saying is about the code I wrote above your other post, I completelly forget there was already a "doSetItemText" so I made my own lol


@Up
that should work..
 
PHP:


this is how it looks now

Working fine for me:

ksiazkam.jpg


If it doesn't working for you remember to:
- Put good UniqueID in your item at map editor
- Put good line in actions.xml
 
this script i posted doesnt work , same problem like was with your script . when i click on box its says 'you have found book" i can spam box x times , and it doesnt give me book . + this script gives me error on console when i click on box
 
Back
Top