• 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 quest system...

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
838
Reaction score
28
Location
Poland/ Wroclaw
Hello. Here i would like to show you my quest system.

First of all scripts:

actions/scripts/quest/quest.lua

LUA:
function onUse(cid, item, frompos, item2, topos)
	prize = item.uid
	count = item.actionid
	queststatus = getPlayerStorageValue(cid,prize)
	msgEmpty = "It is empty."

if prize > 0 and prize < 10500 then
	msgGetItem = "You have found "..getItemArticleById(prize).." "..getItemNameById(prize).."."
	msgNoCap = "You have found a "..getItemNameById(prize).." weighing "..getItemWeightById(prize,1).." oz. It is too heavy or you don't have enough space in backpack to take it."
		if queststatus <= 0 then
			reward = doCreateItemEx(prize,1)
			additem = doPlayerAddItemEx(cid,reward,0)
			if additem == RETURNVALUE_NOERROR then
				doPlayerSendTextMessage(cid,22,msgGetItem)
				setPlayerStorageValue(cid,prize,1)
			else
				doPlayerSendTextMessage(cid,22,msgNoCap)
			end
		else		
			doPlayerSendTextMessage(cid,22,msgEmpty)
		end
		return TRUE

	elseif prize > 10500 then
	msgGetItem = "You have found "..getItemArticleById(count).." "..getItemNameById(count).."."
	msgNoCap = "You have found a "..getItemNameById(count).." weighing "..getItemWeightById(count,1).." oz. It is too heavy or you don't have enough space in backpack to take it."
		if queststatus <= 0 then
			reward = doCreateItemEx(count,1)
			additem = doPlayerAddItemEx(cid,reward,0)
			if additem == RETURNVALUE_NOERROR then
				doPlayerSendTextMessage(cid,22,msgGetItem)
				setPlayerStorageValue(cid,prize,1)
			else		
				doPlayerSendTextMessage(cid,22,msgEmpty)
			end
		else
			doPlayerSendTextMessage(cid,22,msgEmpty)
		end
		return TRUE
else
	return FALSE
end

end

in actions.xml:

PHP:
<action itemid="1740" event="script" value="quests/quest.lua" />
<action itemid="1747" event="script" value="quests/quest.lua" />
<action itemid="1748" event="script" value="quests/quest.lua" />
<action itemid="1749" event="script" value="quests/quest.lua" />
<action itemid="1770" event="script" value="quests/quest.lua" />


How does it works:
(first part is made because of lot of chest on my map with this system. you can skip to part 2)

if you want to make chest give x item then:

I: make chest unique ID of Item Id. (only 1 chest with this item on map)
II: make chest action.id of item.id, make chest unique.id range 11000 - 20000


That is all.

This script is giving one item. count of items is noe editable it will be always 1.


Good for simple quests. You don't have to writting anything to actions.xml or anywhere else.


//QuaS~
 
Good work, I like the new messages.
 
@shawak

count is variable. (by writing count i mean how many items player get from chest (1 dragon scale mail, 1 orange, 1 mushroom.)

Forget! xD
 
Back
Top