Ir para conteúdo
  • 0

Sistema de Correr e mudar Looktype


Pergunta

Gostaria que quando o player fala-se "Run" certa vocação muda-se para outra looktype e depois de falar "Run" volta-se a looktype normal.

(OBS: quero que perca 2 pontos de mana por segundo enquanto estiver usando "RUN" e ganhar + 100 de speed)

 

function onSay(cid, words, param)

local hpGain = 5
local vocs = {
[1] = 538,
[2] = 585,
[3] = 536,
}
if not vocs[getPlayerVocation(cid)] then
return true
end
if getPlayerStorageValue(cid, 9329) < 1 then
doCreatureSetNoMove(cid, true)
setPlayerStorageValue(cid, 9329, 1)
heal(cid, hpGain)
doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
elseif getPlayerStorageValue(cid, 9329) >= 1 then
doCreatureSetNoMove(cid, false)
setPlayerStorageValue(cid, 9329, -1)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
return true
end
function heal(uid, hp)
if not isPlayer(uid) then
return true
end
if getPlayerStorageValue(uid, 9329) < 1 then
return true
end
doCreatureAddHealth(uid, hp)
return addEvent(heal, 1 * 1500, uid, hp)
end

 

Tem esse script do Roksas e do Vodkart , se der para usar como base .

Editado por DarkHeel
Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/
Compartilhar em outros sites

14 respostass a esta questão

Posts Recomendados

  • 0

#GoodLuck.

 

 

function onSay(cid, words, param)
 
local speedGain = 100
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}
 
if not vocs[getPlayerVocation(cid)] then
    return true
end
 
if getPlayerStorageValue(cid, 9330) < 1 then
    doCreatureSetNoMove(cid, true)
    setPlayerStorageValue(cid, 9330, 1)
    speed(cid, speedGain, 2)
    doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
    
elseif getPlayerStorageValue(cid, 9330) >= 1 then
    doCreatureSetNoMove(cid, false)
    setPlayerStorageValue(cid, 9330, -1)
    doRemoveCondition(cid, CONDITION_OUTFIT)
end
    return true
end
 
function speed(uid, speed, mlose)
 
if not isPlayer(uid) then
    return true
end

if getCreatureMana(uid) < mlose then
    return true
end
 
if getPlayerStorageValue(uid, 9330) < 1 then
    return true
end
 
doCreatureAddMana(uid, -mlose)
doChangeSpeed(uid, getCreatureSpeed(uid) + speed)
    return addEvent(speed, 1 * 1500, uid, speed)
end
Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551632
Compartilhar em outros sites

  • 0

3 Bugs D=

 

1° Era que você esqueceu de trocar

 

 

doCreatureSetNoMove(cid, true)

2° Apenas perde 1 de mana quando fala !Run , era pra perder a cada 1 seg

 

3° to com 100 de speed usei !Run fiquei com 200 usei !run continuo com 200 ai uso denovo !run fico com 300 (Vai multiplicando)

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551646
Compartilhar em outros sites

  • 0

Prontinho!

 

 

function onSay(cid, words, param)
 
local speedGain = 100
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}
 
if not vocs[getPlayerVocation(cid)] then
    return true
end
 
if getPlayerStorageValue(cid, 9330) < 1 then
    setPlayerStorageValue(cid, 9330, 1)
    speed(cid, speedGain, 2)
    doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
    
elseif getPlayerStorageValue(cid, 9330) >= 1 then
    setPlayerStorageValue(cid, 9330, -1)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    doChangeSpeed(cid, getCreatureSpeed(cid) - 100)
end
    return true
end
 
function speed(uid, speed, mlose)
 
if not isPlayer(uid) then
    return true
end

if getCreatureMana(uid) < mlose then
    return true
end
 
if getPlayerStorageValue(uid, 9330) < 1 then
    return true
end
 
doCreatureAddMana(uid, -mlose)
doChangeSpeed(uid, getCreatureSpeed(uid) + speed)
    return addEvent(speed, 1 * 1500, uid, speed, mlose)
end
Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551649
Compartilhar em outros sites

  • 0

Continua perdendo mana so quando ativa

 

agora quando você desativa o !run continua com a velocidade que estava antes e depois que usa !run duplica D=

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551654
Compartilhar em outros sites

  • 0

 

function onSay(cid, words, param)
 
local speedGain = 100
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}
 
if not vocs[getPlayerVocation(cid)] then
    return true
end
 
if getPlayerStorageValue(cid, 9330) < 1 then
    setPlayerStorageValue(cid, 9330, 1)
    doChangeSpeed(cid, getCreatureSpeed(uid) + speedGain)
    speed(cid, 2)
    doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
    
elseif getPlayerStorageValue(cid, 9330) >= 1 then
    setPlayerStorageValue(cid, 9330, -1)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    doChangeSpeed(cid, getCreatureSpeed(cid) - speedGain)
end
    return true
end
 
function speed(uid, mlose)
 
if not isPlayer(uid) then
    return true
end

if getCreatureMana(uid) < mlose then
    return true
end
 
if getPlayerStorageValue(uid, 9330) < 1 then
    return true
end
 
doCreatureAddMana(uid, -mlose)
    return addEvent(speed, 1 * 1500, uid, mlose)
end
Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551663
Compartilhar em outros sites

  • 0
function onSay(cid, words, param)
 
local speedGain = 100
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}
 
if not vocs[getPlayerVocation(cid)] then
    return true
end
 
if getPlayerStorageValue(cid, 9330) < 1 then
    setPlayerStorageValue(cid, 9330, 1)
    doChangeSpeed(cid, getCreatureSpeed(uid) + speedGain)
    speed(cid, 2)
    doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
    
elseif getPlayerStorageValue(cid, 9330) >= 1 then
    setPlayerStorageValue(cid, 9330, -1)
    doRemoveCondition(cid, CONDITION_OUTFIT)
    doChangeSpeed(cid, getCreatureSpeed(cid) - speedGain)
end
    return true
end
 
function speed(uid, mlose)
 
if not isPlayer(uid) then
    return true
end

if getCreatureMana(uid) < mlose then
    return true
end
 
if getPlayerStorageValue(uid, 9330) < 1 then
    return true
end
 
doCreatureAddMana(uid, -mlose)
    return addEvent(speed, 1 * 1500, uid, mlose)
end

 

Agora não muda looktype , duplica a velocidade quando você fala !run !run duas vezes

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551664
Compartilhar em outros sites

  • 0

testa ae...

 

 

local speedGain = 100
local manaLose = 1
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}

local function event(uid, mlose, speed)
   if not isPlayer(uid) then
      return true
   end

   if getCreatureMana(uid) < mlose then
      setPlayerStorageValue(uid, 9330, -1)
      doRemoveCondition(uid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(uid) - speed
      doChangeSpeed(uid, -getCreatureSpeed(uid))
      doChangeSpeed(uid, sp)
      return true
   end
 
   if getPlayerStorageValue(uid, 9330) < 1 then
      return true
   end
 
   doPlayerAddMana(uid, -mlose)
   return addEvent(event, 1000, uid, mlose, speed)
end

function onSay(cid, words, param)
   if not vocs[getPlayerVocation(cid)] then
      return true
   end
 
   if getPlayerStorageValue(cid, 9330) < 1 then
      setPlayerStorageValue(cid, 9330, 1)
      local sp = getCreatureSpeed(cid)
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp + speedGain)
      event(cid, manaLose, speedGain)
      doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
   elseif getPlayerStorageValue(cid, 9330) >= 1 then
      setPlayerStorageValue(cid, 9330, -1)
      doRemoveCondition(cid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(cid) - speedGain
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp)
   end
return true
end

 

rok, rok, rok...

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551676
Compartilhar em outros sites

  • 0

testa ae...

 

 

local speedGain = 100
local manaLose = 1
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}

local function event(uid, mlose, speed)
   if not isPlayer(uid) then
      return true
   end

   if getCreatureMana(uid) < mlose then
      setPlayerStorageValue(uid, 9330, -1)
      doRemoveCondition(uid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(uid) - speed
      doChangeSpeed(uid, -getCreatureSpeed(uid))
      doChangeSpeed(uid, sp)
      return true
   end
 
   if getPlayerStorageValue(uid, 9330) < 1 then
      return true
   end
 
   doPlayerAddMana(uid, -mlose)
   return addEvent(event, 1000, uid, mlose, speed)
end

function onSay(cid, words, param)
   if not vocs[getPlayerVocation(cid)] then
      return true
   end
 
   if getPlayerStorageValue(cid, 9330) < 1 then
      setPlayerStorageValue(cid, 9330, 1)
      local sp = getCreatureSpeed(cid)
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp + speedGain)
      event(cid, manaLose, speedGain)
      doSetCreatureOutfit(cid, {lookType = vocs[getPlayerVocation(cid)]}, -1)
   elseif getPlayerStorageValue(cid, 9330) >= 1 then
      setPlayerStorageValue(cid, 9330, -1)
      doRemoveCondition(cid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(cid) - speedGain
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp)
   end
return true
end

 

rok, rok, rok...

 

Funcionou perfeitamente + se eu to com outfit de um citizen colorida , quando eu fala !run ela fica toda branca =/

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551730
Compartilhar em outros sites

  • 0

eu odeio esse problema kk'

achu q agora vai...

 

 

local speedGain = 100
local manaLose = 1
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}

local function event(uid, mlose, speed)
   if not isPlayer(uid) then
      return true
   end

   if getCreatureMana(uid) < mlose then
      setPlayerStorageValue(uid, 9330, -1)
      doRemoveCondition(uid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(uid) - speed
      doChangeSpeed(uid, -getCreatureSpeed(uid))
      doChangeSpeed(uid, sp)
      return true
   end
 
   if getPlayerStorageValue(uid, 9330) < 1 then
      return true
   end
 
   doPlayerAddMana(uid, -mlose)
   return addEvent(event, 1000, uid, mlose, speed)
end

function onSay(cid, words, param)
   if not vocs[getPlayerVocation(cid)] then
      return true
   end
 
   if getPlayerStorageValue(cid, 9330) < 1 then
      local out = getCreatureOutfit(cid)
      out.lookType = vocs[getPlayerVocation(cid)]
      setPlayerStorageValue(cid, 9330, 1)
      local sp = getCreatureSpeed(cid)
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp + speedGain)
      event(cid, manaLose, speedGain)
      doSetCreatureOutfit(cid, out, -1)
   elseif getPlayerStorageValue(cid, 9330) >= 1 then
      setPlayerStorageValue(cid, 9330, -1)
      doRemoveCondition(cid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(cid) - speedGain
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp)
   end
return true
end

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551731
Compartilhar em outros sites

  • 0

 

eu odeio esse problema kk'

achu q agora vai...

 

 

local speedGain = 100
local manaLose = 1
local vocs = {
    [1] = 538,
    [2] = 585,
    [3] = 536,
}

local function event(uid, mlose, speed)
   if not isPlayer(uid) then
      return true
   end

   if getCreatureMana(uid) < mlose then
      setPlayerStorageValue(uid, 9330, -1)
      doRemoveCondition(uid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(uid) - speed
      doChangeSpeed(uid, -getCreatureSpeed(uid))
      doChangeSpeed(uid, sp)
      return true
   end
 
   if getPlayerStorageValue(uid, 9330) < 1 then
      return true
   end
 
   doPlayerAddMana(uid, -mlose)
   return addEvent(event, 1000, uid, mlose, speed)
end

function onSay(cid, words, param)
   if not vocs[getPlayerVocation(cid)] then
      return true
   end
 
   if getPlayerStorageValue(cid, 9330) < 1 then
      local out = getCreatureOutfit(cid)
      out.lookType = vocs[getPlayerVocation(cid)]
      setPlayerStorageValue(cid, 9330, 1)
      local sp = getCreatureSpeed(cid)
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp + speedGain)
      event(cid, manaLose, speedGain)
      doSetCreatureOutfit(cid, out, -1)
   elseif getPlayerStorageValue(cid, 9330) >= 1 then
      setPlayerStorageValue(cid, 9330, -1)
      doRemoveCondition(cid, CONDITION_OUTFIT)
      local sp = getCreatureSpeed(cid) - speedGain
      doChangeSpeed(cid, -getCreatureSpeed(cid))
      doChangeSpeed(cid, sp)
   end
return true
end

 

 

Vlw cara , pensei que se me odiava todo tópico que eu fazia tu passava la nem respondia =X , amanha te do REP+ sem falta esgoto aki .

Link para o comentário
https://xtibia.com/forum/topic/219590-sistema-de-correr-e-mudar-looktype/#findComment-1551741
Compartilhar em outros sites

×
×
  • Criar Novo...