Postado Fevereiro 18, 2015 10 anos Boa tarde pessoal, sou novo por aqui e não ao certo como montar um tópico bem organizado, mas vamos la. Eu gostaria de uma ajuda para elaborar 2 scripts (utilizo TFS 1.0 num servidor 8.31). Primeiro: -Gostaria que as potions tivessem carga (já pesquisei bastante e infelizmente nenhuma atendeu a minha necessidade ou não possuíram compatibilidade com meu servidor) - O máximo de carga seria algo em torno de 3000 - Ela não some ao acabar as cargas, e que só pudesse utiliza-la com um storage especifico (sendo assim a potion só poderia ser utilizada após concluir uma quest). - Para recarregá-las é necessário um talkaction como por exemplo !carregar ghp, 3000 - O preço para carregar as potions varia de acordo com uma faixa de level ou até mesmo uma fórmula como por exemplo (level/10) seria o preço de cada carga da potion - A health tanto das potion de mana como as de vida variam de acordo com uma % da vida ou mana total, ou seja, quanto maior a vida do personagem, maior o health de vida, e assim sucessivamente. Desde já agradeço, este realmente é o que mais me importa, eu ate encontrei um que se aproximava bastante do que eu precisava porém obtive erros Nessas linhas config.removeOnUse = getBooleanFromString(config.removeOnUse) config.usableOnTarget = getBooleanFromString(config.usableOnTarget) config.splashable = getBooleanFromString(config.splashable) config.realAnimation = getBooleanFromString(config.realAnimation) e Nessa if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end Meu servidor acusa erro no hasCondition e no getBooleanFromString O script que estava tentando utilizar era esse: local config = { removeOnUse = "no", usableOnTarget = "yes", -- can be used on target? (fe. healing friend) splashable = "no", realAnimation = "no", -- make text effect visible only for players in range 1x1 healthMultiplier = 1.0, manaMultiplier = 1.0 } config.removeOnUse = getBooleanFromString(config.removeOnUse) config.usableOnTarget = getBooleanFromString(config.usableOnTarget) config.splashable = getBooleanFromString(config.splashable) config.realAnimation = getBooleanFromString(config.realAnimation) local POTIONS = { [8704] = {empty = 7636, splash = 2, health = {50, 100}, storage = 49990}, -- small health potion [7618] = {empty = 7636, splash = 2, health = {100, 200}, storage = 49989}, -- health potion [7588] = {empty = 7634, splash = 2, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins", storage = 49988}, -- strong health potion [7591] = {empty = 7635, splash = 2, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights", storage = 49987}, -- great health potion [8473] = {empty = 7635, splash = 2, health = {800, 1000}, level = 130, vocations = {4, 8}, vocStr = "knights", storage = 49986}, -- ultimate health potion [7620] = {empty = 7636, splash = 7, mana = {70, 130}, storage = 49985}, -- mana potion [7589] = {empty = 7634, splash = 7, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins", storage = 49984}, -- strong mana potion [7590] = {empty = 7635, splash = 7, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids", storage = 49983}, -- great mana potion [8472] = {empty = 7635, splash = 3, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins", storage = 49982} -- great spirit potion } local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100)) function onUse(cid, item, fromPosition, itemEx, toPosition) local potion = POTIONS[item.itemid] if(not potion) then return false end if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then if(not config.splashable) then return false end if(toPosition.x == CONTAINER_POSITION) then toPosition = getThingPos(item.uid) end doDecayItem(doCreateItem(2016, potion.splash, toPosition)) doTransformItem(item.uid, potion.empty) return true end if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED) return true end if(((potion.level and getPlayerLevel(cid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(cid)))) and not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) then doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_ORANGE_1) return true end if getPlayerStorageValue(cid, potion.storage) > 1 then local health = potion.health if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.healthMultiplier))) then return false end local mana = potion.mana if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.manaMultiplier))) then return false end setPlayerStorageValue(cid, potion.storage, getPlayerStorageValue(cid, potion.storage)-1) doPlayerSendTextMessage(cid, 19, "Haz usado una potion de "..getPlayerStorageValue(cid, potion.storage).." charges.") else doPlayerSendTextMessage(cid, 19, "Se te han acabado las cargas, compra mas diciendo: !charges |type|,|amount|.") return false end doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_MAGIC_BLUE) if(not realAnimation) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1) else for i, tid in ipairs(getSpectators(getCreaturePosition(cid), 1, 1)) do if(isPlayer(tid)) then doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1, false, tid) end end end doAddCondition(cid, exhaust) return true end SEGUNDA Eu utilizo o seguinte código local conf = { maxSlotCount = 5 , ignoredIds ={} } function choose (...) local arg = {...} return arg [ math . random ( 1 , #arg)] end function onUse ( cid , item , fromPosition , itemEx , toPosition ) if item . uid == 0 or item . itemid == 0 then return false end toPosition . stackpos = 255 if isInArray ( conf . ignoredIds , itemEx . itemid ) or ( getItemWeaponType ( itemEx . uid ) == 0 and not isArmor ( itemEx . uid )) or itemEx . itemid == 0 or itemEx . type > 1 or isItemStackable ( itemEx . uid ) then return false end if isCreature ( itemEx . uid ) then return false end local nam = Item ( itemEx . uid ): getAttribute ( ITEM_ATTRIBUTE_DESCRIPTION ) function getper () local n = 1 for i = 1 , 10 do n = n + math . random ( 0 , 10 ) if n < 8 * i then break end end return n end function getSlotCount ( nam ) local c = 0 for _ in nam : gmatch ( '%[(.-)%]' ) do c = c + 1 end return c end local number = math . random ( 0 , 100 ) doPlayerSendTextMessage ( cid , 20 , number ) if number <= 3 then doPlayerSendTextMessage ( cid , 20 , "Your item broke in the proccess." ) doRemoveItem ( item . uid , 1 ) doRemoveItem ( itemEx . uid , 1 ) return false end if number <= 6 then doPlayerSendTextMessage ( cid , 20 , "Fail to gain power." ) doRemoveItem ( item . uid , 1 ) return false end if getSlotCount ( nam ) < conf . maxSlotCount then local l = choose ( 'hp' , 'mp' , 'ml' , 'melee' , 'shield' , 'dist' ) local p = getper () doSendMagicEffect ( toPosition , 30 ) nam = nam .. ' [' .. l .. '.+' .. p .. '%]' doPlayerSendTextMessage ( cid , 20 , l .. '.+' .. p .. '%' ) doSetItemSpecialDescription ( itemEx . uid , nam ) doRemoveItem ( item . uid , 1 ) return false else doPlayerSendTextMessage ( cid , 20 , "Slot limit reached." ) end return true end Eu gostaria que o item regredisse a última ação caso falhasse ou até mesmo um clear geral, exemplo: Eu obtive um update e não era o que esperava, eu poderia criar um outro item que ao usar no item o item voltasse ao normal, como não manjo muito de programação, acredito que um meio seria criar um item que deleta o item no qual foi usado e cria outro igual. exemplo: Tenho uma Magic Sword com um adicional [+hp 1%], um modo de resetar seria utilizar um item em cima da Magic Sword que deleta esta Magic Sword e logo em seguida cria uma outra Magic Sword, assim ela viria zerada. Espero que tenha sido claro o suficiente, muito obrigado. @Edit 23/02.... Com relação ao item para regredir, este não vou mais precisar, já consegui o que queria.config.removeOnUse = getBooleanFromString(config.removeOnUse)config.usableOnTarget = getBooleanFromString(config.usableOnTarget)config.splashable = getBooleanFromString(config.splashable)config.realAnimation = getBooleanFromString(config.realAnimation) Editado Fevereiro 23, 2015 10 anos por nortonsky (veja o histórico de edições)
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.