• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Daily quest + Count by Fresh [basicly changed by me]

vakacjus

Lua & C++ Study.
Joined
Oct 23, 2008
Messages
255
Solutions
1
Reaction score
26
Hi Otlanders,

Its my first higher modification to script. At the beggining I must say sorries for my inglish :>>, I hope u understed.
Okay I spend over 4h at this script, looking for some commands that I can use and finnay I got what I wanted to get.
All changes by better scripters are welcome!

About script
I took idea from Aion MMO. Its a basic daily quest system that u have to speak with something, use something etc.
Then u will got a quest that for example : you need to get sword from chest (that giving u storage).

\data\actions\scripts\quests
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local daysvalue = 1 * 24 * 60 * 60
local daily1 = getPlayerStorageValue(cid, 13541)
local daily2 = getPlayerStorageValue(cid, 13543)
time = os.time() + daysvalue
    if (daily1 == -1) then
            daily1 = 0
    end
    if (daily2 == -1) then
            daily2 = 0
    end

	if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
			doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You recived daily quest, you have to bring sword from troll camp")

		elseif 
			getPlayerStorageValue(cid, 13542) - os.time() <= 0 then
			doPlayerSendTextMessage (cid, MESSAGE_INFO_DESCR, "You recived daily quest, you have to bring meat from orc camp")

		end

		if getPlayerStorageValue(cid, 13544) == 1 and getPlayerStorageValue(cid, 13540) <= time and getPlayerItemCount(cid, 2376) then
        			doPlayerAddItem(cid, 2152, 2)
        			doPlayerRemoveItem(cid, 2376, 1)

        			setPlayerStorageValue(cid, 13540, time)
        			setPlayerStorageValue(cid, 13544, 0)    
        			setPlayerStorageValue(cid, 13541, daily1+1)
        			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You steal a sword from troll camp " .. daily1 .. " times already. For daily quest you got 2 pc.")
			elseif 
				getPlayerStorageValue(cid, 13540) >= 1 then
        			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 24 Hours to get your daily quest. Next avaiable will be at: " .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13540)) .. ".")
			end

		if getPlayerStorageValue(cid, 13545) == 1 and getPlayerStorageValue(cid, 13542) <= time  and getPlayerItemCount(cid, 2666) == 5 then
        			doPlayerAddItem(cid, 2152, 1)
        			doPlayerRemoveItem(cid, 2666, 5)
        			setPlayerStorageValue(cid, 13542, time) 
        			setPlayerStorageValue(cid, 13545, 0)   
        			setPlayerStorageValue(cid, 13543, daily2+1)
        			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You steal a meat from orc camp " .. daily2 .. " times already. For daily quest you got 1 pc.")
			elseif 
				getPlayerStorageValue(cid, 13542) >= 1 then
        			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must wait 24 Hours to get your daily quest. Next avaiable will be at: " .. os.date("%H:%M:%S", getPlayerStorageValue(cid, 13542)) .. ".")
			end
    return true
end

PHP:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 13544) == 0 then 
		setPlayerStorageValue(cid, 13544, 1)
		doPlayerSendTextMessage(cid,25,"You have found a sword.") 
          	key = doPlayerAddItem(cid, 2376, 1) ~= -1
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Chect empty today.")
	end
        return TRUE
end

PHP:
function onUse(cid, item, frompos, item2, topos)
	if getPlayerStorageValue(cid, 13545) == 0 then 
		setPlayerStorageValue(cid, 13545, 1)
		doPlayerSendTextMessage(cid,25,"You have found 5 meat.") 
          	key = doPlayerAddItem(cid, 2666, 5) ~= -1
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Chect empty today.")
	end
        return TRUE
end

\data\actions\
PHP:
	<!-- Quests -->
	<action actionid="7777" event="script" value="quests/daily.lua"/>
	<action actionid="7778" event="script" value="quests/daily1.lua"/>
	<action actionid="7779" event="script" value="quests/daily2.lua"/>

\data\XML
PHP:
	<quest name="Daily quest" startstorageid="13546" startstoragevalue="0">
		<mission name="Steal Sword from Troll camp" storageid="13544" startvalue="0" endvalue="1">
			<missionstate id="1" description="You have steal a sword!, but u have to wait 24h."/>
			<missionstate id="0" description="You have to steal a sword!."/>
		</mission>
		<mission name="Orcs meat for our people" storageid="13545" startvalue="0" endvalue="1">
			<missionstate id="1" description="You have steal a meat!, but u have to wait 24h."/>
			<missionstate id="0" description="You have to steal a meat!."/>
		</mission>
	</quest>

76772003.jpg

Set Board ActionId == 7777

47310491.jpg

Use Board to get a mission or go to chest and then to board to get a reward
Imageshack - 13866828.png

99240237.jpg

Set containerID == 7778 // 7779 // [...] //
http://img51.imageshack.us/img51/1818/20680738.png

48716741.jpg

Go to board and use it to get ur reward, but it still will ask you for 2 quest.

48716741.jpg

Go to 2 chest//container with ID == 7778 // 7779 // [...] // .
http://img59.imageshack.us/img59/2623/60685177.png

70608440.jpg

Return to your board and get another reward

http://img826.imageshack.us/img826/1724/28855811.png <<-- Prove that force u to wait 24h.

Every changes, questions, ideas please post here
Repp ++ me and Fresh if you like it!

ChangeLog :

1. Fixed bug with multi sword and meat
2. Fixed Quest Count
3. Fixed bug with "You have -1 daily quest"

ToDo :

1. Block chest for 24h when you want to pick daily quest item again.
 
Last edited:
Good idea for the blackboard ;)
It similar to "WANTED Board" in Westerns (you must kill boss or someone who is wanted) or something else ;D
 
I hope that someone will optimalize it :S,
I rly enjoy scripting :D Is there lots of fun when u click on chest that should say "its empty" and its giving you sword again, and again, and again :DDDD
 
Last edited:
Please some one! Make it shorter and better for my pc :D!, pleeeease!, I like scripting but I hate my work :p.
 
A great innovative idea! Reminds me of Borderlands, I'm considering using it :)

Red
 
Back
Top