• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Full Paralyze Rune

  • Thread starter Thread starter Tinkz
  • Start date Start date
T

Tinkz

Guest
Hello!

Basically what i´m looking for is a script that allows a a rune to fully stop a person from moving, it only has x % chanse to succeed and only has 1 charge.

The function of this custom rune is when i use it on a target, player then cannot move for x amount of time. It should only work on players and not monsters.
 
Code:
local function setMove(cid, bool)
    if not isPlayer(cid) then
        return false
    end
    return doCreatureSetNoMove(cid, bool)
end

local cfg = {
    seconds = 10, -- seconds the player cannot move
    chance = 30 -- chance the rune will be successful
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if not isPlayer(itemEx.uid) then
        return true
    end
    if math.random(100) <= cfg.chance then
        setMove(itemEx.uid, false)
        addEvent(setMove, cfg.seconds * 1000, itemEx.uid, true)
        -- add etc code here such as effects and whatnot
    end
    doRemoveItem(item.uid, 1)
    return true
end
<action itemid="runeid" event="script" value="xxxxxx.lua"/>
 
Last edited:
@Xeraphus,

For future reference, it is unnecessary to check 'isPlayer' multiple times. It's best to keep things simple unless otherwise necessary. A lot of scripters tend to believe that creating functions within scripts and adding numerous checks makes their scripts "more advanced," when in reality, it is making them inefficient. Something like this should suffice.

Just a tip. No need to take offense. :) People love to start arguments on this forum.
 
@Xeraphus,

Just for future reference, it is unnecessary to check 'isPlayer' multiple times. It's best to keep things simple unless otherwise necessary. A lot of scripters tend to believe that creating functions within scripts and adding numerous checks makes their scripts "more advanced," when in reality, it is making them inefficient. Something like this should suffice.
i'm not making it like that to seem "more advanced"
it's basic code
only reason i added the isPlayer check inside the setMove function is because if a player logs out and you try to execute a function with the cid value passed through the function, it will throw an error
if you check isPlayer(cid) and the player id is no longer valid (logged out), the function will stop execution rather than continuing and throwing an error
+ he said he only wanted it to work on players, hence the first player check, otherwise it may be used on NPCs and monsters.
 
Last edited:
Back
Top