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

Vocation Fluid

Newpy

New Member
Joined
May 5, 2010
Messages
50
Reaction score
1
Hello, would be great if someone could make this script for me. A potion that gives you a certain amount of mana and/or health based on vocation.

Sorc/Druid/MS/ED - 200-300 MP (Great Mana Potion)
Paladin/RP - 200-400HP|150-200MP (Great Spirit Potion)
Knight/EK - 800-1000 HP (Ultimate Health Potion)

With a requirment of level 50.

Thank you so much for anyone who makes and helps!

-Newpy
 
that is how it works currently...

Lua:
local config = {
	removeOnUse = "yes",
	splashable = "no",
	realAnimation = "no", -- make text effect visible only for players in range 1x1
	healthMultiplier = 1.0,
	manaMultiplier = 1.0
}

config.removeOnUse = getBooleanFromString(config.removeOnUse)
config.splashable = getBooleanFromString(config.splashable)
config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[8704] = {empty = 7636, splash = 2, health = {50, 100}}, -- small health potion
	[7618] = {empty = 7636, splash = 2, health = {100, 300}}, -- health potion
	[7588] = {empty = 7634, splash = 2, health = {350, 450}, level = 50, vocations = {3, 4, 7, 8, 12, 11}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {empty = 7635, splash = 2, health = {650, 800}, level = 80, vocations = {4, 8, 12}, vocStr = "knights"}, -- great health potion
	[8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8, 12}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {empty = 7636, splash = 7, mana = {70, 130}}, -- mana potion
	[7589] = {empty = 7634, splash = 7, mana = {170, 210}, level = 50, vocations = {1, 2, 3, 5, 6, 7, 9, 10, 11}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {empty = 7635, splash = 7, mana = {270, 350}, level = 80, vocations = {1, 2, 5, 6, 9, 10}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {empty = 7635, splash = 3, health = {300, 350}, mana = {170, 200}, level = 80, vocations = {3, 7, 11}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPos(item.uid)
		end

		doDecayItem(doCreateItem(2016, potion.splash, toPosition))
		doTransformItem(item.uid, potion.empty)
		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and
		not getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges))
	then
		doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1)
		return true
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then
		return false
	end

	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not realAnimation) then
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	else
		for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		doRemoveItem(item.uid)
		return true
	end

	doTransformItem(item.uid, potion.empty)
	return true
end

just change the setpoints you want
 
yea i know i have this already for all the other potions. i need 1 single potion that gives you a certain amount of hp/mp based on vocation.
 
Lua:
local QUASIORRRUAAAZZ = { 
[1] = {health = {30,70}, mana={150,200}} -- Voc id 1 //Sorc {min_Value, max_Value}
[2] = {mana = {180,350}}, --Druid?
[3] = {heatlh = {120,150}, mana = {100, 120}}, --pally?
[4] = {health = {250, 400} } --knight
}

function getPlayerBasicVoc(cid) 
return getPlayerVocation(cid) - (getPlayerPromotionLevel(cid) * 4)
end

local exhaust =  createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local mp, hp,voc;
	voc = getPlayerBasicVoc(cid);
	mp = QUASIORRRUAAAZZ[voc].mana or 0;
	hp = QUASIORRRUAAAZZ[voc].health or 0;
	if( ((not mp) and (not hp)) or ((#mp<2) or (#hp < 2))) then
		print("Error in Quasiorxzors Script, Check Table.");
		return false;
	end
	
	if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED);
			return true;
	end
	if(not isPlayer(itemEx.uid)) then
		return false;
	end
	if (mp) then
		doCreatureAddMana(cid, math.random(mp[1],mp[2]);
	end
	if (hp) then
		doCreatureAddHealth(cid,math.random(hp[1],hp[2]);
	end
	doAddCondition(cid, exhaust);
	doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE);
	doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1);
	return doRemoveItem(item.uid,1) and true or false;
end
 
Last edited:
Code:
local lvl = 50
local id = potion_id_here

function onUse (cid, item, fromPosition, itemEx, toPosition)
  local level = getPlayerLevel(cid)
  if itemEx.itemid == id then
    if isDruid(cid) or isSorcerer(cid) and level >= lvl then
      doCreatureAddMana(cid, math.random(200,300))
    elseif isPaladin(cid) and level >= lvl then
      doCreatureAddMana(cid, math.random(150,200))
      doCreatureAddHealth(cid, math.random(200,400))
    elseif isKnight(cid) and level >= lvl then
      doCreatureAddHealth(cid, math.random(800,1000))
    else
      doPlayerSendCancel(cid,"You have to be above level 50 to use this potion!",19)
    end
  end
  return true
end

try this :p

edit: @up

didn't see >.< xD
 
Sry for not being specific enuf.. I thought "a potion" meant 1


Thanks for the script rep+

Hey, do you think you could make it for promotion players too? isKnight isnt working for Elite Knights
 
Last edited:
Lua:
local mp, hp,voc;
function onUse(cid, item, fromPosition, itemEx, toPosition)
	voc = getPlayerBasicVoc(cid);
	mp = QUASIORRRUAAAZZ[voc].mana or 0;
	hp = QUASIORRRUAAAZZ[voc].health or 0;
	if( ((not mp) and (not hp)) or ((#mp<2) or (#hp < 2))) then
bugged :)

You should use locals in the function or move local mp, hp,voc; inside the function,
or it'll change those variables and they'll be available the next time script is executed :p
 
isKnight should work for knight and ek... but this will work

Code:
local lvl = 50
local id = potion_id_here

function onUse (cid, item, fromPosition, itemEx, toPosition)
  local level, voc = getPlayerLevel(cid), getPlayerVocation(cid)
if item.itemid == id then
    if voc == 1 or voc == 2 or voc == 5 or voc == 6 and level >= lvl then
      doCreatureAddMana(cid, math.random(200,300))
    elseif voc == 3 and voc == 7 and level >= lvl then
      doCreatureAddMana(cid, math.random(150,200))
      doCreatureAddHealth(cid, math.random(200,400))
    elseif voc == 4 and voc == 8 and level >= lvl then
      doCreatureAddHealth(cid, math.random(800,1000))
    else
      doPlayerSendCancel(cid,"You have to be above level 50 to use this potion!",19)
    end
  end
  return true
end
 
Last edited:
l1ke that?
funone3kk.gif
 
@up, and u can use it whole time, cuz there is no exhaust, either potion is not removing.

@Cykotitan! Do you have to pwning me all the time?! :x And that face in ur avatar making my mistake bigger! ;x
 
Back
Top