• 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 Example of a quest depending on player skills

elf

Sing, sing blue silver
Senator
Joined
Dec 11, 2007
Messages
3,666
Solutions
1
Reaction score
125
Location
Warsaw, Poland
GitHub
tayandenga
Twitch
tayandenga
Had it on store
Code:
local config = {
	storage = 5019,
	experience = 400,
	axe = 2429,
	club = 2394,
	sword = 2409
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
		return TRUE
	end

	if(getPlayerStorageValue(cid, config.storage) ~= -1) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		return TRUE
	end

	local club = getPlayerSkill(cid, 1)
	local sword = getPlayerSkill(cid, 2)
	local axe = getPlayerSkill(cid, 3)

	local reward = 0
	if(axe > sword and axe > club) then
		reward = doCreateItemEx(config.axe, 1)
	elseif(club > sword and club > axe) then
		reward = doCreateItemEx(config.club, 1)
	elseif(sword > club and sword > axe) then
		reward = doCreateItemEx(config.sword, 1)
	end

	if(reward == 0) then
		doPlayerSendCancel(cid, "Sorry, you have to choose a weapon type first.")
	elseif(doPlayerAddItemEx(cid, reward, FALSE) ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a reward weighing " .. getItemWeight(reward) .. " oz. It is too heavy or you have not enough space.")
	else
		local tmp = getItemDescriptions(reward)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. tmp.article .. " " .. tmp.name .. ".")
		setPlayerStorageValue(cid, config.storage, 1)
		doPlayerAddExp(cid, config.experience)
		doSendAnimatedText(getCreaturePosition(cid), config.experience, TEXTCOLOR_WHITE_EXP)
	end

	return TRUE
end

Good for beginers ;p
 
Had it on store
Code:
local config = {
	storage = 5019,
	experience = 400,
	axe = 2429,
	club = 2394,
	sword = 2409
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE) then
		return TRUE
	end

	if(getPlayerStorageValue(cid, config.storage) ~= -1) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
		return TRUE
	end

	local club = getPlayerSkill(cid, 1)
	local sword = getPlayerSkill(cid, 2)
	local axe = getPlayerSkill(cid, 3)

	local reward = 0
	if(axe > sword and axe > club) then
		reward = doCreateItemEx(config.axe, 1)
	elseif(club > sword and club > axe) then
		reward = doCreateItemEx(config.club, 1)
	elseif(sword > club and sword > axe) then
		reward = doCreateItemEx(config.sword, 1)
	end

	if(reward == 0) then
		doPlayerSendCancel(cid, "Sorry, you have to choose a weapon type first.")
	elseif(doPlayerAddItemEx(cid, reward, FALSE) ~= RETURNVALUE_NOERROR) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a reward weighing " .. getItemWeight(reward) .. " oz. It is too heavy or you have not enough space.")
	else
		local tmp = getItemDescriptions(reward)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. tmp.article .. " " .. tmp.name .. ".")
		setPlayerStorageValue(cid, config.storage, 1)
		doPlayerAddExp(cid, config.experience)
		doSendAnimatedText(getCreaturePosition(cid), config.experience, TEXTCOLOR_WHITE_EXP)
	end

	return TRUE
end

Good for beginers ;p

there is a little bit of problem, if the player has 2 skills at same level it wont work...

kind regards, Evil Hero
 
Haha nice ;p

(now it's time to make a script for a quest which reward depends on sexual orientation of a player xD,
getPlayerSexualOrientation(cid)
plx >.>)
 
Back
Top