Postado Novembro 22, 2015 9 anos Eai glr, preciso de ajuda, estou tentando desenvolver um script que vi em um server e achei interessante! Consiste no seguinte : Checa se o player tem a storage, se ele for morrer e tiver a storage ele fica imune a dano por 5 segundos! ou seja: ele morre ,mas não morre de verdade por 5 segundos. O efeito só acontece uma vez a cada 2 minutos. eu tentei desenvolver uma parte do script mas não ta rolando ,podem me ajudar ? aqui minha parte : function onStatsChange(cid, attacker, type, combat, value) local race = getPlayerStorageValue(cid, 50508) local hp = getCreatureHealth(cid) -- UNDEAD PASSIVE -- if race == 5 then if value >= hp and (type == STATSCHANGE_HEALTHLOSS) then return false else return true end end end Valeu
Postado Novembro 23, 2015 9 anos function onStatsChange(cid, attacker, type, combat, value) local race = getPlayerStorageValue(cid, 50508)local hp = getCreatureHealth(cid) -- UNDEAD PASSIVE -- if race == 5 then if value >= hp and (type == STATSCHANGE_HEALTHLOSS) then return false else return true end end endVermelho : Que tal por ali (cid,9999999) e depois acrescentar doPlayerRemoveHealth(cid,9999999) -- Nem sei se vai funfar essa doPlayerRemoveHealth , testa ai
Postado Novembro 25, 2015 9 anos Autor Em 22/11/2015 22:29:34, PedroSTT disse: function onStatsChange(cid, attacker, type, combat, value) local race = getPlayerStorageValue(cid, 50508)local hp = getCreatureHealth(cid) -- UNDEAD PASSIVE -- if race == 5 then if value >= hp and (type == STATSCHANGE_HEALTHLOSS) then return false else return true end end endVermelho : Que tal por ali (cid,9999999) e depois acrescentar doPlayerRemoveHealth(cid,9999999) -- Nem sei se vai funfar essa doPlayerRemoveHealth , testa ai Na verdade não tem muito sentido oque tu falou brother ... o Local hp é pra pegar a informação da vida atual do player, a vida pra morrer. ali onde diz if value >=(maior ou igual) quer dizer que se o dano for maior ou igual a vida do player( ele morrer) ativa a função imortal, na qual nao sei criar . @edit = oque eu tentei fazer com o return false foi retornar falso todo dano emitido depois disso, anular os danos ,porém o player ja morre Editado Novembro 25, 2015 9 anos por textoy (veja o histórico de edições)
Postado Novembro 25, 2015 9 anos Ai cara não sei se vai funcionar, mas espero q ajude ! e tambem n sei se é isso que você quer... Só quis ajudar ! Formatação se não tiver muito boa desculpe não estou com meu note... Vai em pasta do seu servidor-->data-->creaturescripts-->creaturescriptis.xml E cole este código/tag Citar <event type="login" name="streakLogin" event="script" value="kill streaks/onLogin.lua"/> <event type="kill" name="Kill streak" event="script" value="kill streaks/onKill.lua"/> <event type="combat" name="Immortality" event="script" value="kill streaks/onCombat.lua"/> Feito isso Vai em: Vai em pasta do seu servidor-->data-->creaturescripts Crie uma pasta chamada raias matar.. Ou nome de sua preferencia! Dentro da pasta raias matar. Crie um .lua oncombat ou renomeie de sua preferencia. E cole este script dentro: Citar local immortal = { storageActive = 1006, -- Storage when you are immortal } function onCombat(cid, target) if isPlayer(cid) then if getPlayerStorageValue(target, immortal.storageActive) == 1 then return false else return true end end end Agora vai dentro da pasta raias matar, crie um arquivo .lua (onlogin.lua) e cole este script dentro: Citar local kills = 1000 -- Replenish - Talkaction: !restore local replenish = { storageCanUse = 1002, -- Storage alreadyGiven = 1003, -- storage onCooldown = 1004, -- storage } -- Immortality -- Talkaction: !immortal local immortal = { storageCanUse = 1005, -- Storage storageActive = 1006, -- Storage when you are immortal alreadyGiven = 1007, -- storage onCooldown = 1008, -- storage } -- Stealth - Talkaction: !stealth local stealth = { storageCanUse = 1010, -- storage alreadyGiven = 1011, -- storage onCooldown = 1012, -- storage } -- Sentry gun - Talkaction: !sentry local sentry = { storageCanUse = 1014, -- storage alreadyGiven = 1015, -- storage onCooldown = 1016, -- storage } function onLogin(cid) setPlayerStorageValue(cid, replenish.alreadyGiven, 0) setPlayerStorageValue(cid, immortal.alreadyGiven, 0) setPlayerStorageValue(cid, stealth.alreadyGiven, 0) setPlayerStorageValue(cid, sentry.alreadyGiven, 0) setPlayerStorageValue(cid, replenish.onCooldown, 0) setPlayerStorageValue(cid, immortal.onCooldown, 0) setPlayerStorageValue(cid, stealth.onCooldown, 0) setPlayerStorageValue(cid, sentry.onCooldown, 0) setPlayerStorageValue(cid, replenish.storageCanUse, 0) setPlayerStorageValue(cid, immortal.storageCanUse, 0) setPlayerStorageValue(cid, stealth.storageCanUse, 0) setPlayerStorageValue(cid, sentry.storageCanUse, 0) setPlayerStorageValue(cid, immortal.storageActive, 0) setPlayerStorageValue(cid, kills, 0) if getPlayerStorageValue(cid, kills) < 0 then setPlayerStorageValue(cid, kills, 0) elseif getPlayerStorageValue(cid, deaths) < 0 then setPlayerStorageValue(cid, deaths, 0) end registerCreatureEvent(cid, "Kill streak") registerCreatureEvent(cid, "Immortality") return true end Bom depois de ter feito isto Continue na pasta raias matar e crie um arquivo .lua (onkill.lua) e cole isto dentro: Citar local kills = 1000 -- Replenish - Talkaction: !restore local replenish = { storageCanUse = 1002, -- Storage alreadyGiven = 1003, -- storage onCooldown = 1004, -- storage } -- Immortality -- Talkaction: !immortal local immortal = { storageCanUse = 1005, -- Storage storageActive = 1006, -- Storage when you are immortal alreadyGiven = 1007, -- storage onCooldown = 1008, -- storage } -- Stealth - Talkaction: !stealth local stealth = { storageCanUse = 1010, -- storage alreadyGiven = 1011, -- storage onCooldown = 1012, -- storage } -- Sentry gun - Talkaction: !sentry local sentry = { storageCanUse = 1014, -- storage alreadyGiven = 1015, -- storage onCooldown = 1016, -- storage } function onLogin(cid) setPlayerStorageValue(cid, replenish.alreadyGiven, 0) setPlayerStorageValue(cid, immortal.alreadyGiven, 0) setPlayerStorageValue(cid, stealth.alreadyGiven, 0) setPlayerStorageValue(cid, sentry.alreadyGiven, 0) setPlayerStorageValue(cid, replenish.onCooldown, 0) setPlayerStorageValue(cid, immortal.onCooldown, 0) setPlayerStorageValue(cid, stealth.onCooldown, 0) setPlayerStorageValue(cid, sentry.onCooldown, 0) setPlayerStorageValue(cid, replenish.storageCanUse, 0) setPlayerStorageValue(cid, immortal.storageCanUse, 0) setPlayerStorageValue(cid, stealth.storageCanUse, 0) setPlayerStorageValue(cid, sentry.storageCanUse, 0) setPlayerStorageValue(cid, immortal.storageActive, 0) setPlayerStorageValue(cid, kills, 0) if getPlayerStorageValue(cid, kills) < 0 then setPlayerStorageValue(cid, kills, 0) elseif getPlayerStorageValue(cid, deaths) < 0 then setPlayerStorageValue(cid, deaths, 0) end registerCreatureEvent(cid, "Kill streak") registerCreatureEvent(cid, "Immortality") return true end Bom agora vamos para: Pasta do seu servidor-->data-->globalevents/globalevents.xml e dentro cole este código/tag Citar <globalevent name="immortal" interval="3" event="script" value="immortal.lua"/> O vermelho 3 significa 3 segundos. Assim, todos os três segundo um efeito aparecerá em todos que atualmente é imortal Me acompanhe que ainda tem mais xD Vamos para: Pasta do seu servidor--->data-->globalevents-->scripts e crie um arquivo .lua bom eu criei "immortal.lua" renomeie em sua preferencia! e dentro do arquivo lua emmortal cole isto: Citar local immortal = { useImmortality = true, -- true/false. If true: You can activate immortality, makes you invulnerable against incoming damage for X seconds. useEffect = true, -- true/false. If true: An effect will appear on the player who is immortal. storageActive = 1006, -- Storage when you are immortal effect = CONST_ME_HOLYAREA, -- If immortal.useEffect = true then you will get this effect on a immortal player every 3 seconds. } function onThink(interval, lastExecution, thinkInterval) if immortal.useImmortality then if immortal.useEffect then for _, tid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(tid, immortal.storageActive) == 1 then doSendMagicEffect(getPlayerPosition(tid), immortal.effect) end end end end return true end Salve Agora vamos até pasta do seu servidor-->data-->talkactions-->talkactions.xml e cole esta código/tag Citar <talkaction words="!immortal;!restore;!stealth;!sentry" event="script" value="features.lua"/> bom agora vamos para talkactions-->scripts e crie um arquivo .lua no meu caso criei features.lua e dentro cole isto: Citar local kills = 1000 local channel = 11 -- Replenish - Talkaction: !restore local replenish = { useReplenish = true, -- true/false. If true: Will restore X health and X mana. healthAmount = 500, -- How much health will be restored when used. manaAmount = 400, -- How much mana will be restored when used. cooldown = 40, -- How long you have to wait until you can use it again, in seconds. reqKills = 7, -- How many kills you need to be able to use !restore. storageCanUse = 1002, -- Storage needed to store charges. alreadyGiven = 1003, -- storage onCooldown = 1004, -- storage } -- Immortality -- Talkaction: !immortal local immortal = { useImmortality = true, -- true/false. If true: You can activate immortality, makes you invulnerable against incoming damage for X seconds. reqKills = 10, -- How many kills you need to be able to activate immortality. immortal.time = 25 -- How long you will be immortal, in seconds. time = 25, cooldown = 240, -- How long you must wait until you can make yourself immortal again, in seconds. storageCanUse = 1005, -- Storage for charges. storageActive = 1006, -- Storage when you are immortal onCooldown = 1008 -- storage } -- Stealth - Talkaction: !stealth local stealth = { useStealth = true, -- true/false. If true: Will make you invisible for X seconds. Invisible to EVERYTHING, even players. reqKills = 10, -- How many kills you need to be able to use the invisibility skill. time = 25, -- How long you will be invisible, in seconds. cooldown = 180, -- How long you will have to wait until you can use the invisibility skill again. storageCanUse = 1010, -- storage onCooldown = 1012 -- storage } -- Sentry gun - Talkaction: !sentry local sentry = { useSentryGun = true, -- true/false. If true: Will spawn a Sentry gun at your location, shooting everyone who you target. reqKills = 10, -- How many kills you need to be able to spawn the sentry gun. time = 25, -- How long the sentry gun will be spawned. cooldown = 120, -- How long you will have to wait until you can spawn the sentry gun again. storageCanUse = 1014, -- storage onCooldown = 1016, -- storage sentryName = "Sentry Gun", -- Name of the "monster" that will be spawned as your sentry gun. } function removeStealth(cid) doCreatureExecuteTalkAction(cid, "/ghost", true) setPlayerGroupId(cid, 1) end function stealthCooldown(cid) setPlayerStorageValue(cid, stealth.onCooldown, 0) end function replenishCooldown(cid) setPlayerStorageValue(cid, replenish.onCooldown, 0) end function immortalCooldown(cid) setPlayerStorageValue(cid, immortal.onCooldown, 0) end function removeImmortal(cid) setPlayerStorageValue(cid, immortal.storageActive, 0) end function sentryCooldown(cid) setPlayerStorageValue(cid, sentry.onCooldown, 0) end function removeSentry(cid) local s = getCreatureSummons(cid) for _, summons in ipairs(s) do doRemoveCreature(summons) end end function onSay(cid, words, param, channel) if immortal.useImmortality and words == "!immortal" then for _, tid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(cid, kills) >= immortal.reqKills then if getPlayerStorageValue(cid, immortal.onCooldown) ~= 1 then if getPlayerStorageValue(cid, immortal.storageCanUse) == 1 then addEvent(immortalCooldown, immortal.cooldown * 1000, cid) addEvent(removeImmortal, immortal.time * 1000, cid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You are now immortal!") doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " used " .. (getPlayerSex(cid) == 0 and "her" or "his") .. " immortality!!", TALKTYPE_CHANNEL_O, channel) setPlayerStorageValue(cid, immortal.onCooldown, 1) setPlayerStorageValue(cid, immortal.storageActive, 1) else doPlayerSendCancel(cid, "You can't use this ability yet!") end else doPlayerSendCancel(cid, "You have to wait " .. immortal.cooldown .. " seconds until you can use the immortal ability again!") end else doPlayerSendCancel(cid, "You need " .. immortal.reqKills .. " kills to use the immortal ability.") end end elseif replenish.useReplenish and words == "!restore" then for _, tid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(cid, kills) >= replenish.reqKills then if getPlayerStorageValue(cid, replenish.onCooldown) ~= 1 then if getPlayerStorageValue(cid, replenish.storageCanUse) == 1 then doCreatureAddHealth(cid, replenish.healthAmount) doCreatureAddMana(cid, replenish.manaAmount) doSendMagicEffect(getPlayerPosition(cid), CONST_ME_HEARTS) addEvent(replenishCooldown, replenish.cooldown * 1000, cid) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You used your restore ability!") setPlayerStorageValue(cid, replenish.onCooldown, 1) else doPlayerSendCancel(cid, "You can't use this ability yet!") end else doPlayerSendCancel(cid, "You have to wait " .. replenish.cooldown .. " seconds until you can use the replenish ability again!") end else doPlayerSendCancel(cid, "You need " .. replenish.reqKills .. " kills to use the replenish ability.") end end elseif stealth.useStealth and words == "!stealth" then for _, tid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(cid, kills) >= stealth.reqKills then if getPlayerStorageValue(cid, stealth.onCooldown) ~= 1 then if getPlayerStorageValue(cid, stealth.storageCanUse) == 1 then doCreatureExecuteTalkAction(cid, "/ghost", true) addEvent(stealthCooldown, stealth.cooldown * 1000, cid) addEvent(removeStealth, stealth.time * 1000, cid) setPlayerGroupId(cid, 2) doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " used " .. (getPlayerSex(cid) == 0 and "her" or "his") .. " Stealth ability!!", TALKTYPE_CHANNEL_O, channel) setPlayerStorageValue(cid, stealth.onCooldown, 1) else doPlayerSendCancel(cid, "You can't use this ability yet!") end else doPlayerSendCancel(cid, "You have to wait " .. stealth.cooldown .. " seconds until you can use the stealth ability again!") end else doPlayerSendCancel(cid, "You need " .. stealth.reqKills .. " kills to use the stealth ability.") end end elseif sentry.useSentryGun and words == "!sentry" then for _, tid in ipairs(getPlayersOnline()) do if getPlayerStorageValue(cid, kills) >= sentry.reqKills then if getPlayerStorageValue(cid, sentry.onCooldown) ~= 1 then if getPlayerStorageValue(cid, sentry.storageCanUse) == 1 then addEvent(sentryCooldown, sentry.cooldown * 1000, cid) addEvent(removeSentry, sentry.time * 1000, cid) doSummonMonster(cid, sentry.sentryName) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You spawned your sentry gun!") doPlayerSendChannelMessage(tid, "Streaks", getPlayerName(cid) .. " spawned " .. (getPlayerSex(cid) == 0 and "her" or "his") .. " Sentry gun!!", TALKTYPE_CHANNEL_O, channel) setPlayerStorageValue(cid, sentry.onCooldown, 1) else doPlayerSendCancel(cid, "You can't use this ability yet!") end else doPlayerSendCancel(cid, "You have to wait " .. sentry.cooldown .. " seconds until you can spawn the sentry gun again!") end else doPlayerSendCancel(cid, "You need " .. sentry.reqKills .. " kills to spawn a sentry gun.") end end else doPlayerSendCancel(cid, "This ability have been disabled by the admin.") end end Bom e agora vamos em pasta do seu servidor-->monster Crie uma pasta com nome que desejar eu coloquei como "sentry gun" renomeie para sua preferencia Depois de ter criado a pasta, crie um arquivo lua dentro da pasta sentry gun e coloque um nome de sua preferencia E cole isto dentro do arquivo .lua Citar <?xml version="1.0" encoding="UTF-8"?> <monster name="Sentry gun" nameDescription="a sentry gun" race="undead" experience="0" speed="0" manacost="0"> <health now="1" max="1"/> <look typeex="1560" corpse="1740"/> <targetchange interval="2000" chance="0"/> <strategy attack="100" defense="0"/> <flags> <flag summonable="0"/> <flag attackable="0"/> <flag hostile="1"/> <flag illusionable="0"/> <flag convinceable="0"/> <flag pushable="0"/> <flag canpushitems="0"/> <flag canpushcreatures="1"/> <flag targetdistance="1"/> <flag runonhealth="100"/> <flag hidehealth="0"/> </flags> <attacks> <attack name="melee" interval="2000" skill="1" attack="1"/> <attack name="physical" interval="1000" chance="100" range="7" min="-80" max="-140"> <attribute key="shootEffect" value="throwingstar"/> <attribute key="areaEffect" value="yellowspark"/> </attack> </attacks> <defenses armor="1" defense="1"/> <immunities> <immunity physical="1"/> <immunity energy="1"/> <immunity fire="1"/> <immunity poison="1"/> <immunity ice="1"/> <immunity holy="1"/> <immunity death="1"/> <immunity lifedrain="1"/> <immunity manadrain="1"/> <immunity paralyze="1"/> <immunity drunk="1"/> <immunity outfit="1"/> <immunity invisible="1"/> </immunities> </monster> Bugs conhecidos; * Às vezes, quando você usa a capacidade furtiva, você vai ficar sobre os outros jogadores tela no lugar onde você fez discrição até que os outros jogadores se movem para fora da tela. Isso pode causar debugs. Realmente não posso explicar que bom, mas eu espero que você entenda o que quero dizer! Eu não sei por que o bug do stealth está acontecendo, quando eu faço / fantasma com um GM este erro nunca acontece. * Por favor, reporte todos os bugs que você encontrar Foi testado e funcionou em tfs. 0.3.6 CREDITOS:SERGINOV Editado Novembro 25, 2015 9 anos por lango rullez (veja o histórico de edições)
Postado Novembro 26, 2015 9 anos Autor deve ter dado trabalho pra editar tudo isso, mas era bem simples tua ideia, consegui aproveitar alguma coisa daí. porém no caso o evento deveria ser statschange ou preparedeath, não Oncombat. Tentei usar o Oncombat com o return false porém também não deu. Mas obrigado por tentar ajudar
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.