• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Drunk Rune, Nekiro 1.5 downgrade 8.6

PB3LL

Member
Joined
Oct 30, 2015
Messages
78
Reaction score
13
hello,
found a few old scripts for a drunk rune that lasts 3-5 seconds… but no luck getting it going with 1.5 nekiro 8.6. anyone could help? coffee on me
Post automatically merged:

LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_CRAPS)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
local condition = createConditionObject(CONDITION_DRUNK)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setCombatCondition(combat, condition)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if not hasCondition(cid, CONDITION_EXHAUST) then
            local target = getCreatureTarget(cid)
            if target ~= 0 then
                doAddCondition(cid, exhaust)
                doCombat(cid, combat, numberToVariant(target))
                doRemoveItem(item.uid, 1)
            else
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUCANONLYUSEITONCREATURES)
            end
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
    return true
end
 
local action = Action()

local exhaustTime = 5000
local drunkTime = math.random(3000, 5000)

local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CRAPS)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)

if player:hasCondition(CONDITION_EXHAUST) then
player:sendCancelMessage("You are exhausted.")
return true
end

if not target or not target:isCreature() then
player:sendCancelMessage("You can only use this on creatures.")
return true
end

local exhaust = Condition(CONDITION_EXHAUST)
exhaust:setParameter(CONDITION_PARAM_TICKS, exhaustTime)
player:addCondition(exhaust)

combat:execute(player, Variant(target))

local drunk = Condition(CONDITION_DRUNK)
drunk:setParameter(CONDITION_PARAM_TICKS, drunkTime)
target:addCondition(drunk)

item:remove(1)
return true
end

action:id(xx) -- item id<--
action:register()

i tested it on 8.6 nekiro but its not optimized or anything just working so you know check everything closely :) now maybe people can spam it etc so ppl get drunk 2x idk ^^ check it but it make ppl drunk
 
Last edited:
You need to learn how to convert old scripts to the correct TFS 1.x syntax.

You can use AI to help with the conversion, but you still need to know where to check the correct functions. Usually, you can find them in the source, mainly in src/luascript.cpp, or also in data/lib/compat.lua.

A good example to study compatibility is this file:

TFS-1.5-Downgrades/data/lib/compat/compat.lua at 8.60 · nekiro/TFS-1.5-Downgrades (https://github.com/nekiro/TFS-1.5-Downgrades/blob/8.60/data/lib/compat/compat.lua)

The idea is to check the old functions, understand how they worked, and replace them with the correct TFS 1.x functions.

I made it in two ways for you to choose from: common script with actions.xml, or RevScript.

Option 1 — actions.xml + drunk.lua

actions.xml:

XML:
<action itemid="YOUR_ITEM_ID_HERE" script="drunk.lua" allowfaruse="1" />
drunk.lua:
LUA:
local config = {
    minLevel = 1,
    minMagicLevel = 0,
    minTicks = 3000,
    maxTicks = 5000,
    effectSelf = CONST_ME_MAGIC_BLUE,
    effectTarget = CONST_ME_MAGIC_GREEN,
    allowPvP = true,
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() < config.minLevel then
        player:sendCancelMessage("You need level " .. config.minLevel .. " to use this rune.")
        return false
    end

    if player:getMagicLevel() < config.minMagicLevel then
        player:sendCancelMessage("You need magic level " .. config.minMagicLevel .. " to use this rune.")
        return false
    end

    local creature = Creature(target.uid)
    if not creature then
        player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    if creature == player then
        player:sendCancelMessage("You cannot use this rune on yourself.")
        return false
    end

    if creature:isPlayer() and not config.allowPvP then
        player:sendCancelMessage("You cannot use this rune on other players.")
        return false
    end

    local ticks = math.random(config.minTicks, config.maxTicks)

    local condition = Condition(CONDITION_DRUNK)
    condition:setParameter(CONDITION_PARAM_TICKS, ticks)
    creature:addCondition(condition)

    fromPosition:sendMagicEffect(config.effectSelf)
    toPosition:sendMagicEffect(config.effectTarget)

    item:remove(1)
    return true
end

Option 2 — RevScript

Place it inside data/scripts/ or any subfolder you prefer:

LUA:
local config = {
    itemId        = YOUR_ITEM_ID_HERE,
    minLevel      = 1,
    minMagicLevel = 0,
    minTicks      = 3000,
    maxTicks      = 5000,
    effectSelf    = CONST_ME_MAGIC_BLUE,
    effectTarget  = CONST_ME_MAGIC_GREEN,
    allowPvP      = true,
}

local drunkRune = Action()
function drunkRune.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() < config.minLevel then
        player:sendCancelMessage("You need level " .. config.minLevel .. " to use this rune.")
        return false
    end

    if player:getMagicLevel() < config.minMagicLevel then
        player:sendCancelMessage("You need magic level " .. config.minMagicLevel .. " to use this rune.")
        return false
    end

    local creature = Creature(target.uid)
    if not creature then
        player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end

    if creature == player then
        player:sendCancelMessage("You cannot use this rune on yourself.")
        return false
    end

    if creature:isPlayer() and not config.allowPvP then
        player:sendCancelMessage("You cannot use this rune on other players.")
        return false
    end

    local ticks = math.random(config.minTicks, config.maxTicks)

    local condition = Condition(CONDITION_DRUNK)
    condition:setParameter(CONDITION_PARAM_TICKS, ticks)
    creature:addCondition(condition)

    fromPosition:sendMagicEffect(config.effectSelf)
    toPosition:sendMagicEffect(config.effectTarget)

    item:remove(1)
    return true
end
drunkRune:id(config.itemId)
drunkRune:allowFarUse(true)
drunkRune:register()

 
Last edited:
hello,
found a few old scripts for a drunk rune that lasts 3-5 seconds… but no luck getting it going with 1.5 nekiro 8.6. anyone could help? coffee on me
Post automatically merged:

LUA:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
 
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_CRAPS)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)
 
local condition = createConditionObject(CONDITION_DRUNK)
setConditionParam(condition, CONDITION_PARAM_TICKS, 10000)
setCombatCondition(combat, condition)
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if not hasCondition(cid, CONDITION_EXHAUST) then
            local target = getCreatureTarget(cid)
            if target ~= 0 then
                doAddCondition(cid, exhaust)
                doCombat(cid, combat, numberToVariant(target))
                doRemoveItem(item.uid, 1)
            else
                doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUCANONLYUSEITONCREATURES)
            end
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    end
    return true
end


revscript of rune, just drop inside in your scripts folder and test ingame
LUA:
---drunk rune---
local rune = Spell(SPELL_RUNE)
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_CRAPS)
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISON)

local drunkTime = math.random(3000, 5000)
local condition = Condition(CONDITION_DRUNK)
condition:setParameter(CONDITION_PARAM_TICKS, drunkTime)
combat:addCondition(condition)

function rune.onCastSpell(creature, variant, isHotkey)
    if not combat:execute(creature, variant) then
        return false
    end

    creature:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    return true
end

rune:name('drunk rune') -- drunk rune name
rune:runeId(2294) -- rune id
rune:allowFarUse(true)
rune:charges(1)
rune:group(1)
rune:cooldown(5000)
rune:level(1) -- level ?
rune:magicLevel(10) -- ml to use
rune:mana(0) -- mana to use rune? how much
rune:needTarget(true)
rune:needLearn(false)
rune:isBlocking(false)
rune:isAggressive(true)
rune:vocation('Druid') -- vocations?
rune:vocation('Elder Druid')
rune:register()
 
Back
Top