• 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 Xikini's Free Scripting Service TFS 1.3

Status
Not open for further replies.

Xikini

I whore myself out for likes
Senator
Premium User
Joined
Nov 17, 2010
Messages
6,788
Solutions
581
Reaction score
5,354
Please request
actions / creatureevents / globalevents / npcs / movements / talkactions

Do not request
spells / weapons / monsters / source editing / database queries

My goal of this thread is to learn TFS 1.3 scripting.

------------------------------------
Support

If you have an issue with one of my scripts, I will attempt to help you, but not in this thread.
Make a thread in the support board.
Ensure to follow all rules of the support board.
Without all neccesary information it's impossible to help you.

------------------------------------
I will only be scripting for TFS 1.3

Not TFS 1.1 / 1.2
Not OTServBR / OTX
and certainly not TFS 0.4

When requesting a script, don't ask for "this script I saw on super popular OT".

I don't care where the idea came from.
I don't want to see a video of the script in action.

I'm here to learn how to script better.
Just describe what the script is supposed to do, and I'll try to make it.

Any script that I make in response to a request from this thread will be shared publically, here, in this thread.

I'm not going to make anything in private, so post your request in this thread only.
Please, for the love of god, don't pm me asking to make a script.
I will actually add you to my ignore list if you do that.
--------------

Anyways!

Thanks for coming by and checking the thread out.
If you think there is a better way to script something, feel free to let me know.
I'm here to learn.

Cheers,

Xikini

----

Completed Scripts

DPS Dummy -> using RevScripts
!playerinfo character name -> using RevScripts
Positional Text talkaction -> using RevScripts
||--> Updated version that can use text & effects
Vocational Item Bonus's -> using RevScripts
||--> Updated version with easier config.
Simple damge buff potion -> using Revscripts
Kill monster in specific area, remove stone for x seconds -> using RevScripts
Training Room Teleporter -> using RevScripts
Lever that removes/adds/transforms objects or ground tiles -> using RevScripts
Loot from monster goes into single backpack, no matter how much loot there is.
Extra loot in monsters, based on chance and tier list -> using RevScripts
||--> Updated version that allows specific monsters to have their own loot table
Random Item chest that disappears after use, and respawns after x time -> using RevScripts
Multiple players required to open passageway.
Monster Arena Lever (x amount of waves, complete all waves, teleport appears) -> using RevScripts
Daily Boosted Creatures (experience & loot chance of items)
||--> Updated main file of boosted creatures, so that it triggers at midnight, instead of when the server starts up.
Reward Chest - Extremely simple. -> using Revscripts
Simple Npc that can sell an item, via text.

----

Extremely useful libs that I use quite often.

data/lib/core/player.lua
Give player items by table

data/lib/core/container.lua
getContainerFreeSlots

----

To-Do List

Shalaby - Player death counter. (Movement and talkaction)
Shalaby - Npc kill monster task, with item reward.
Shalaby - Boss respawn after x time.

-------

Last spot I've read messages
 
Last edited:
I'll look into it, but no promises. xD

Request as many as you like.
I won't guarantee that I can do them all though.

as per main post.. VV
Sorry.


Can you please explain what you want the script to do?
I'll look into it, but no promises. xD

Request as many as you like.
I won't guarantee that I can do them all though.

as per main post.. VV
Sorry.


Can you please explain what you want the script to do?
when you step in to the tp you go to one of the many rooms you mapped and it resp 2 training monks in the spots northwest-southwest of you and after you leave it then it remove monks.
Post automatically merged:

like the training system in all servers but it was never made for 1.3 <complete training system> myb add time to it. the other one work but no storage to know player left or joined then every one can spam in and out until it is all full
 

Attachments

  • received_303737327572357.png
    received_303737327572357.png
    332.2 KB · Views: 28 · VirusTotal
Last edited:
View attachment 49696
Can you make a script,that you can enter a tp, and it takes you to a specific place, but that when you return it takes you to the site from where you entered, for example if I enter the black tp and do tp back it will return me to the black tp, if I enter the part tp blue and I do tp back I returned to tp blue

Basically it's simple script. You can store "previous position" (when you enter tp) in storages.
It's my old code for "lobby" (place at map that can be entered from every place and it's like "one place/centrum to meet people from all around the map")
You can use it or change to one storage:
Lua:
local STORAGE_BACKPOSX = 260011
local STORAGE_BACKPOSY = 260012
local STORAGE_BACKPOSZ = 260013

local LobbyTeleportPos = Position(363,510,7) -- Item Position of Lobby EXIT teleport
local TeleportToLobby = Position(363,511,7) -- Position, where player appear in Lobby 

local function cleanBackPos(cid)
    cid:setStorageValue(STORAGE_BACKPOSX, 0)
    cid:setStorageValue(STORAGE_BACKPOSY, 0)
    cid:setStorageValue(STORAGE_BACKPOSZ, 0)
end

function onStepIn(creature, item, position, fromPosition)

    local player = creature:getPlayer()
    if not player then
        return true
    end

    local pstorX = getPlayerStorageValue(player, STORAGE_BACKPOSX)
    local pstorY = getPlayerStorageValue(player, STORAGE_BACKPOSY)
    local pstorZ = getPlayerStorageValue(player, STORAGE_BACKPOSZ)

    if position == LobbyTeleportPos then
        print("Teleport back to saved position in storages and clean storages")
        player:teleportTo(Position(pstorX, pstorY, pstorZ))
        cleanBackPos(player)
    else
        print("Teleports to Lobby and Save entered position in storages")
        player:setStorageValue(STORAGE_BACKPOSX, fromPosition.x)
        player:setStorageValue(STORAGE_BACKPOSY, fromPosition.y)
        player:setStorageValue(STORAGE_BACKPOSZ, fromPosition.z)
        player:teleportTo(TeleportToLobby, true)
    end
    
    return true
end
 
@nefinoo your "Monster Arena Lever (x amount of waves, complete all waves, teleport appears)" is finished.

I was semi-absent for awhile soo... sorry if you no longer need this

bandicam-2021-02-08-07-09-13-500.gif

Untitled.png
Lua:
--[[
____  ___.__ __   .__       .__ 
\   \/  /|__|  | _|__| ____ |__|
 \     / |  |  |/ /  |/    \|  |
 /     \ |  |    <|  |   |  \  |
/___/\  \|__|__|_ \__|___|  /__|
      \_/        \/       \/    

]]--

local event = {
    monsters = {
        {"rat", "rat", "rat"},                  -- wave 1
        {"cave rat", "cave rat", "cave rat"},   -- wave 2 -- you can add infinite waves.
        {"troll", "troll", "troll"},            -- wave 3
        {"cyclops", "cyclops", "cyclops smith"} -- wave final. (boss?)
    },
    spawnArea = {Position(259, 233, 7), Position(269, 237, 7)}, -- {top_Left_Corner, bottom_Right_Corner}
    leverIds = {1945, 1946}, -- left, right
    leverActionId = 45000,
    teleportTimer = 30, -- how long the teleport stays
    teleportDestination = Position(264, 230, 7),
   
    creatures = {}, -- don't touch
    currentWave = 0 -- don't touch
}

local function verifyEventCreatures()
    if #event.creatures > 0 then
        local creature = nil
        for pid = #event.creatures, 1, -1 do
            creature = Creature(event.creatures[pid][1])
            if not creature then
                table.remove(event.creatures, pid)
            end
        end
    end
end

local function spawnEventCreatures(wave, indexTracker)
    local attempts = 0
    local randomPosition = nil
    local creature = nil
    while attempts < 20 do
        randomPosition = Position(math.random(event.spawnArea[1].x, event.spawnArea[2].x), math.random(event.spawnArea[1].y, event.spawnArea[2].y), math.random(event.spawnArea[1].z, event.spawnArea[2].z))
        creature = Game.createMonster(event.monsters[wave][indexTracker], randomPosition, false, false)
        if not creature then
            tile = Tile(randomPosition)
            if tile and tile:isWalkable() and not Creature(tile:getTopCreature()) then
                creature = Game.createMonster(event.monsters[wave][indexTracker], randomPosition, false, true)
            end
        end
        if creature then
            indexTracker = indexTracker + 1
            table.insert(event.creatures, {creature:getId()})
            break
        end
        attempts = attempts + 1
    end
    if indexTracker <= #event.monsters[wave] then
        addEvent(spawnEventCreatures, 333, wave, indexTracker)
    end
end

local function flopLever(position, leverId, transformTo)
    Tile(position):getItemById(leverId):transform(transformTo)
end

local function removeLever(position, leverId)
    Tile(position):getItemById(leverId):remove()
end

local function createLever(position, leverId, actionId)
    local lever = Game.createItem(leverId, 1, position)
    lever:setActionId(actionId)
end

local function removeMagicForcefield(position)
    Tile(position):getItemById(1387):remove()
end

local function createMagicForcefield(position, destination)
    local magicForcefield = Game.createItem(1387, 1, position)
    magicForcefield:setDestination(destination)
end

local function countDown(timer, position)
    if timer % 5 == 0 and timer ~= 0 then
        for _, creature in pairs(Game.getPlayers()) do
            creature:say(timer, TALKTYPE_MONSTER_SAY, false, nil, position)
            break
        end
    end
    if timer > 0 then
        addEvent(countDown, 1000, timer - 1, position)
    end
end

local function monitorEvent(leverPosition)
    verifyEventCreatures()
    if #event.creatures > 0 then
        addEvent(monitorEvent, 1000, leverPosition)
        return
    end
    addEvent(Position.sendMagicEffect, 500, leverPosition, CONST_ME_POFF)
    addEvent(Position.sendMagicEffect, 1500, leverPosition, CONST_ME_POFF)
    addEvent(createLever, 2500, leverPosition, event.leverIds[1], event.leverActionId)
    addEvent(Position.sendMagicEffect, 2500, leverPosition, CONST_ME_MORTAREA)
end

local function eventManager(leverPosition)
    flopLever(leverPosition, event.leverIds[1], event.leverIds[2])
    addEvent(Position.sendMagicEffect, 500, leverPosition, CONST_ME_POFF)
    addEvent(Position.sendMagicEffect, 1500, leverPosition, CONST_ME_POFF)
    addEvent(removeLever, 2500, leverPosition, event.leverIds[2])
    if event.currentWave + 1 > #event.monsters then
        addEvent(createMagicForcefield, 2500, leverPosition, event.teleportDestination)
        addEvent(countDown, 2500, event.teleportTimer, leverPosition)
        addEvent(removeMagicForcefield, (1000 * event.teleportTimer) + 2500, leverPosition)
        addEvent(createLever, (1000 * event.teleportTimer) + 2500, leverPosition, event.leverIds[1], event.leverActionId)
        addEvent(Position.sendMagicEffect, (1000 * event.teleportTimer) + 2500, leverPosition, CONST_ME_MORTAREA)
        event.creatures = {}
        event.currentWave = 0
        return
    end
    event.currentWave = event.currentWave + 1
    addEvent(Position.sendMagicEffect, 2500, leverPosition, CONST_ME_FIREAREA)
    addEvent(spawnEventCreatures, 5000, event.currentWave, 1)
    addEvent(monitorEvent, 7500, leverPosition)
end


local monsterWaveEvent = Action()

function monsterWaveEvent.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.itemid == event.leverIds[1] then
        eventManager(toPosition)
    end
    return true
end

monsterWaveEvent:aid(event.leverActionId)
monsterWaveEvent:register()
 
Ok can you make the script to sell 1,2,3 or ... 'x' store coins (id:24774)?
Done.
nefinoo_simpleNPC.gif
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local coinId = 24774
local coinCost = 42 -- gold coins
local coinsAmount = {}

function onCreatureAppear(cid)              npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)           npcHandler:onCreatureDisappear(cid)         end
function onCreatureSay(cid, type, msg)      npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                          npcHandler:onThink()                        end

local function greetCallback(cid)
    npcHandler.topic[cid] = 0
    coinsAmount[cid] = 0
    return true
end

local function creatureSayCallback(cid, type, msg)
    if not npcHandler:isFocused(cid) then
        return false
    end
    
    local player = Player(cid)

    if msgcontains(msg, "buy") then
        npcHandler:say("How many store coins would you want to buy?", cid)
        npcHandler.topic[cid] = 1
        
    elseif npcHandler.topic[cid] == 1 then
        local amount = tonumber(msg) ~= nil
        if not amount then
            npcHandler:say("I'm unfamiliar with that number. How many store coins do you want to buy?", cid)
            return true
        end
        amount = tonumber(msg)
        if amount < 0 or amount > 1000000 then
            npcHandler:say("I'm unfamiliar with that number. How many store coins do you want to buy?", cid)
            return true
        end
        npcHandler:say("Would you like to purchase " .. amount .. " store coins for " .. (amount * coinCost) .. " gold coins?", cid)
        npcHandler.topic[cid] = 2
        coinsAmount[cid] = amount
        
    elseif npcHandler.topic[cid] == 2 then
        if not msgcontains(msg, "yes") then
            npcHandler:say("Another time then.", cid)
            npcHandler.topic[cid] = 0
            return true
        end
        local cost = coinsAmount[cid] * coinCost
        if player:getMoney() < cost then
            npcHandler:say("You do not have enough gold coins to make this purchase. Another time, maybe?", cid)
            npcHandler.topic[cid] = 0
            coinsAmount[cid] = 0
            return true
        end
        player:removeMoney(cost)
        player:addItem(coinId, coinsAmount[cid], true)
        npcHandler:say("I appreciate your business.", cid)
        npcHandler.topic[cid] = 0
        coinsAmount[cid] = 0
        
    end
    return true
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
make a trainer DPS script using revscripts

every 5 sec if player is attacking trainer send their dps and make it only show text (creature.say + monster talktype) to that player instead of all players on screen
 
imagine your server is Normal PvP. (if player kill another player, get skull and frag).
But in some área (x, y, z) to (toX, toY, toZ), this area will be PvP Enforced (you can kill another player withou get skull and frag. And killer will gain exp for killing). Of course a player who dies loose items/skills normaly..
 
imagine your server is Normal PvP. (if player kill another player, get skull and frag).
But in some área (x, y, z) to (toX, toY, toZ), this area will be PvP Enforced (you can kill another player withou get skull and frag. And killer will gain exp for killing). Of course a player who dies loose items/skills normaly..
you need sour edit to aff pvp enfo tiles
 
Command: !info "player .
Make info in deafult channel like:
Profession, level, hp/mp, cap, first login, skills and magic info(with percent too), last death, pz time, frags, sex. Make some exhausted on script (maybe 1 minute?)
Thanks a lot. :)
 
make a trainer DPS script using revscripts

every 5 sec if player is attacking trainer send their dps and make it only show text (creature.say + monster talktype) to that player instead of all players on screen
Honestly, this took forever. xD

Got to learn so much stuff creating this. (mostly in terms of revscripts)

bandicam-2020-08-19-02-26-07-379.gif

\data\scripts\creaturescripts\ onHealthChange_training_dummy.lua
Lua:
local creatureevent = CreatureEvent("onHealthChange_Training_Dummy")

local dps_check_time = 5 -- how long in seconds until DPS is shown to player
local DPS_info = {}

local function send_dps_info(playerID, monsterID)
    local player = Player(playerID)
    if player then
        player:say("Your DPS is " .. (math.floor((DPS_info[monsterID][playerID] / dps_check_time) + 0.5)) .. ".", TALKTYPE_MONSTER_SAY, false, player)
    end
    DPS_info[monsterID][playerID] = nil
end

function creatureevent.onHealthChange(monster, creature, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not Player(creature) then
        return false
    end
    
    local monsterID = monster:getId()
    local playerID = creature:getId()
    
    if not DPS_info[monsterID] then
        DPS_info[monsterID] = {}
    end
    
    if not DPS_info[monsterID][playerID] then
        addEvent(send_dps_info, dps_check_time * 1000, playerID, monsterID)
    end

    DPS_info[monsterID][playerID] = (DPS_info[monsterID][playerID] or 0) + primaryDamage + secondaryDamage
    monster:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS, creature)
    return false
end

creatureevent:register()
\data\monster\lua\ training_dummy.lua
Lua:
local mType = Game.createMonsterType("training dummy")
local monster = {}

monster.description = "a training dummy"
monster.outfit = {
    lookTypeEx = 5787
}

monster.health = 1
monster.maxHealth = monster.health
monster.speed = 0

monster.flags = {
    pushable = false,
    summonable = false,
    attackable = true,
    hostile = false,
    convinceable = false
}

mType.onAppear = function(monster, creature)
    if monster:getId() == creature:getId() then
        monster:registerEvent("onHealthChange_Training_Dummy")
    end
end

mType:register(monster)
 
Last edited:
Honestly, this took forever. xD

Got to learn so much stuff creating this. (mostly in terms of revscripts)

View attachment 48887

\data\scripts\creaturescripts\ onHealthChange_training_dummy.lua
Lua:
local creatureevent = CreatureEvent("onHealthChange_Training_Dummy")

local dps_check_time = 5 -- how long in seconds until DPS is shown to player
local DPS_info = {}

local function send_dps_info(playerID, monsterID)
    local player = Player(playerID)
    if player then
        player:say("Your DPS is " .. (math.floor((DPS_info[monsterID][playerID] / dps_check_time) + 0.5)) .. ".", TALKTYPE_MONSTER_SAY, false, player)
        DPS_info[monsterID][playerID] = nil
    end
end

function creatureevent.onHealthChange(monster, creature, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not Player(creature) then
        return false
    end

    local monsterID = monster:getId()
    local playerID = creature:getId()

    if not DPS_info[monsterID] then
        DPS_info[monsterID] = {}
    end

    if not DPS_info[monsterID][playerID] then
        DPS_info[monsterID][playerID] = 0
        addEvent(send_dps_info, dps_check_time * 1000, playerID, monsterID)
    end

    DPS_info[monsterID][playerID] = DPS_info[monsterID][playerID] + primaryDamage + secondaryDamage
    monster:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS, creature)
    return false
end

creatureevent:register()
\data\monster\lua\ training_dummy.lua
Lua:
local mType = Game.createMonsterType("training dummy")
local monster = {}

monster.description = "a training dummy"
monster.outfit = {
    lookTypeEx = 5787
}

monster.health = 1
monster.maxHealth = monster.health
monster.speed = 0

monster.flags = {
    pushable = false,
    summonable = false,
    attackable = true,
    hostile = false,
    convinceable = false
}

mType.onAppear = function(monster, creature)
    if monster:getId() == creature:getId() then
        monster:registerEvent("onHealthChange_Training_Dummy")
    end
end

mType:register(monster)
Using a better naming convention for variables makes it all look cleaner. Also, you produced a potential memory leak in your send_dps_info function, by only setting the value back to nil if the player was found. If the player logs out (maybe a PZ is close enough) or otherwise disappears, the value will never get cleared. Unlikely in this case, but nonetheless, the leak exists.

Lua:
local creatureEvent = CreatureEvent("onHealthChange_Training_Dummy")

local checkTime = 5 -- how long in seconds until DPS is shown to player
local DPSTable = {}

local function sendInfo(playerId, monsterId)
    local monsterDPS = DPSTable[monsterId]
    local player = Player(playerId)
    if player then
        player:say(("Your DPS is %d."):format(math.floor((monsterDPS[playerId] / checkTime) + 0.5)), TALKTYPE_MONSTER_SAY, false, player)
    end

    monsterDPS[playerId] = nil
end

function creatureEvent.onHealthChange(monster, creature, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
    if not Player(creature) then
        return false
    end

    local monsterId = monster:getId()
    local playerId = creature:getId()

    if not DPSTable[monsterId] then
        DPSTable[monsterId] = {}
    end

    if not DPSTable[monsterId][playerId] then
        addEvent(sendInfo, checkTime * 1000, playerId, monsterId)
    end

    DPSTable[monsterId][playerId] = (DPSTable[monsterId][playerId] or 0) + primaryDamage + secondaryDamage
    monster:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS, creature)
    return false
end

creatureEvent:register()
 
you produced a potential memory leak in your send_dps_info function
This was an oversight on my part.
Thanks for pointing it out. 😅
I'll be updating the script with some of the alterations. 🙏

Using a better naming convention for variables makes it all look cleaner.
I try, I swear. xD
 
now make a configurable script where a specific piece of armor grants separate bonuses based on the vocation of the wearer
example:
sorc -> gain magic level
druid -> gain mana
pally -> gain dist
knight -> gain melee
 
imagine your server is Normal PvP. (if player kill another player, get skull and frag).
But in some área (x, y, z) to (toX, toY, toZ), this area will be PvP Enforced (you can kill another player withou get skull and frag. And killer will gain exp for killing). Of course a player who dies loose items/skills normaly..
I looked and looked, and can't find a way to do this.

As of right now I'd say this is impossible without a database query at minimum, and that would be the 'hacky' approach, since we'd be removing the frag after it was added.

In order to prevent the frag from occurring, I'm 99% sure it would require a source edit.

Command: !info "player .
Make info in deafult channel like:
Profession, level, hp/mp, cap, first login, skills and magic info(with percent too), last death, pz time, frags, sex. Make some exhausted on script (maybe 1 minute?)
Thanks a lot. :)
I'll try to do as many of these as possible.
 
imagine your server is Normal PvP. (if player kill another player, get skull and frag).
But in some área (x, y, z) to (toX, toY, toZ), this area will be PvP Enforced (you can kill another player withou get skull and frag. And killer will gain exp for killing). Of course a player who dies loose items/skills normaly..
Use map editor to map pvp enforced area to the specified areas you need?
 
Command: !info "player .
Make info in deafult channel like:
Profession, level, hp/mp, cap, first login, skills and magic info(with percent too), last death, pz time, frags, sex. Make some exhausted on script (maybe 1 minute?)
Thanks a lot. :)
'first login', 'last death' -> I was unable to do.
I think I got everything else you wanted, plus a bit more.

usage: !playerinfo character name

Code:
Name: Test Character Two
Time Online: 00:03:49
Frags: 3
Skull: red
PZ Lock: 00:00:59
Level: 8
Sex: male
Vocation: Druid
Health: 185/185
Mana: 25/35
Soul: 100/100
Capacity: 342/420
Feed Time: 00:01:06
Magic: 0 -- (I could probably do a bunch of math to get this %, but I don't want to.... xD)
Fist: 10, with 94% to next level
Club: 11, with 45% to next level
Sword: 13, with 77% to next level
Axe: 10, with 100% to next level
Distance: 10, with 100% to next level
Shielding: 10, with 100% to next level
Fishing: 10, with 100% to next level

data\scripts\talkactions\ playerinfo.lua
Lua:
local talk = TalkAction("!playerinfo")

local exhaustTable, exhaustTimer = {}, 60 -- in milliseconds

function talk.onSay(player, words, param)
    local cur_player, cur_time = player:getId(), os.mtime()
    if exhaustTable[cur_player] and exhaustTable[cur_player] > cur_time then
        player:sendCancelMessage("This talkaction is on cooldown. Can use again in " .. ((exhaustTable[cur_player] - cur_time) / 1000) .. " seconds.")
        return false
    end
    
    local target = Player(param)
    if not target then
        player:sendCancelMessage("Player '" .. param:lower() .. "' either does not exist or is offline.")
        exhaustTable[cur_player] = cur_time + 5000
        return false
    end
    exhaustTable[cur_player] = cur_time + exhaustTimer
    
    local text = "\nName: " .. target:getName()
    text = text .. "\nTime Online: " .. os.date('!%T', os.time() - target:getLastLoginSaved())
    
    local killCount = target:getSkullTime()
    text = text .. "\nFrags: " .. (killCount > 0 and math.ceil(killCount / configManager.getNumber(configKeys.FRAG_TIME)) or 0)
    
    local skull = target:getSkull()
    text = text .. "\nSkull: " .. (skull == 3 and "white" or skull == 4 and "red" or skull == 5 and "black" or "none")
    
    local pzLockTime = (target:isPzLocked() and target:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT):getTicks() / 1000 or 0)
    text = text .. "\nPZ Lock: " .. (pzLockTime > 0 and os.date('!%T', pzLockTime) or "none")
    
    text = text .. "\nLevel: " .. target:getLevel()
    text = text .. "\nSex: " .. (target:getSex() == 0 and "female" or "male")
    text = text .. "\nVocation: " .. target:getVocation():getName()
    text = text .. "\nHealth: " .. target:getHealth() .. "/" .. target:getMaxHealth()
    text = text .. "\nMana: " .. target:getMana() .. "/" .. target:getMaxMana()
    text = text .. "\nSoul: " .. target:getSoul() .. "/" .. target:getMaxSoul()
    text = text .. "\nCapacity: " .. (target:getFreeCapacity() / 100) .. "/" .. (target:getCapacity() / 100)
    
    local feedTime = target:getCondition(CONDITION_REGENERATION, CONDITIONID_DEFAULT)
    text = text .. "\nFeed Time: " .. os.date('!%T', (feedTime and feedTime:getTicks() / 1000 or 0))
    
    text = text .. "\nMagic: " .. target:getMagicLevel()
    text = text .. "\nFist: " .. target:getSkillLevel(SKILL_FIST) .. ", with " .. (100 - target:getSkillPercent(SKILL_FIST)) .. "% to next level"
    text = text .. "\nClub: " .. target:getSkillLevel(SKILL_CLUB) .. ", with " .. (100 - target:getSkillPercent(SKILL_CLUB)) .. "% to next level"
    text = text .. "\nSword: " .. target:getSkillLevel(SKILL_SWORD) .. ", with " .. (100 - target:getSkillPercent(SKILL_SWORD)) .. "% to next level"
    text = text .. "\nAxe: " .. target:getSkillLevel(SKILL_AXE) .. ", with " .. (100 - target:getSkillPercent(SKILL_AXE)) .. "% to next level"
    text = text .. "\nDistance: " .. target:getSkillLevel(SKILL_DISTANCE) .. ", with " .. (100 - target:getSkillPercent(SKILL_DISTANCE)) .. "% to next level"
    text = text .. "\nShielding: " .. target:getSkillLevel(SKILL_SHIELD) .. ", with " .. (100 - target:getSkillPercent(SKILL_SHIELD)) .. "% to next level"
    text = text .. "\nFishing: " .. target:getSkillLevel(SKILL_FISHING) .. ", with " .. (100 - target:getSkillPercent(SKILL_FISHING)) .. "% to next level"
    
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, text)
    return false
end

talk:separator(" ")
talk:register()
 
Status
Not open for further replies.
Back
Top