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

[8.4]Fluids.lua - Need Edit.

Marviouss

New Member
Joined
Feb 20, 2009
Messages
12
Reaction score
0
Hello. I have request for you, users. Can somebody edit me it :

-- TODO: Rewrite this script using fluidtypes from LIQUIDS doc-file,
-- and correct itemid's to recieve the liquids.

local drunk = createConditionObject(CONDITION_DRUNK)
setConditionParam(drunk, CONDITION_PARAM_TICKS, 60000)

local poison = createConditionObject(CONDITION_POISON)
addDamageCondition(poison, 2, 6000, -5)
addDamageCondition(poison, 3, 6000, -4)
addDamageCondition(poison, 5, 6000, -3)
addDamageCondition(poison, 10, 6000, -2)
addDamageCondition(poison, 20, 6000, -1)

local fluidType = {3, 4, 5, 7, 10, 11, 13, 15, 19}
local fluidMessage = {"Aah...", "Urgh!", "Mmmh.", "Aaaah...", "Aaaah...", "Urgh!", "Urgh!", "Aah...", "Urgh!"}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if itemEx.itemid == 1 then
if item.type == 0 then
doPlayerSendCancel(cid, "It is empty.")
elseif itemEx.uid == cid then
doChangeTypeItem(item.uid, 0)
if item.type == 3 or item.type == 15 then
doTargetCombatCondition(0, cid, drunk, CONST_ME_NONE)
elseif item.type == 4 then
doTargetCombatCondition(0, cid, poison, CONST_ME_NONE)
elseif item.type == 7 then
doPlayerAddMana(cid, math.random(50, 150))
doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
elseif item.type == 10 then
doCreatureAddHealth(cid, 60)
doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
end
for i = 0, table.maxn(fluidType) do
if item.type == fluidType then
doCreatureSay(cid, fluidMessage, TALKTYPE_ORANGE_1)
return TRUE
end
end
doCreatureSay(cid, "Gulp.", TALKTYPE_ORANGE_1)
else
local splash = doCreateItem(2025, item.type, toPosition)
doChangeTypeItem(item.uid, 0)
doDecayItem(splash)
end
elseif (itemEx.itemid >= 490 and itemEx.itemid <= 493) or (itemEx.itemid >= 4608 and itemEx.itemid <= 4625) or (itemEx.itemid >= 618 and itemEx.itemid <= 629) or itemEx.itemid == 1771 then
doChangeTypeItem(item.uid, 9)
elseif itemEx.itemid == 103 then
doChangeTypeItem(item.uid, 19)
elseif (itemEx.itemid >= 598 and itemEx.itemid < 712) or itemEx.itemid == 1509 then
doChangeTypeItem(item.uid, 26)
elseif (itemEx.itemid >= 351 and itemEx.itemid <= 355) then
doChangeTypeItem(item.uid, 19)
elseif (itemEx.itemid >= 602 and itemEx.itemid <= 605) then
doChangeTypeItem(item.uid, 28)
elseif itemEx.itemid == 1772 then
doChangeTypeItem(item.uid, 3)
elseif itemEx.itemid == 1773 then
doChangeTypeItem(item.uid, 15)
elseif item.type == 0 then
doPlayerSendCancel(cid, "It is empty.")
else
if toPosition.x == CONTAINER_POSITION then
toPosition = getCreaturePosition(cid)
end
splash = doCreateItem(2025, item.type, toPosition)
doChangeTypeItem(item.uid, 0)
doDecayItem(splash)
end
return TRUE
end


to :

  • Knight CAN use strong mana potion
  • Strong mana potion will give 150-300 mana.


***************

Sorry for my english, but i learning it only ~~3 years.
 
You need edit strong_mana.lua for your requests :)
Here replace your strong_mana.lua for this;
PHP:
local MIN = 150
local MAX = 300
local EMPTY_POTION = 7634

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if isPlayer(itemEx.uid) == FALSE then
        return FALSE
    end

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

    if((not(isSorcerer(itemEx.uid) or isKnight(itemEx.uid) isDruid(itemEx.uid) or isPaladin(itemEx.uid)) or getPlayerLevel(itemEx.uid) < 50) and getPlayerCustomFlagValue(itemEx.uid, PlayerCustomFlag_GamemasterPrivileges) == FALSE) then
        doCreatureSay(itemEx.uid, "Only Level 50 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return TRUE
    end

    if doPlayerAddMana(itemEx.uid, math.random(MIN, MAX)) == LUA_ERROR then
        return FALSE
    end

    doAddCondition(cid, exhaust)
    doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE)
    doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
    doTransformItem(item.uid, EMPTY_POTION)
    return TRUE
end
 
Hmm ... But I dont have "strong_mana.lua" on my server. I useing TFS with evolution map.
 
data>actions>scripts>other>potions.lua

and change with this script:
Code:
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(itemEx.uid ~= cid or itemEx.itemid ~= 1) then
		return TRUE
	end

	if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

	if(item.itemid == antidotePot) then
		if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == smallHealthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == healthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == strongHealthPot) then
		if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 150, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, strongEmptyPot)
	elseif(item.itemid == strongManaPot) then
		if(doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, strongEmptyPot)
	elseif(item.itemid == greatSpiritPot) then
		if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == greatHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == greatManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatMana(0, cid, 200, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == ultimateHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 800, 1000, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	end
	return TRUE
end

PHP:
    * Knight CAN use strong mana potion.(Working)
    * Strong mana potion will give 150-300 mana.(Working)
 
Last edited:
data>actions>scripts>other>potions.lua

and change with this script:
Code:
local ultimateHealthPot = 8473
local greatHealthPot = 7591
local greatManaPot = 7590
local greatSpiritPot = 8472
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local smallHealthPot = 8704
local antidotePot = 8474
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

local antidote = createCombatObject()
setCombatParam(antidote, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(antidote, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(antidote, COMBAT_PARAM_TARGETCASTERORTOPMOST, TRUE)
setCombatParam(antidote, COMBAT_PARAM_AGGRESSIVE, FALSE)
setCombatParam(antidote, COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = createConditionObject(CONDITION_EXHAUST_HEAL)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(itemEx.uid ~= cid or itemEx.itemid ~= 1) then
		return TRUE
	end

	if(getCreatureCondition(cid, CONDITION_EXHAUST_HEAL) == TRUE) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return TRUE
	end

	if(item.itemid == antidotePot) then
		if(doCombat(cid, antidote, numberToVariant(cid)) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == smallHealthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 50, 100, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == healthPot) then
		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 100, 200, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == manaPot) then
		if(doTargetCombatMana(0, cid, 70, 130, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, emptyPot)
	elseif(item.itemid == strongHealthPot) then
		if(not(isKnight(cid) or isPaladin(cid)) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins and knights of level 50 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 150, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, strongEmptyPot)
	elseif(item.itemid == strongManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid) or isPaladin(cid) or [COLOR="Red"]isKnight(cid)[/COLOR]) or (getPlayerLevel(cid) < 50)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by all vocations of level 50 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, strongEmptyPot)
	elseif(item.itemid == greatSpiritPot) then
		if(not(isPaladin(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by paladins of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 200, 400, CONST_ME_MAGIC_BLUE) == LUA_ERROR or doTargetCombatMana(0, cid, 110, 190, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == greatHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 500, 700, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == greatManaPot) then
		if(not(isSorcerer(cid) or isDruid(cid)) or (getPlayerLevel(cid) < 80)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by sorcerers and druids of level 80 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatMana(0, cid, 200, 300, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	elseif(item.itemid == ultimateHealthPot) then
		if(not(isKnight(cid)) or (getPlayerLevel(cid) < 130)) and not(getPlayerGroupId(cid) >= 2) then
			doCreatureSay(cid, "This potion can only be consumed by knights of level 130 or higher.", TALKTYPE_ORANGE_1)
			return TRUE
		end

		if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 800, 1000, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
			return FALSE
		end
		doAddCondition(cid, exhaust)
		doCreatureSay(cid, "Aaaah...", TALKTYPE_ORANGE_1)
		doTransformItem(item.uid, greatEmptyPot)
	end
	return TRUE
end

PHP:
    [B]* Knight CAN use strong mana potion.(Working)[/B]
    * Strong mana potion will give 150-300 mana.(Working)

I can't use SMP in my Elite Knight :/.
 
14:02 You see a strong mana potion.
It weighs 2.00 oz.
This potion can only be consumed by sorcerers, druids, paladins and knights of level 50 or higher.

Okey but ... When i use it on my char :

The potion can be consumed only by sorcerers, druids and paladins of level 50 or highter
 

Similar threads

Back
Top