Ir para conteúdo

[PEDIDO] Potion System


jenison06

Posts Recomendados

Base: PokeStorm

Bom dia

Queria um Sistema de Usar Potion na Pokeball ou na Portrait se possivel.

 

Aqui esta meu Potion.lua

local potions = {
	[8783] = {baseHeal = 1800, healTimes = 10, msgColor = 175}, --Full Potion
	[2112] = {baseHeal = 950, healTimes = 8, msgColor = 181}, --Hyper Potion
	[2113] = {baseHeal = 600, healTimes = 7, msgColor = 23}, --Ultra Potion
	[2115] = {baseHeal = 350, healTimes = 6, msgColor = 30}, --Great Potion
	[2114] = {baseHeal = 200, healTimes = 5, msgColor = 177}, --Small Potion
	[9270] = {baseHeal = 225, healTimes = 5, msgColor = 177}, --Starter's Small Potion
}

local texts = {
	[PORTUGUESE] = {"Use isso em você mesmo ou em seu pokémon.", "Você já está se curando.", "Seu pokémon já está sendo curado."},
	[ENGLISH] = {"Use it in your pokemon or in yourself.", "You are already healing yourself.", "Your pokemon is already being healed."},
}

local potionState = {}

local function potionHeal(cid, heal, healed, maxHeal)
	if isCreature(cid) and healed <= maxHeal then
		doCreatureAddHealth(cid, heal)
		doSendMagicEffect(getCreaturePosition(cid), 12)
		addEvent(potionHeal, 1000, cid, heal, healed+1, maxHeal)
	else
		potionState[cid] = nil
	end
end

function onUse (cid,item,frompos,item2,topos)
	local txt = texts[getPlayerLanguage(cid)]
	local potion = potions[item.itemid]
	
	if not isCreature(item2.uid) or getCreatureMaster(item2.uid) ~= cid then
		doPlayerSendCancel(cid, txt[1])
        return true
	end
		
	if not potionState[item2.uid] then
		if isPokeballIn(item2.itemid) then
			healQuant = potion.baseHeal*(1+getPlayerSkillLevel(cid, SKILL_FIRSTAID)*0.05)
		elseif isSummon(item2.uid) then
			healQuant = potion.baseHeal*(1+getPlayerSkillLevel(cid, SKILL_FIRSTAID)*0.05)
		else
			healQuant = potion.baseHeal*(1+getPlayerSkillLevel(cid, SKILL_FIRSTAID)*0.05/2)
		end
		potionState[item2.uid]  = true
		doRemoveItem(item.uid, 1)
        doSendAnimatedText(getCreaturePosition(item2.uid), 'HEALING!', potion.msgColor)
		potionHeal(item2.uid, healQuant, 1, potion.healTimes)
	else
		if isPlayer(item2.uid) then
			doPlayerSendCancel(cid, txt[2])
		else
			doPlayerSendCancel(cid, txt[3])
		end
	end
	
	return true
end

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...