Postado Outubro 15, 2018 6 anos Como Colocar pra mensagem aparecer com a quantidade random que ganhou? str = str .. amount .. ' ' .. getItemNameById(item_id) .. ' '..(i ~= table.maxn(items) and ', ' or '.') Mostrar conteúdo oculto local chest_areas = { [8001] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8002] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8003] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8004] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8005] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8006] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8007] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8008] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8009] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8010] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8011] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8012] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8013] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8014] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8015] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8016] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8017] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8018] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8019] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8020] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8021] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8022] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8023] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8024] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8025] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8026] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8027] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8028] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8029] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8030] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8031] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8032] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8033] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8034] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8035] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8036] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8037] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8038] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8039] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8040] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8041] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8042] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8043] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8044] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8045] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8046] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8047] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8048] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, [8049] = {name = '[Event] BOX',pos = {x=1834,y=1837,z=7}, container = 1738, items = {{100,2160,10}}}, } function onUse(cid, item, frompos, item2, topos) local v = chest_areas[item.actionid] if not v then return true end local items, quest_container, str = v.items, doPlayerAddItem(cid, v.container, 1), 'BackPack from '..v.name..', Your Rewards:\n' for i = 1, table.maxn(items) do local chance, item_id, amount = items[1], items[2], items[3] if chance >= math.random(1, 100) then str = str .. amount .. ' ' .. getItemNameById(item_id) .. ' '..(i ~= table.maxn(items) and ', ' or '.') if isItemStackable(item_id) or amount == 1 then doAddContainerItem(quest_container, item_id, chance) else for i = 1, amount do doAddContainerItem(quest_container, 1) end end end end doSendMagicEffect(getPlayerPosition(cid), math.random(28,30)) doRemoveItem(item.uid,1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,'You have found a '..str) return trueend Editado Outubro 15, 2018 6 anos por tetheuscunha (veja o histórico de edições) Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.
Postado Outubro 17, 2018 6 anos Poderia explicar isso melhor? Você quer que apareça a chance que o player conseguiu para obter a recompensa? E por que a tabela tá com a mesma variável pra todos os actionIds? items[1] é a chance que o player poderá obter ou não?
Postado Outubro 18, 2018 6 anos Autor Em 17/10/2018 em 05:08, FlavioHulk disse: Poderia explicar isso melhor? Você quer que apareça a chance que o player conseguiu para obter a recompensa? E por que a tabela tá com a mesma variável pra todos os actionIds? items[1] é a chance que o player poderá obter ou não? Não, eu quero que aparece a quantidade que o player ganhou. O player pode ganhar de 1 ate 10 crystal coins, eu quero que aparece : Você ganhou x cristal coins. Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.
Postado Outubro 18, 2018 6 anos local chest = { [8049] = { name = '[Event] BOX', container = 1738, items = { [1] = { chance = 100, itemId = 2160, amountMax = 10 } } } } function onUse(cid, item, frompos, item2, topos) local tmpConfig = chest[item.actionid] if not tmpConfig then return true end local container, str = doPlayerAddItem(cid, tmpConfig.container, 1), 'BackPack from '.. tmpConfig.name ..', Your Rewards:\n' for i = 1, #tmpConfig.items do local items = tmpConfig.items[i]items if chance >= math.random(1, 100) then local amountRandom = math.random(1, items.amountMax) str = str .. amountRandom .. ' ' .. getItemNameById(items.itemId) .. ' '..(i ~= #tmpConfig.items and ', ' or '.') doAddContainerItem(tmpConfig.container, items.itemId, amountRandom) else return true end end doSendMagicEffect(getPlayerPosition(cid), math.random(28, 30)) doRemoveItem(item.uid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,'You have found a '.. str) return true end Quanto a tabela ter sido reduzida, você deve fazer o seguinte: Ir no RME e colocar somente aquela action em todas as caixas, e deixar os unique ids em 0 ou não inserir...Colocar somente as actionsIds nos boxes, não uniqueId !
Postado Outubro 18, 2018 6 anos Autor Em 18/10/2018 em 15:06, FlavioHulk disse: local chest = { [8049] = { name = '[Event] BOX', container = 1738, items = { [1] = { chance = 100, itemId = 2160, amountMax = 10 } } } } function onUse(cid, item, frompos, item2, topos) local tmpConfig = chest[item.actionid] if not tmpConfig then return true end local container, str = doPlayerAddItem(cid, tmpConfig.container, 1), 'BackPack from '.. tmpConfig.name ..', Your Rewards:\n' for i = 1, #tmpConfig.items do local items = tmpConfig.items[i]items if chance >= math.random(1, 100) then local amountRandom = math.random(1, items.amountMax) str = str .. amountRandom .. ' ' .. getItemNameById(items.itemId) .. ' '..(i ~= #tmpConfig.items and ', ' or '.') doAddContainerItem(tmpConfig.container, items.itemId, amountRandom) else return true end end doSendMagicEffect(getPlayerPosition(cid), math.random(28, 30)) doRemoveItem(item.uid, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,'You have found a '.. str) return true end Quanto a tabela ter sido reduzida, você deve fazer o seguinte: Ir no RME e colocar somente aquela action em todas as caixas, e deixar os unique ids em 0 ou não inserir...Colocar somente as actionsIds nos boxes, não uniqueId ! Assim que chegar em casa irei testar. Obrigado ## EDIT: Deu esse erro @FlavioHulk [22:37:50.257] [Error - LuaInterface::loadFile] data/actions/scripts/test2.lua:24: '=' expected near 'if' [22:37:50.258] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/test2.lua) [22:37:50.258] data/actions/scripts/test2.lua:24: '=' expected near 'if' Editado Outubro 19, 2018 6 anos por tetheuscunha (veja o histórico de edições) Senhoras e senhores, se alguma resposta lhe ajudou, marque-a como a melhor resposta e de ponto positivo, assim você incentiva quem lhe ajudou a continuar ajudando!!.
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.