Postado Fevereiro 23, 2018 7 anos Gostaria de juntar duas scripts que tenho em uma só, formando apenas um sistema. Ambas funcionam perfeitamente independes, logo, gostaria de aplicar dependência de uma na outra. Script 1: É responsável pelo sistema de felicidade a partir de comidas no servidor. Script 2: É responsável por dar uma pequena cura ao usar comida no pokémon. Como gostaria: Gostaria que, caso o pokémon não esteja com fome, o jogador consiga alimentar, fazendo com que cure o pokémon. Script 1: local FOODS = { --ID DA COMIDA / QUANTIDADE DE "ENCHIMENTO / O QUE FALA QUANDO ALIMENTA. [2666] = {15, "Munch."}, [2667] = {12, "Munch."}, [2668] = {10, "Mmmm."}, [2669] = {17, "Munch."}, [2670] = {4, "Gulp."}, [2671] = {30, "Chomp."}, [2672] = {60, "Chomp."}, } function onUse(cid, item, fromPosition, itemEx, toPosition) local z = getCreatureSummons(cid)[1] local food = FOODS[item.itemid] if(not food) then return false end if #getCreatureSummons(cid) <= 0 then if((getPlayerFood(cid) + food[1]) >= 400) then doPlayerSendCancel(cid, "You are full.") return true end doPlayerFeed(cid, food[1] * 4) doCreatureSay(cid, food[2], TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) return true elseif #getCreatureSummons(cid) >= 1 then fome = getPlayerStorageValue(getCreatureSummons(cid)[1], 66604) if fome<= 250 then doSendDistanceShoot(getPlayerPosition(cid), getCreaturePosition(z), 39) doCreatureSay(getCreatureSummons(cid)[1], food[2], TALKTYPE_ORANGE_1) doRemoveItem(item.uid, 1) setPlayerStorageValue(getCreatureSummons(cid)[1], 66604, (fome + (food[1]*4))) return true else doPlayerSendCancel(cid, "Seu pokémon não está com fome.") getHappinesStatus(getCreatureSummons(cid)[1], true) return true end end end Script 2: function doHealOverTime(cid, heal, turn, effect) --alterado v1.6 peguem o script todo!! if not isCreature(cid) then return true end if turn <= 0 or (getCreatureHealth(cid) == getCreatureMaxHealth(cid)) or getPlayerStorageValue(cid, 173) <= 0 then setPlayerStorageValue(cid, 173, -1) return elseif getCreatureHealth(cid) + heal/10 >= getCreatureMaxHealth(cid) then doSendAnimatedText(getThingPos(cid), "+"..getCreatureMaxHealth(cid) - getCreatureHealth(cid), 65) doCreatureAddHealth(cid, getCreatureMaxHealth(cid) - getCreatureHealth(cid)) doSendMagicEffect(getThingPos(cid), 12) return end doSendAnimatedText(getThingPos(cid), "+"..heal/10, 65) doCreatureAddHealth(cid, heal/10) doSendMagicEffect(getThingPos(cid), 12) addEvent(doHealOverTime, 1000, cid, heal, turn - 1, effect) addEvent(doUpdateStatusPoke, 1100, getCreatureMaster(cid)) end local restoration = { [2273] = {health = 20, animate = "Berry Juice", collor = 140}, [2272] = {health = 80, animate = "Big Malasada", collor = 140}, [2271] = {health = 50, animate = "Energy Powder", collor = 140}, [2275] = {health = 200, animate = "Energy Root", collor = 140}, [2274] = {health = 50, animate = "Fresh Water", collor = 140}, [2274] = {health = 50, animate = "Heal Powder", collor = 140}, [2274] = {health = 80, animate = "Lava Cookie", collor = 140}, [2274] = {health = 80, animate = "Lemonade", collor = 140}, [2274] = {health = 100, animate = "Moomoo Milk", collor = 140}, [2274] = {health = 20, animate = "Rage Candy Bar", collor = 140}, [2274] = {health = 140, animate = "Revival Herb", collor = 140}, [2274] = {health = 60, animate = "Soda Pop", collor = 140}, [2274] = {health = 20, animate = "Sweet Heart", collor = 140}, --DROPS [2274] = {health = 80, animate = "Hot dog", collor = 140}, --NPCS } function onUse(cid, item, frompos, item2, topos) local pid = getThingFromPosWithProtect(topos) local pokeballInfo = getPokeballInfo(getPlayerSlotItem(cid, 8).uid) if not isCreature(pid) or not isSummon(pid) then return doPlayerSendCancel(cid, "You can only use restoration on your own Pokemons!") end if getCreatureMaster(pid) ~= cid then return doPlayerSendCancel(cid, "You can only use restoration on your own Pokemons!") end if getCreatureHealth(pid) == getCreatureMaxHealth(pid) then return doPlayerSendCancel(cid, "This pokemon is already at full health.") end if getPlayerStorageValue(pid, 173) >= 1 then return doPlayerSendCancel(cid, "This pokemon is already under effects of restoration.") end if getPlayerStorageValue(cid, 52481) >= 1 then return doPlayerSendCancel(cid, "You can't do that while a duel.") end doCreatureSay(cid, "".. pokeballInfo.nick..", take this potion!", TALKTYPE_SAY) doSendAnimatedText(getThingPos(pid), restoration[item.itemid].animate, restoration[item.itemid].collor) setPlayerStorageValue(pid, 173, 1) doRemoveItem(item.uid, 1) doHealOverTime(pid, restoration[item.itemid].health, 10, 12) return true end
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.