Comparte
Ver el tema anteriorIr abajoVer el tema siguiente
Mapper
Mensajes Mensajes : 42
Ver perfil de usuario

Hot cuisine dishes for TFS 1.0 (Cocinando cómo en Tibia RL)

el Dom Jul 06, 2014 9:24 pm
Características:

- Ajuste de la velocidad de trabajo bajo el agua, si no se utiliza el casco helmet of the deep.
- Todos los "Hot cuisine dishes" scripteados
- Mejorada la underwater script.

Este script le permite utilizar esos platos, los valores pueden ser diferentes a rl.
- Las conditions para las "demonic candy balls" són las misma de las que hay ahora, no se han configurado.
- Tiempo de buff de velocidad bajo el agua guardado en storages en ligar del helmet od the deep para hacer el script más estable.

Script:

actions.xml:
Código:
<action fromid="9992" toid="10001" script="food_special.lua"/>
  <action itemid="12540" script="food_special.lua"/>
  <action itemid="12542" script="food_special.lua"/>
  <action itemid="12543" script="food_special.lua"/>
  <action itemid="12544" script="food_special.lua"/>

food_special.lua:
Código:
local conditions = {
  CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY,
  CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN,
  CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED,
  CONDITION_BLEEDING
}
local condition_shield = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_shield, CONDITION_PARAM_SUBID, 3)
setConditionParam(condition_shield, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition_shield, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_shield, CONDITION_PARAM_SKILL_SHIELD, 10)
setConditionParam(condition_shield, CONDITION_PARAM_FORCEUPDATE, true)
local condition_ml = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_ml, CONDITION_PARAM_SUBID, 4)
setConditionParam(condition_ml, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition_ml, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_ml, CONDITION_PARAM_STAT_MAGICPOINTS, 5)
setConditionParam(condition_ml, CONDITION_PARAM_FORCEUPDATE, true)
local condition_melee = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_melee, CONDITION_PARAM_SUBID, 5)
setConditionParam(condition_melee, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition_melee, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_melee, CONDITION_PARAM_SKILL_MELEE, 10)
setConditionParam(condition_melee, CONDITION_PARAM_FORCEUPDATE, true)
local condition_dist = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_dist, CONDITION_PARAM_SUBID, 6)
setConditionParam(condition_dist, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition_dist, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_dist, CONDITION_PARAM_SKILL_DISTANCE, 10)
setConditionParam(condition_dist, CONDITION_PARAM_FORCEUPDATE, true)
local condition_f = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(condition_f, CONDITION_PARAM_SUBID, 6)
setConditionParam(condition_f, CONDITION_PARAM_BUFF_SPELL, 1)
setConditionParam(condition_f, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_f, CONDITION_PARAM_SKILL_FISHING, 50)
setConditionParam(condition_f, CONDITION_PARAM_FORCEUPDATE, true)
local condition_speed = createConditionObject(CONDITION_HASTE)
setConditionParam(condition_speed, CONDITION_PARAM_TICKS, 60 * 60 * 1000)
setConditionParam(condition_speed, CONDITION_PARAM_SPEED, 600)
local combat_i = createCombatObject()
setCombatParam(combat_i, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_RED)
setCombatParam(combat_i, COMBAT_PARAM_AGGRESSIVE, 0)
local condition_i = createConditionObject(CONDITION_INVISIBLE)
setConditionParam(condition_i, CONDITION_PARAM_TICKS, 600000)
setCombatCondition(combat_i, condition_i)
function onUse(cid, item, frompos, item2, topos)
local iid = {[9992] = 0, [9993] = 1, [9994] = 2, [9995] = 3, [9996] = 4, [9997] = 5, [9998] = 6, [9999] = 7, [10000] = 8, [10001] = 9, [12540] = 10, [12542] = 11, [12543] = 12, [12544] = 13}
  if getPlayerStorageValue(cid,17110 + iid[item.itemid]) > os.time() then
  doPlayerSendCancel(cid, "You are full.")
  return true
  end
  setPlayerStorageValue(cid,17110 + iid[item.itemid],os.time() + (15 * 60) )
 
  if item.itemid == 9992 then
    doRemoveItem(item.uid, 1)
    Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid))
    doCreatureSay(cid, "Gulp.", 34)
    doPlayerSendTextMessage(cid, 18, "Your health has been refilled.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9993 then
    doRemoveItem(item.uid, 1)
    for i = 1, #conditions do
      doRemoveCondition(cid, conditions[i])
    end
    doCreatureSay(cid, "Chomp.", 34)
    doPlayerSendTextMessage(cid, 18, "You feel better body condition.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9994 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_shield)
    doCreatureSay(cid, "Chomp.", 34)
    doPlayerSendTextMessage(cid, 18, "You feel less vulnerable.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9995 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_ml)
    doCreatureSay(cid, "Chomp.", 34)
    doPlayerSendTextMessage(cid, 18, "You feel smarter.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9996 then
    doRemoveItem(item.uid, 1)
    doCreatureSay(cid, "Slurp.", 34)
    doPlayerSendTextMessage(cid, 18, "You don't really know what this did to you, but suddenly you feel very happy.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_HEARTS)
    return true
  elseif item.itemid == 9997 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_melee)
    doCreatureSay(cid, "Yum.", 34)
    doPlayerSendTextMessage(cid, 18, "You feel stronger.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9998 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_speed)
    doCreatureSay(cid, "Munch.", 34)
    doPlayerSendTextMessage(cid, 18, "Your speed has been increased.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 9999 then
    doRemoveItem(item.uid, 1)
    Creature(cid):addMana(Creature(cid):getMaxMana() - Creature(cid):getMana())
    doCreatureSay(cid, "Chomp.", 34)
    doPlayerSendTextMessage(cid, 18, "Your mana has been refilled.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 10000 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_dist)
    doCreatureSay(cid, "Mmmm.", 34)
    doPlayerSendTextMessage(cid, 18, "You feel more focused.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 10001 then
    doRemoveItem(item.uid, 1)
    doAddCondition(cid, condition_f)
    doCreatureSay(cid, "Smack.", 34)
    doPlayerSendTextMessage(cid, 18, "You felt fishing inspiration.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 12540 then
    doRemoveItem(item.uid, 1)
    setPlayerStorageValue(cid,17100,os.time() + 86400 )
    doCreatureSay(cid, "Yum.", 34)
    doPlayerSendTextMessage(cid, 18, "Underwater walking speed increased.")
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 12542 then
    if math.random(1,5) == 5 then
    doRemoveItem(item.uid, 1)
    doPlayerSendTextMessage(cid, 18, "You take the last gulp from the large bowl. No leftovers!")
    else
    doPlayerSendTextMessage(cid, 18, "You take a gulp from the large bowl, but there's still some blackjack in it.")
    end
    Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid))
    doCreatureSay(cid, "Gulp.", 34)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 12543 then
    doRemoveItem(item.uid, 1)
    local c = {condition_shield,condition_ml,condition_melee,condition_dist,condition_speed}
    local r = math.random(1,4)
    if r == 1 then
      doAddCondition(cid, c[math.random(1, #c)])
      doPlayerSendTextMessage(cid, 18, "You feel stronger, but you have no idea what was increased.")
    elseif r == 2 then
      doSetCreatureLight(cid, 15, 154, 60*60*1000)
      doPlayerSendTextMessage(cid, 18, "You feel enlightened.")
    elseif r == 3 then
      doAddCondition(cid, condition_i)
      doPlayerSendTextMessage(cid, 18, "You became invisible.")
    elseif r == 4 then
      Creature(cid):addHealth(getCreatureMaxHealth(cid) - getCreatureHealth(cid))
      Creature(cid):addMana(Creature(cid):getMaxMana() - Creature(cid):getMana())
      doPlayerSendTextMessage(cid, 18, "Your vitality has been restored.")
    end
    doCreatureSay(cid, "Smack.", 34)
    doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
    return true
  elseif item.itemid == 12544 then
    local ring = getPlayerSlotItem(cid, CONST_SLOT_RING)
    local r_t = {
    [2211] = 2208,
    [2212] = 2209,
    [6301] = 6300,
    [2215] = 2213,
    [2204] = 2167,
    [2205] = 2168,
    [2164] = 2164,
    [2203] = 2166,
    [18528] = 18408,
    [2216] = 2214,
    [13826] = 13825,
    [2202] = 2165,
    [2210] = 2207,
    [2206] = 2169}
    if(ring.itemid == 0) then
      doPlayerSendTextMessage(cid, 18, "No ring equipped.")
      doSendMagicEffect(fromPosition, CONST_ME_POFF)
      return true
    end
   
    if r_t[ring.itemid] ~= nil then
      doRemoveItem(item.uid, 1)
      if ring.itemid == r_t[ring.itemid] then
      r_m_am = 20
      else
      r_m_am = 1
      end
     
      for i = 1, 10 do
        doPlayerAddItem(cid, r_t[ring.itemid], r_m_am)
      end
      doPlayerSendTextMessage(cid, 18, "Your ring has been multiplied.")
      doCreatureSay(cid, "Slurp!", 34)
      return true
    else
      doPlayerSendTextMessage(cid, 18, "This ring cannot be multiplied.")
      doSendMagicEffect(fromPosition, CONST_ME_POFF)   
      return true
    end
  end
end

movements.xml:
Código:
<movevent event="StepIn" fromid="5406" toid="5410" script="drowning.lua"/>
  <movevent event="StepOut" fromid="5406" toid="5410" script="drowning.lua"/>
  <movevent event="StepIn" itemid="5743" script="drowning.lua"/>
  <movevent event="StepIn" itemid="5744" script="drowning.lua"/>
  <movevent event="StepIn" itemid="5764" script="drowning.lua"/>
  <movevent event="StepIn" itemid="9671" script="drowning.lua"/>
  <movevent event="StepIn" itemid="9672" script="drowning.lua"/>
  <movevent event="StepIn" itemid="9673" script="drowning.lua"/>
  <movevent event="StepIn" itemid="10019" script="drowning.lua"/>
  <movevent event="StepOut" itemid="5743" script="drowning.lua"/>
  <movevent event="StepOut" itemid="5744" script="drowning.lua"/>
  <movevent event="StepOut" itemid="5764" script="drowning.lua"/>
  <movevent event="StepOut" itemid="9671" script="drowning.lua"/>
  <movevent event="StepOut" itemid="9672" script="drowning.lua"/>
  <movevent event="StepOut" itemid="9673" script="drowning.lua"/>
  <movevent event="StepOut" itemid="10019" script="drowning.lua"/>

drowning.lua (pege esto en lugar de lo que hay dentro)
Código:
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_PERIODICDAMAGE, -20)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_TICKINTERVAL, 2000)

function onStepIn(cid, item, position, fromPosition)
local slotItem = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
  if isPlayer(cid) then
    if Player(cid):getCondition(CONDITION_DROWN,CONDITIONID_COMBAT) == nil then
    doAddCondition(cid, condition)
    end
    if getPlayerStorageValue(cid,17100) > os.time() then
    if getPlayerStorageValue(cid,17101) < 1 then
      doChangeSpeed(cid, 600)
      setPlayerStorageValue(cid,17101,1)
    end
    end
  end

  if(math.random(1, 10) == 1) then
    doSendMagicEffect(position, CONST_ME_BUBBLES)
  end
  return true
end

local underWater = {5405, 5406, 5407, 5408, 5409, 5410, 5743, 5744, 5764, 9671, 9672, 9673, 10019}

function onStepOut(cid, item, pos)
  if isPlayer(cid) then
    if(isInArray(underWater, getThingfromPos({x = getThingPos(cid).x, y = getThingPos(cid).y, z = getThingPos(cid).z, stackpos = 0}).itemid)) then
      return true
    else
      doRemoveCondition(cid, CONDITION_DROWN)
      if getPlayerStorageValue(cid,17101) == 1 then
        doChangeSpeed(cid, 600 * (-1))
        setPlayerStorageValue(cid,17101,0)
      end
    end
  end
  return true
end
Ver el tema anteriorVolver arribaVer el tema siguiente
Permisos de este foro:
No puedes responder a temas en este foro.