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

antidote potion, using on ground!

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
I would like to make this script that when you use on the ground, it throw water...

LUA:
local EMPTY_POTION = 7636

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

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

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

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

        if(not doCombat(cid, combat, numberToVariant(itemEx.uid))) then
                return false
        end

        doAddCondition(cid, exhaust)
        doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)

        doRemoveItem(item.uid, 1)
        if(fromPosition ~= CONTAINER_POSITION) then
                doCreateItem(potion.empty, fromPosition)
        else
                doPlayerAddItem(cid, potion.empty, 1)
        end

        return true
end

I rep++!

Thanks!
 
LUA:
local EMPTY_POTION = 7636

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

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

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayer(itemEx.uid) then
		if(hasCondition(cid, CONDITION_EXHAUST)) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
			return true
		end

		if(not doCombat(cid, combat, numberToVariant(itemEx.uid))) then
			return false
		end

		doAddCondition(cid, exhaust)
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
	else
		doDecayItem(doCreateItem(2016, 1, (toPosition.x == CONTAINER_POSITION or (toPosition.x == 0 and toPosition.y == 0 and toPosition.z == 0)) and getThingPos(cid) or toPosition))
	end

	doChangeTypeItem(item.uid, item.type - 1)
	if(fromPosition ~= CONTAINER_POSITION) then
		doCreateItem(EMPTY_POTION, 1, fromPosition)
	else
		doPlayerAddItem(cid, EMPTY_POTION, 1)
	end

	return true
end
 

Similar threads

Back
Top