Ir para conteúdo
  • Cadastre-se

Scripting System 8.60 perder x skill a cada morte


Posts Recomendados

Boa noite, eu gostaria de um sistema para 8.60, que quando o player morresse perdesse exatos 2 de skill de todos atributos menos de pesca, obrigado desde já.

Caso eu tenha colocado o tópico em local errado peço perdão e que mova ao local adequado.

 

Link para o post
Compartilhar em outros sites
  • 3 weeks later...
  • Moderador
Em 27/07/2022 em 18:15, Strikerzerh disse:

Boa noite, eu gostaria de um sistema para 8.60, que quando o player morresse perdesse exatos 2 de skill de todos atributos menos de pesca, obrigado desde já.

Caso eu tenha colocado o tópico em local errado peço perdão e que mova ao local adequado.

 

cria um arquivo em creaturescripts

 

data > creature > scripts > deathSkill.lua

e cola isso dentro

onDeath(cid)
	if not isPlayer(cid) then return true end

    for i=1, 7 do		-- de 1 a 7 = de club até ML
      if i ~= 6 then  --se for diferente de 6 (6 é fishing)
        if getPlayerSkill(cid, i) > 12 then				-- se for maior que 12 (só cai até 10, pra proteção de bug)
          doPlayerAddSkill(pid, i, -2, true)
        end
      end
    end

return true
end

 

 

ai vai no creaturescripts.xml

 

data > creature > creaturescripts.xml

<event type="death" name="deathSkill" event="script" value="deathSkill.lua"/>


e registra no login.lua

procura por "registerCreatureEvent"
e adiciona abaixo de qualquer um deles isso:

 registerCreatureEvent(cid, "deathSkill")

 

Link para o post
Compartilhar em outros sites
Em 15/08/2022 em 18:52, Strikerzerh disse:

deu erro image.thumb.png.2efa1cde59a4281fa007bc5ecc8aaac9.png

Eu quero que perca first também  se possivel

Mais por enquanto n funcionou ta dando esse erro ai

function onDeath(cid)
    if not isPlayer(cid) then return true end

        for i=1, 7 do        -- de 1 a 7 = de club até ML
          if i ~= 6 then  --se for diferente de 6 (6 é fishing)
            if getPlayerSkill(cid, i) > 12 then                -- se for maior que 12 (só cai até 10, pra proteção de bug)
              doPlayerAddSkill(pid, i, -2, true)
            end
          end
        end
    end

return true
end

coloca la agora, ele esqueceu uma linha ai

Link para o post
Compartilhar em outros sites

nao consegui postar em spoiler, perdao

 

 

-- The Forgotten Server Config

    -- Account manager
    accountManager = true
    namelockManager = false
    newPlayerChooseVoc = true
    newPlayerSpawnPosX = 543
    newPlayerSpawnPosY = 521
    newPlayerSpawnPosZ = 7
    newPlayerTownId = 1
    newPlayerLevel = 8
    newPlayerMagicLevel = 0
    generateAccountNumber = false

    -- Unjustified kills
    -- NOTE: *Banishment and *BlackSkull variables are >summed up<
    -- (dailyFragsToRedSkull + dailyFragsToBanishment) with their
    -- *RedSkull equivalents.
    -- Auto banishing works only if useBlackSkull set to negative.
    -- advancedFragList is not advised if you use huge frags
    -- requirements.
    redSkullLength = 2 * 24 * 60 * 60
    blackSkullLength = 4 * 24 * 60 * 60
    dailyFragsToRedSkull = 15
    weeklyFragsToRedSkull = 30
    monthlyFragsToRedSkull = 45
    dailyFragsToBlackSkull = 25
    weeklyFragsToBlackSkull = 45
    monthlyFragsToBlackSkull = 60
    dailyFragsToBanishment = dailyFragsToRedSkull
    weeklyFragsToBanishment = weeklyFragsToRedSkull
    monthlyFragsToBanishment = monthlyFragsToRedSkull
    blackSkulledDeathHealth = 40
    blackSkulledDeathMana = 0
    useBlackSkull = true
    useFragHandler = true
    advancedFragList = false

    -- Banishments
    -- violationNameReportActionType 1 = just a report, 2 = name lock, 3 = player banishment
    -- killsBanLength works only if useBlackSkull option is disabled.
    notationsToBan = 3
    warningsToFinalBan = 4
    warningsToDeletion = 5
    banLength = 1 * 24 * 60 * 60
    killsBanLength = 1 * 24 * 60 * 60
    finalBanLength = 1 * 24 * 60 * 60
    ipBanishmentLength = 1 * 24 * 60 * 60
    broadcastBanishments = true
    maxViolationCommentSize = 200
    violationNameReportActionType = 2
    autoBanishUnknownBytes = false

    -- Battle
    -- NOTE: showHealingDamageForMonsters inheritates from showHealingDamage.
    -- loginProtectionPeriod is the famous Tibia anti-magebomb system.
    -- deathLostPercent set to nil enables manual mode.
    worldType = "pvp"
    protectionLevel = 100
    pvpTileIgnoreLevelAndVocationProtection = true
    pzLocked = 60 * 400
    huntingDuration = 30 * 1000
    criticalHitChance = 7
    criticalHitMultiplier = 1
    displayCriticalHitNotify = true
    removeWeaponAmmunition = false
    removeWeaponCharges = false
    removeRuneCharges = true
    whiteSkullTime = 10 * 60 * 1000
    noDamageToSameLookfeet = false
    showHealingDamage = true
    showHealingDamageForMonsters = true
    fieldOwnershipDuration = 5 * 1000
    stopAttackingAtExit = false
    oldConditionAccuracy = false
    loginProtectionPeriod = 10 * 1000
    deathLostPercent = 20
    stairhopDelay = 15 * 60
    pushCreatureDelay = 15 * 60
    deathContainerId = 1987
    gainExperienceColor = 215
    addManaSpentInPvPZone = true
    squareColor = 0
    allowFightback = true

    -- Connection config
    worldId = 0
    ip = "133.32.118.982"
    bindOnlyConfiguredIpAddress = false
    loginPort = 7171
    gamePort = 7172
    adminPort = 7171
    statusPort = 7171
    loginTries = 10
    retryTimeout = 5 * 1000
    loginTimeout = 60 * 1000
    maxPlayers = 500
    motd = "Bem vindos Ao colow
    displayOnOrOffAtCharlist = false
    onePlayerOnlinePerAccount = false
    allowClones = false
    serverName = "colow"
    loginMessage = "Seja bem vindo."
    statusTimeout = 5 * 60 * 1000
    replaceKickOnLogin = true
    forceSlowConnectionsToDisconnect = false
    loginOnlyWithLoginServer = false
    premiumPlayerSkipWaitList = false

    -- Database
    -- NOTE: sqlFile is used only by sqlite database, and sqlKeepAlive by mysql database.
    -- To disable sqlKeepAlive such as mysqlReadTimeout use 0 value.
    sqlType = "sqlite"
    sqlHost = "localhost"
    sqlPort = 3306
    sqlUser = "root"
    sqlPass = ""
    sqlDatabase = "theforgottenserver"
    sqlFile = "Styller.s3db"
    sqlKeepAlive = 0
    mysqlReadTimeout = 10
    mysqlWriteTimeout = 10
    encryptionType = "plain"

    -- Deathlist
    deathListEnabled = true
    deathListRequiredTime = 1 * 60 * 1000
    deathAssistCount = 0
    maxDeathRecords = 5

    -- Guilds
    ingameGuildManagement = true
    levelToFormGuild = 250
    premiumDaysToFormGuild = 0
    guildNameMinLength = 5
    guildNameMaxLength = 30

    -- Highscores
    highscoreDisplayPlayers = 10
    updateHighscoresAfterMinutes = 3

    -- Houses
    buyableAndSellableHouses = true
    houseNeedPremium = false
    bedsRequirePremium = false
    levelToBuyHouse = 100
    housesPerAccount = 0
    houseRentAsPrice = false
    housePriceAsRent = false
    housePriceEachSquare = 40000
    houseRentPeriod = "never"
    houseCleanOld = 0
    guildHalls = false

    -- Item usage
    timeBetweenActions = 200
    timeBetweenExActions = 1000
    checkCorpseOwner = true
    hotkeyAimbotEnabled = true
    maximumDoorLevel = 500

    -- Map
    -- NOTE: storeTrash costs more memory, but will perform alot faster cleaning.
    -- useHouseDataStorage usage may be found at README.
    mapName = "Soulface"
    mapAuthor = "Will"
    randomizeTiles = true
    useHouseDataStorage = false
    storeTrash = true
    cleanProtectedZones = true
    mailboxDisabledTowns = "-1"

    -- Startup
    -- NOTE: defaultPriority works only on Windows and niceLevel on *nix
    -- coresUsed are seperated by comma cores ids used by server process,
    -- default is -1, so it stays untouched (automaticaly assigned by OS).
    defaultPriority = "high"
    niceLevel = 5
    coresUsed = "-1"
    optimizeDatabaseAtStartup = true
    removePremiumOnInit = true
    confirmOutdatedVersion = false

    -- Muted buffer
    maxMessageBuffer = 4
    bufferMutedOnSpellFailure = false

    -- Miscellaneous
    -- NOTE: promptExceptionTracerErrorBox works only with precompiled support feature,
    -- called "exception tracer" (__EXCEPTION_TRACER__ flag).
    -- monsterLootMessage 0 to disable, 1 - only party, 2 - only player, 3 - party or player (like Tibia's)
    dataDirectory = "data/"
    allowChangeOutfit = true
    allowChangeColors = true
    allowChangeAddons = true
    disableOutfitsForPrivilegedPlayers = false
    bankSystem = true
    saveGlobalStorage = true
    displaySkillLevelOnAdvance = false
    spellNameInsteadOfWords = false
    emoteSpells = true
    promptExceptionTracerErrorBox = true
    storePlayerDirection = false
    monsterLootMessage = 3
    monsterLootMessageType = 25
    separateViplistPerCharacter = false

    -- Ghost mode
    ghostModeInvisibleEffect = true
    ghostModeSpellEffects = true

    -- Limits
    idleWarningTime = 59 * 60 * 1000
    idleKickTime = 60 * 60 * 1000
    expireReportsAfterReads = 1
    playerQueryDeepness = 2
    maxItemsPerPZTile = 0
    maxItemsPerHouseTile = 0

    -- Premium-related
    freePremium = false
    premiumForPromotion = false

    -- Blessings
    -- NOTE: blessingReduction* regards items/containers loss.
    -- eachBlessReduction is how much each bless reduces the experience/magic/skills loss.
    blessingOnlyPremium = true
    blessingReductionBase = 30
    blessingReductionDecreament = 5
    eachBlessReduction = 8

    -- Rates
    -- NOTE: experienceStages configuration is located in data/XML/stages.xml.
    -- rateExperienceFromPlayers 0 to disable.
    experienceStages = true
    rateExperience = 25
    rateSkill = 250
    rateMagic = 100
    rateLoot = 3
    rateSpawn = 5

    -- Monster rates
    rateMonsterHealth = 1.0
    rateMonsterMana = 1.0
    rateMonsterAttack = 1.0
    rateMonsterDefense = 1.0

    -- Experience from players
    -- NOTE: min~Threshold* set to 0 will disable the minimum threshold:
    -- player will gain experience from every lower leveled player.
    -- max~Threshold* set to 0 will disable the maximum threshold:
    -- player will gain experience from every higher leveled player.
    minLevelThresholdForKilledPlayer = 0.9
    maxLevelThresholdForKilledPlayer = 1.1

    -- Stamina
    -- NOTE: Stamina is stored in miliseconds, so seconds are multiplied by 1000.
    -- rateStaminaHits multiplies every hit done a creature, which are later
    -- multiplied by player attack speed.
    -- rateStaminaGain is divider of every logged out second, eg:
    -- 60000 / 3 = 20000 milliseconds, what gives 20 stamina seconds for 1 minute being logged off.
    -- rateStaminaThresholdGain is divider for the premium stamina.
    -- staminaRatingLimit* is in minutes.
    rateStaminaLoss = 0
    rateStaminaGain = 3
    rateStaminaThresholdGain = 12
    staminaRatingLimitTop = 41 * 60
    staminaRatingLimitBottom = 14 * 60
    rateStaminaAboveNormal = 1.5
    rateStaminaUnderNormal = 0.5
    staminaThresholdOnlyPremium = true

    -- Party
    -- NOTE: experienceShareLevelDifference is float number.
    -- experienceShareLevelDifference is highestLevel * value
        experienceShareRadiusX = 30 -- máxima distancia em X pra eles continuarem compartilhando exp
        experienceShareRadiusY = 30 -- máxima distancia em Y pra eles continuarem compartilhando exp
        experienceShareRadiusZ = 1 -- máxima distancia em Z pra eles continuarem compartilhando exp
        experienceShareLevelDifference = 1/ 3 -- diferença de nivel máxima pra eles continuarem compartilhando exp (level do mais alto multiplicado por esse valor tem que ser menor que o nível do player de level mais baixo)
        extraPartyExperienceLimit = 770 --- limite de experiencia extra
        extraPartyExperiencePercent = 200 -- porcentagem extra de experiencia por estar em party
        experienceShareActivity = 2 * 60 * 1000 --- não sei ao certo mas é ou o tempo pra poder ligar o compartilhamento de experiencia ou o tempo máximo q a exp vai ser compartilhada (sugiro não mexer)


    -- Global save
    -- NOTE: globalSaveHour means like 03:00, not that it will save every 3 hours,
    -- if you want such a system please check out data/globalevents/globalevents.xml.
    globalSaveEnabled = false
    globalSaveHour = 3
    shutdownAtGlobalSave = false
    cleanMapAtGlobalSave = false

    -- Spawns
    deSpawnRange = 2
    deSpawnRadius = 50

        healthHealingColor = 194
        manaHealingColor = 113

    -- Summons
    maxPlayerSummons = 2
    teleportAllSummons = false
    teleportPlayerSummons = false

    -- Status
    ownerName = "Conow"
    ownerEmail = ""
    url = ""
    location = "Brazil"
    displayGamemastersWithOnlineCommand = false

    -- Logs
    -- NOTE: This kind of logging does not work in GUI version.
    -- For such, please compile the software with __GUI_LOGS__ flag.
    adminLogsEnabled = false
    displayPlayersLogging = true
    prefixChannelLogs = ""
    runFile = ""
    outLogName = ""
    errorLogName = ""
    truncateLogsOnStartup = false

 

 

LOGIN.LUA

 

local config = {
    loginMessage = getConfigValue('loginMessage'),
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
    local loss = getConfigValue('deathLostPercent')
    if(loss ~= nil) then
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
    end

    local accountManager = getPlayerAccountManager(cid)
    if(accountManager == MANAGER_NONE) then
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
        if(lastLogin > 0) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
        else
            str = str .. " Please choose your outfit."
            doPlayerSendOutfitWindow(cid)
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
    elseif(accountManager == MANAGER_NAMELOCK) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
    elseif(accountManager == MANAGER_ACCOUNT) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
    end

    if(not isPlayerGhost(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    end

    registerCreatureEvent(cid, "Mail")

    registerCreatureEvent(cid, "ResetDoors")

    registerCreatureEvent(cid, "Idle")
    if(config.useFragHandler) then
        registerCreatureEvent(cid, "SkullCheck")
        registerCreatureEvent(cid, "Reward")
    end

    registerCreatureEvent(cid, "ReportBug")
    registerCreatureEvent(cid, "AdvanceSave")

registerCreatureEvent(cid, "advance")
registerCreatureEvent(cid, "SkullCheck")
    registerCreatureEvent(cid, "ReportBug")

registerCreatureEvent(cid, "lookreset")
registerCreatureEvent(cid, "deathSkill")
registerCreatureEvent(cid, "BossCorpse")
registerCreatureEvent(cid, "DeathC")
registerCreatureEvent(cid, "FimVip")
registerCreatureEvent(cid, "VipReceive")
registerCreatureEvent(cid, "PlayerKill")
    if (InitArenaScript ~= 0) then
    InitArenaScript = 1
    -- make arena rooms free
        for i = 42300, 42309 do
            setGlobalStorageValue(i, 0)
            setGlobalStorageValue(i+100, 0)
        end
    end
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena  
return true
end

 


 

Link para o post
Compartilhar em outros sites

achei o erro na sua base, em config procure por: 

  deathLostPercent = 20

e troque para:

  deathLostPercent = 10

 

Link para o post
Compartilhar em outros sites
  • Moderador
function onDeath(cid)
    if not isPlayer(cid) then return true end

        for i=1, 7 do        -- de 1 a 7 = de club até ML
          if i ~= 6 then  --se for diferente de 6 (6 é fishing)
            if getPlayerSkill(cid, i) > 12 then                -- se for maior que 12 (só cai até 10, pra proteção de bug)
              doPlayerAddSkill(cid, i, -2, true)
            end
          end
        end

return true
end


coloca assim da reload ou reabre o teu OT, e ve se funciona.

Link para o post
Compartilhar em outros sites
  • Moderador
2 horas atrás, Strikerzerh disse:

image.thumb.png.1430d0b9da56051ee9b601c4caa1f8fa.png

 

tenta assim:

 

function onDeath(cid)
    if not isPlayer(cid) then return true end

        for i=1, 7 do        -- de 1 a 7 = de club até ML
          if i ~= 6 then  --se for diferente de 6 (6 é fishing)
      		local skills = getPlayerSkill(cid, i)
            if skills >= 12 then                -- se for maior que 12 (só cai até 10, pra proteção de bug)
              doPlayerAddSkill(cid, i, -2, true)
            end
          end
        end

return true
end

 

Link para o post
Compartilhar em outros sites

Bom vamos lá ... 

 

if not isPlayer(cid) then return true end

Não acho que precise dessa verificação, pois a função onDeath deve ser registrada no jogador, ou seja, apenas jogadores terão ela.

No const.h consta esses skills e valores .. 

SKILL_FIST = 1
SKILL_CLUB = 2
SKILL_SWORD = 3
SKILL_AXE = 4
SKILL_DIST = 5
SKILL_SHIELD = 6
SKILL_FISH = 7
SKILL__MAGLEVEL = 8


Esssa função é praticamente igual ao que o FeeTads mandou ... 

 

function onDeath(cid)
	for skill_id = SKILL_FIST, SKILL__MAGLEVEL do
		if skill_id ~= SKILL_FISH then
			local skill_atual = getPlayerSkillLevel(cid, skill_id) and getPlayerSkillLevel(cid, skill_id) or false
			if skill_atual and skill_atual > 12 then
				doPlayerAddSkillTry(cid, skill_id, getPlayerRequiredSkillTries(cid, skill_id, getPlayerSkillLevel(cid, skill_id) - 2) - getPlayerSkillTries(cid, skill_id), false)
			end
		end
	end

	return true
end

 

O erro diz que você não pode comparar um número com um booleano, porem a função getPlayerSkillLevel() deve retornar um e quando comparado, no caso, ao 12, deveria funcionar ... 

Você esta registrando o event no arquivo login.lua? 

registerCreatureEvent(cid, "Nome do evento onDeath que você colocou no XML")



 

Editado por luanluciano93 (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por cloudrun2023
      CloudRun - Sua Melhor Escolha para Hospedagem de OTServer!
      Você está procurando a solução definitiva para hospedar seu OTServer com desempenho imbatível e segurança inigualável? Não procure mais! Apresentamos a CloudRun, sua parceira confiável em serviços de hospedagem na nuvem.
       
      Recursos Exclusivos - Proteção DDoS Avançada:
      Mantenha seu OTServer online e seguro com nossa robusta proteção DDoS, garantindo uma experiência de jogo ininterrupta para seus jogadores.
       
      Servidores Ryzen 7 Poderosos: Desfrute do poder de processamento superior dos servidores Ryzen 7 para garantir um desempenho excepcional do seu OTServer. Velocidade e estabilidade garantidas!
       
      Armazenamento NVMe de Alta Velocidade:
      Reduza o tempo de carregamento do jogo com nosso armazenamento NVMe ultrarrápido. Seus jogadores vão adorar a rapidez com que podem explorar o mundo do seu OTServer.
       
      Uplink de até 1GB:
      Oferecemos uma conexão de alta velocidade com até 1GB de largura de banda, garantindo uma experiência de jogo suave e livre de lag para todos os seus jogadores, mesmo nos momentos de pico.
       
      Suporte 24 Horas:
      Estamos sempre aqui para você! Nossa equipe de suporte está disponível 24 horas por dia, 7 dias por semana, para resolver qualquer problema ou responder a qualquer pergunta que você possa ter. Sua satisfação é a nossa prioridade.
       
      Fácil e Rápido de Começar:
      Configurar seu OTServer na CloudRun é simples e rápido. Concentre-se no desenvolvimento do seu jogo enquanto cuidamos da hospedagem.
       
      Entre em Contato Agora!
      Website: https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
      Email: [email protected]
      Telefone: (47) 99902-5147

      Não comprometa a qualidade da hospedagem do seu OTServer. Escolha a CloudRun e ofereça aos seus jogadores a melhor experiência de jogo possível. Visite nosso site hoje mesmo para conhecer nossos planos e começar!
       
      https://central.cloudrun.com.br/index.php?rp=/store/cloud-ryzen-brasil
       
      CloudRun - Onde a Velocidade Encontra a Confiabilidade!
       

    • Por FeeTads
      SALVE rapaziada do TK, esses dias vim pensando em novos scripts pro meu OT, e em um deles eu precisava que determinada area não contasse frag pro player que matasse outros, PORÉM eu precisava que os players que morressem nessa area ainda assim tivessem as penalidades da sua morte, procurei por ai, achei alguns scripts que apenas tiravam o SKULL e não realmente o FRAG do player.

      **script atualizado 22/10/2023** - melhorado e otimizado, levei o script pra puxar as infos por .lua / creatureScripts

      vou disponibilizar o code aqui, e o que fazer pra determinada area não contar frag.

      SOURCE OTX 2 / TFS 0.x, Funciona em TFS 1.x mudando as tags e ajeitando as sintaxes.

      vá em creatureevent.cpp

      procure por:
      else if(type == "preparedeath") _type = CREATURE_EVENT_PREPAREDEATH;
      Adiciona abaixo:
      else if(type == "nocountfrag") _type = CREATURE_EVENT_NOCOUNTFRAG;

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "onPrepareDeath";  
      Adicione abaixo: 
      case CREATURE_EVENT_NOCOUNTFRAG: return "noCountFragArea";

      procure por:
      case CREATURE_EVENT_PREPAREDEATH: return "cid, deathList";
      Adicione abaixo:
      case CREATURE_EVENT_NOCOUNTFRAG: return "cid, target";

      agora no mesmo arquivo, vá até o final do arquivo e adicione essa função:
      uint32_t CreatureEvent::executeNoCountFragArea(Creature* creature, Creature* target) { //noCountFragArea(cid, target) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(creature->getPosition()); std::ostringstream scriptstream; scriptstream << "local cid = " << env->addThing(creature) << std::endl; scriptstream << "local target = " << env->addThing(target) << std::endl; if(m_scriptData) scriptstream << *m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ std::ostringstream desc; desc << creature->getName(); env->setEvent(desc.str()); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(creature->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(creature)); lua_pushnumber(L, env->addThing(target)); bool result = m_interface->callFunction(2); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::noCountFragArea] Call stack overflow." << std::endl; return 0; } }

      agora vá em creatureevent.h

      procure por:
      CREATURE_EVENT_PREPAREDEATH
      adicione abaixo:
      CREATURE_EVENT_NOCOUNTFRAG

      procure por:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList);
      Adicione abaixo:
      uint32_t executeNoCountFragArea(Creature* creature, Creature* target);

      agora vá em player.cpp

      procure por:
      bool Player::onKilledCreature(Creature* target, DeathEntry& entry)
      abaixo de:
      War_t enemy; if(targetPlayer->getEnemy(this, enemy)) { if(entry.isLast()) IOGuild::getInstance()->updateWar(enemy); entry.setWar(enemy); }
      Adicione o seguinte código:
      if (targetPlayer){ CreatureEventList killEvents = getCreatureEvents(CREATURE_EVENT_NOCOUNTFRAG); for (const auto &event : killEvents) { if (!event->executeNoCountFragArea(this, target)) { return true; } } }

      //

      Feito isso, tudo completo na sua source, agora é necessário adicionar o creaturescript dentro do servidor

      vá até creaturescripts/scripts
      crie um arquivo chamado, "noCountFragInArea.lua"
      e dentro dele cole o código:
       
      --[[ script feito por feetads / TibiaKing ]]-- --[[ discord: feetads / FeeTads#0246 ]]-- -- Add positions here for which you do not want to count frags local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, -- from = area superior esquerda / to = area inferior direita (formando um quadrado) } local onlyKillerInArea = false -- only killer need to be in area? function noCountFragArea(cid, target) if not isCreature(cid) or not isCreature(target) then return true end local posKiller = getPlayerPosition(cid) local posTarget = getPlayerPosition(target) for i = 1, #areas do local area = areas[i] if isInArea(posKiller, area.from, area.to) then if onlyKillerInArea then return false elseif isInArea(posTarget, area.from, area.to) then return false end end end return true end
      agora em creaturescripts.xml
      <event type="nocountfrag" name="fragarea" event="script" value="noCountFragInArea.lua"/>
      agora em creaturescripts/scripts/login.lua
       procure por OU semelhante a esse:
      registerCreatureEvent(cid, "AdvanceSave")
      e abaixo adicione:
      registerCreatureEvent(cid, "fragarea")

      //


      Agora tudo certo, quando quiser adiciona uma area que não pega frag, vá até o script e apenas coloque a area, igual o demonstrado no script

      Exemplo:
      local areas = { [1] = {from = {x = 91, y = 122, z = 7}, to = {x = 98, y = 127, z = 7}}, [2] = {from = {x = 1000, y = 1000, z = 7}, to = {x = 1100, y = 1100, z = 7}}, }
      assim somente colocando a area no script e abrindo o server ou dando /reload, já funcionará a area como não pegar frag.
      Esse sistema pode ser bom pra areas de pvp ativo, onde você ainda quer que o player que morrer perca os atributos, como se fosse uma morte normal, porém não conta frag pra quem matar.
      Bom pra sistemas tipo castle 48h (guild war), onde há diversas mortes e risco de pegar red, atrapalhando a war.

      Façam bom proveito dos scripts, e deixem os créditos no script rsrs

      **Eu fiz as alterações e o simples código por isso vim disponibilizar, créditos meus**
    • Por Muvuka
      Abri canal a força creaturescript acho que funcione no creaturescript cria script creaturescript
       
      <channel id="9" name="HELP" logged="yes"/>
      <channel id="12" name="Report Bugs" logged="yes"/>
      <channel id="13" name="Loot" logged="yes"/>
      <channel id="14" name="Report Character Rules Tibia Rules" logged="yes"/>
      <channel id="15" name="Death Channel"/>
      <channel id="6548" name="DexSoft" level="1"/>
      <channel id="7" name="Reports" logged="yes"/>
       
      antes de 
              if(lastLogin > 0) then adicione isso:
                      doPlayerOpenChannel(cid, CHANNEL_HELP) doPlayerOpenChannel(cid, 1,  2, 3) = 1,2 ,3 Channels, entendeu? NÃO FUNCIONA EU QUERO UM MEIO DE ABRI SEM USA A SOURCE
       
      EU NÃO CONSEGUI ABRI EU NÃO TENHO SOURCE
       
       
    • Por bolachapancao
      Rapaziada seguinte preciso de um script que ao utilizar uma alavanca para até 4 jogadores.
      Os jogadores serão teleportados para hunt durante uma hora e depois de uma hora os jogadores serão teleportados de volta para o templo.
       
      Observação: caso o jogador morra ou saia da hunt o evento hunt é cancelado.

      Estou a base canary
      GitHub - opentibiabr/canary: Canary Server 13.x for OpenTibia community.
       
    • Por RAJADAO
      .Qual servidor ou website você utiliza como base? 
      Sabrehaven 8.0
      Qual o motivo deste tópico? 
      Ajuda com novos efeitos
       
      Olá amigos, gostaria de ajuda para introduzir os seguintes efeitos no meu servidor (usando o Sabrehaven 8.0 como base), adicionei algumas runas novas (avalanche, icicle, míssil sagrado, stoneshower & Thunderstorm) e alguns novos feitiços (exevo mas san, exori san, exori tera, exori frigo, exevo gran mas frigo, exevo gran mas tera, exevo tera hur, exevo frigo hur) mas nenhum dos efeitos dessas magias parece existir no servidor, alguém tem um link para um tutorial ou algo assim para que eu possa fazer isso funcionar?
      Desculpe pelo mau inglês, sou brasileiro.

      Obrigado!


      AVALANCHE RUNE id:3161 \/
      (COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_ICEAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ICE)

      STONESHOWER RUNE id:3175 \/
      (COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_STONES)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH)

      THUNDERSTORM RUNE id:3202 \/
      (COMBAT_PARAM_TYPE, COMBAT_ENERGYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_E NERGYHIT)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGYBALL)

      ICICLE RUNE id:3158 \/
      COMBAT_ICEDAMAGE
      CONST_ME_ICEAREA
      CONST_ANI_ICE

      SANTO MÍSSIL RUNA id:3182 \/
      (COMBAT_PARAM_TYPE, COMBAT_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYDAMAGE)
      (COMBAT_PARAM_EFFECT, CONST_ME_HOLYAREA)
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_HOLY)

      CONST_ME_PLANTATTACK (exevo gran mas tera)
      CONST_ME_ICETORNADO (exevo gran mas frigo)
      CONST_ME_SMALLPLANTS (exevo tera hur)
      CONST_ME_ICEAREA (exevo frigo hur)
      CONST_ME_ICEATTACK (exori frigo)
      CONST_ME_CARNIPHILA (exori tera)

      EXORI SAN \/
      (COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SMALLHOLY)
      CONST_ME_HOLYDAM IDADE

      EXEVO MAS SAN \/
      CONST_ME_HOLYAREA
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo