SK
sistema

[AVATAR] Water Pouch System.

Por Skymagnum, 10 de abr. de 2013 em Mods, funções e outros

script
5.0 (3)
32
4.2k
rohfagundesR
16 de abril de 2013 às 16:43

cara os erros quando abre pararam

mas agora da erro quando vc vai dar use

 

errohs.png

SkymagnumS
16 de abril de 2013 às 19:12

function onUse(cid, item, fromPosition, itemEx, toPosition) -- part's of DrakyLukas

local _ = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824,4825}
local slot = getPlayerSlotItem(cid, CONST_SLOTARROW)
local water = getWater(slot.uid)
local refil = 2 -- % of reffil

  local add = 0

  if water == 99 then
         add = 1
                else
         add = refil
  end

  if getWater(slot.uid) ~= 100 then
         if isInArray(_, itemEx.itemid) then
              setWaterPouchPercent(slot.uid, add)
         end
              else
        doPlayerSendCancel(cid, "Your pouch is full")
  end
  return true
end

 

ESUQECI DE UM END.

 

dai vc usa o item, tem que estar no slot do arrow e da use na agua, o item tem a opção useWith?

Editado Abril 16 por Skymagnum

rohfagundesR
16 de abril de 2013 às 20:16

esta dando o mesmo erro

sobre o end eu ja tinha adicionado

 

e sim o item tem a opção useWith

pvjfP
17 de abril de 2013 às 10:07

@Skymagnun Aqui vão umas dicas para melhor seu tópico

 

*Poste um Exemplo de spell com a sua função

 

*Poste prints demontrando o sistema;

 

*Qual seria um exemplo de id pra o water pouch? ID: 2031 funcionaria?

 

Edit:

 

Erro na Spell

 

[Error - LuaScriptInterface::loadFile] data/spells/scripts/attack/ice wave.lua:3
1: 'then' expected near 'water'
[Warning - Event::loadScript] Cannot load script (data/spells/scripts/attack/ice
wave.lua)
data/spells/scripts/attack/ice wave.lua:31: 'then' expected near 'water'

 

Não deu outro erro sobre esses scripts no distro, mas n consigo recarregar o meu water pouch, Como funciona ingame esse sistema? da use with em uma borda de rio para recarregar?

Editado Abril 17 por KikimDaPadaria

rohfagundesR
18 de abril de 2013 às 20:32

n postou nd ate agora '-'

 

cara fala pelo menos se ai funcionou posta print como o cara de cima falou

 

só pra gente saber se é coisa da gente

ou do script mesmo

SkymagnumS
18 de abril de 2013 às 22:12

Mals, e que estou ocupadao. aqui funcionou de boa estou usando um global distro 0.4

pvjfP
19 de abril de 2013 às 08:13

Mano n eh por nd não mas ta dando erro na spell v se ta certo:

 

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)
setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1, 2)

local area = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)
setCombatArea(combat, area)

function onCastSpell(cid, var)

local water_pounch = 2184
local slot = getPlayerSlotItem(cid, CONST_SLOTARROW)

	 local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
	 local water = true

			 local p = 2 -- quantos porcentos de agua vai usar

			 if getPlayerStorageValue(cid, 372872) < 1 then
					setWaterPouchPercent(slot.uid, 100)
					setPlayerStorageValue(cid, 372872, 1)
			end


			 if slot.uid < 1 then
					return true
			end

			 if getWaterInArea(waters, getThingPos(cid), 5, 5)
					water = false
			 end


	  if getWater(slot.uid) < p then
					doPlayerSendTextMessage(cid, 27, "Sorry, you don't have any water") return true
	  end

					if water then
					  setWaterPouchPercent(slot.uid, getWater(slot.uid) - p)
							   doPlayerSendTextMessage(cid, 27, "You use " .. p .. "% of your pouch now have" ..  getWater(slot.uid)))
									 else
											 doPlayerSendTextMessage(cid, 27, "Using ambient water.")
											 end
	  return doCombat(cid, var)
end

Editado Abril 19 por KikimDaPadaria

rohfagundesR
19 de abril de 2013 às 09:35

entao eu tb estou usando distro 0.4

 

tem alguma outra coisa q tem q colocar?

pq eu estou colocando tudo certo mas continua n funcionando

SkymagnumS
20 de abril de 2013 às 00:19

local combat = createCombatObject()

setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)

setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)

setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

setAttackFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 5, 5, 1, 2)

 

local area = createCombatArea(AREA_WAVE4, AREADIAGONAL_WAVE4)

setCombatArea(combat, area)

 

function onCastSpell(cid, var)

 

local water_pounch = 2184

local slot = getPlayerSlotItem(cid, CONST_SLOTARROW)

 

local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}

local water = true

 

local p = 2 -- quantos porcentos de agua vai usar

 

if getPlayerStorageValue(cid, 372872) < 1 then

setWaterPouchPercent(slot.uid, 100)

setPlayerStorageValue(cid, 372872, 1)

end

 

 

if slot.uid < 1 then

return true

end

 

if getWaterInArea(waters, getThingPos(cid), 5, 5) then

water = false

end

 

 

if getWater(slot.uid) < p then

doPlayerSendTextMessage(cid, 27, "Sorry, you don't have any water") return true

end

 

if water then

setWaterPouchPercent(slot.uid, getWater(slot.uid) - p)

doPlayerSendTextMessage(cid, 27, "You use " .. p .. "% of your pouch now have" .. getWater(slot.uid)))

else

doPlayerSendTextMessage(cid, 27, "Using ambient water.")

end

return doCombat(cid, var)

end

se mecheu em alguma coisa, usa essa ai tava faltando um then

pvjfP
21 de abril de 2013 às 16:33

Posta print ou video :S

Editado Abril 21 por KikimDaPadaria

rohfagundesR
21 de abril de 2013 às 21:50

alguma coisa tem errada pq as 3 pessoas q tentaram usar o sistema n conseguiram

é o mesmo erro

n apareceu ninguem q conseguiu

se tivesse pelo menos uma imagem ou um video provando q funciona

blz eu nem falava mais nd

VodkartV
21 de abril de 2013 às 23:00

pode diminuir essa parte '-'

 

 

   local add = 0

  if water == 99 then
         add = 1
                else
         add = refil
  end

 

local add = water == 99 and 1 or refil 

 

@tópico

 

acho que poderia colocar uma explicação para o pessoal que não entende muito de script

 

parabéns... rep+

SkymagnumS
21 de abril de 2013 às 23:06

pode diminuir essa parte '-'

 

 

   local add = 0

  if water == 99 then
	  add = 1
			 else
	  add = refil
  end

 

local add = water == 99 and 1 or refil 

 

@tópico

 

acho que poderia colocar uma explicação para o pessoal que não entende muito de script

 

parabéns... rep+

Sim, estava assim só que falaram que estava dando erro, então mudei, valeu vodkart.

 

@OFF

Se sumio velho kkkkk

VodkartV
22 de abril de 2013 às 05:17

tinha erros no script sim... faltava um "end" e em outro estava sobrando uma ")"

 

function onUse(cid, item, fromPosition, itemEx, toPosition) -- part's of DrakyLukas
local _ = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824,4825}
local slot = getPlayerSlotItem(cid, CONST_SLOTARROW)
local water = getWater(slot.uid)
local refil = 2 -- % of reffil
local add = water == 99 and 1 or refil
  if getWater(slot.uid) ~= 100 then
	  if isInArray(_, itemEx.itemid) then
			 setWaterPouchPercent(slot.uid, add)
	  end
			 else
			 doPlayerSendCancel(cid, "Your pouch is full")
 end
  return true
end

 

function onCastSpell(cid, var)
local water_pounch = 2184
local slot = getPlayerSlotItem(cid, CONST_SLOTARROW)
	 local waters = {4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625, 4665, 4666, 4820, 4821, 4822, 4823, 4824, 4825}
	 local water = true
			 local p = 2 -- quantos porcentos de agua vai usar

			 if getPlayerStorageValue(cid, 372872) < 1 then
					setWaterPouchPercent(slot.uid, 100)
					setPlayerStorageValue(cid, 372872, 1)
			end
			 if slot.uid < 1 then
					return true
			end

			 if getWaterInArea(waters, getThingPos(cid), 5, 5) then
					water = false
			 end
	  if getWater(slot.uid) < p then
					doPlayerSendTextMessage(cid, 27, "Sorry, you don't have any water") return true
	  end

					if water then
					  setWaterPouchPercent(slot.uid, getWater(slot.uid) - p)
							   doPlayerSendTextMessage(cid, 27, "You use " .. p .. "% of your pouch now have" ..  getWater(slot.uid))
									 else
											 doPlayerSendTextMessage(cid, 27, "Using ambient water.")
											 end
	  return doCombat(cid, var)
end

Editado Abril 22 por Vodkart

SkymagnumS
22 de abril de 2013 às 18:19

Valeu vodka.

 

@TÓPICO

 

COPIEM DENOVO.