• 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!

Action [TalkAction] Role Player Tool

Gothrim

New Member
Joined
Jan 23, 2009
Messages
20
Reaction score
0
Yesterday i'd requested a script. Noone helped me and i have learned lua a bit and done it by myself. ;)
Necessity is the mother of invention.
http://otland.net/f132/player-items-look-79420/

Tested on The Forgotten Server, version 0.3.6 (Crying Damson)

Role Player Tool -
1.Role Players can change look description of his character by command /look
2.You can give your role players item, that will:
a)Show the name of the another character
b)Show characters look description
c)Show characters equipment
d)Show characters health status as it description.


Let's start:
1. Go to data/talkactions/talkactions.xml and add this:
Code:
<talkaction words="/look" hide="yes" event="script" value="look.lua"/>

2. Go to data/talkactions/scripts/ directory and make a new file
look.lua
Code:
function onSay(cid, words, params, channel)
         if params == '' then
             return
         end

         setPlayerStorageValue(cid, 99995, params)
         local opis = getPlayerStorageValue(cid, 99995)
	 doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Character's look description has changed to:\n       "..opis)
             return true
end

3. Go to data/actions/actions.xml and add this:
Code:
<action itemid="8266" event="script" value="RolePlayersTool.lua"/>

a) itemid="8266" is a number of koshei's ancient amulet. You can change this id to anything, that has "use with" option in menu

3. Go to data/actions/scripts/ directory and make a new file
RolePlayersTool.lua
Code:
function getItemsInContainer(cont, sep)
    local text = ""
    local tsep = ""
    local count = ""
    for i=1, sep do
        tsep = tsep.."-"
    end
    tsep = tsep..">"
    for i=0, getContainerSize(cont.uid)-1 do
        local item = getContainerItem(cont.uid, i)
        if isContainer(item.uid) == FALSE then
            if item.type > 0 then
                count = "("..item.type.."x)"
            end
            text = text.."\n"..tsep..getItemNameById(item.itemid).." "..count
        else
            if getContainerSize(item.uid) > 0 then
                text = text.."\n"..tsep..getItemNameById(item.itemid) 
                text = text..getItemsInContainer(item, sep+2)
            else
                text = text.."\n"..tsep..getItemNameById(item.itemid)
            end
        end
    end
    return text
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
local hpmax = getCreatureMaxHealth(cid)
local hpnow = getCreatureHealth(cid)
local hpercent = hpnow / hpmax * 100
local stan = nill
      if hpercent <= 100 and hpercent >= 95 then
            stan = "healthy"
      elseif hpercent < 95 and hpercent >= 80 then
            stan = "scratched"
      elseif hpercent < 80 and hpercent >= 60 then
            stan = "wounded"
      elseif hpercent < 60 and hpercent >= 40 then
            stan = "injured"
      elseif hpercent < 40 and hpercent >= 20 then
            stan = "badly injured"
      elseif hpercent < 20 and hpercent >= 4 then
            stan = "dying"
      elseif hpercent < 4 and hpercent >= 0 then
            stan = "to be in death agony"
            else
            stan = "genetical failure"
      end
    local slotName = {"as a head cover he is wearing", "on neck he is wearing", "on a back he has", "on a chest", "in the right hand he is holding", "and in left", "legs are protected by", "and the feet are by", "on his finger is shining", "and in quiver he is keeping"}
    local player = itemEx.uid
    local opis = getPlayerStorageValue(itemEx.uid, 99995)
    if isPlayer(player) == TRUE then
        local text = "This is "..getPlayerName(player).."...\n"..opis.."\nYou are insepcting his equipment, and you are seeing that"
        for i=1, 10 do
            text = text..", "
            local item = getPlayerSlotItem(player, i)
            if item.itemid > 0 then

                    text = text..slotName[i].." "..getItemNameById(item.itemid)

            else
                text = text..slotName[i].."... rather nothing"
            end
        end
        local text2 = text.."\nIt look like he is "..stan
        doShowTextDialog(cid, 8266, text2)
    else
        doPlayerSendCancel(cid, "GO TO THE CANDY MOUNTAIN CHAAAARLIEEEEE.")
    end
    return TRUE
end

And it's all.
Sorry for translation- Me english sux.
Sorry for optimisation- this is one of my first scripts ;)

I want to greet Unknown666 and Cykotitan :D

All credits to me and Azi(the man who has done clean equipment-spy, and gives me idea)

92924954.png

(it looks strange, because i fully translated it to my language)
 
Last edited:
Translate to english plz Xd

It's translated fully. On screenshoot i'm just using mine native version of script. If you install it as I said, all should work fine ^_^

On Screenshoot it's writed more or less something like this:
This Is Sanguis
It's a tall man with a long, blonde hair and azure eyes, that reminds the biggest winters of Karagoth.
You are insepcting his equipment, and you are seeing that as a head cover he is wearing... rather nothing(...)
etc, etc...
 
Last edited:
Code:
         if params == NIL then
             return
         end
should be
Code:
	if params == '' then
		return true
	end
 
Code:
         if params == NIL then
             return
         end
should be
Code:
	if params == '' then
		return true
	end

Ok, changed it.

Can you explain why? I'm new in lua and i just want to know where is difference ^^
 
But param is always string and never nil so it's "" if it's empty :p
 
Back
Top