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

id of vocation to storage

luciano01

New Member
Joined
Aug 6, 2017
Messages
33
Reaction score
1
I have a script to change the corpse of vocations, but I wanted to change that part of checking the vocation to start checking a storage that the player has, and so change his body!

local table = {
[1] = 3058,
[2] = 2820,
[3] = 2945,
[4] = 2960,
[5] = 3058,
[6] = 3058,
[7] = 3058,
[8] = 3058,
[9] = 14050,
[10] = 14052,
[11] = 2945,
[12] = 2945,
[13] = 14060,
[14] = 2960,
[15] = 3058,
[16] = 2960,
[17] = 3058,
[18] = 3058,
[19] = 14054,
[20] = 14046,
[21] = 14056,
[22] = 14058,
[23] = 3058,
[24] = 14062,
[25] = 5931,
[26] = 3058,
[27] = 14035,
[28] = 3058,
[29] = 3058,
[30] = 3058,
[31] = 14038,
[32] = 14040,
[33] = 3058,
[34] = 3058,
[35] = 14032,
[36] = 14029,
[37] = 14026

}
local function transform(pos, id, voc)
local item = getTileItemById(pos, id)
if item and item.uid > 1 then
item:transform(item.uid, table[voc])
item:decay()
end
end
function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
if not player or not table[player:getVocation():getId()] then return true end
addEvent(transform, 15, getThingPos(player), corpse.itemid, player:getVocation():getId())
return true
end

local config = {
[2] = 5,
[3] = 62,
[4] = 69
}
function onLogin(player)
if(player:getStorageValue(10005) > 0 or not config[player:getVocation():getId()]) then
return TRUE
end
if player:getGroup():getId() >= 3 then -- 1 = Players, 2 = Tutors, 3 = Sr. Tutor, 4 = GM, 5 = GOD
return TRUE
end
local outfit = player:getOutfit()
outfit.lookType = config[player:getVocation():getId()]
player:setOutfit(outfit)
player:setStorageValue(10005,1)
return TRUE
end
 
Last edited:
@luciano01 1 key storage solution
Lua:
local storage = 1111

local table = {
[1] = 3058,
[2] = 2820,
[3] = 2945,
[4] = 2960,
[5] = 3058,
[6] = 3058,
[7] = 3058,
[8] = 3058,
[9] = 14050,
[10] = 14052,
[11] = 2945,
[12] = 2945,
[13] = 14060,
[14] = 2960,
[15] = 3058,
[16] = 2960,
[17] = 3058,
[18] = 3058,
[19] = 14054,
[20] = 14046,
[21] = 14056,
[22] = 14058,
[23] = 3058,
[24] = 14062,
[25] = 5931,
[26] = 3058,
[27] = 14035,
[28] = 3058,
[29] = 3058,
[30] = 3058,
[31] = 14038,
[32] = 14040,
[33] = 3058,
[34] = 3058,
[35] = 14032,
[36] = 14029,
[37] = 14026

}
local function transform(pos, id, voc)
    local item = getTileItemById(pos, id)
    if item and item.uid > 1 then
        item:transform(item.uid, table[voc])
        item:decay()
    end
end
function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    if not player:isPlayer() or not table[player:getStorageValue(storage)] then
        return true
    end
    addEvent(transform, 15, getThingPos(player), corpse:getId(), player:getStorageValue(storage))
return true
end
 
If player storage is 1 or greater, player's corpse will turn into a different corpse?

try this then.

Lua:
local config = {
    -- {storage, corpse_id}
    {45001, 3058},
    {45002, 2820},
    {45003, 2945}
}

local function transform(pos, id, corpse_id)
    local item = getTileItemById(pos, id)
    if item and item.uid > 1 then
        item:transform(item.uid, corpse_id)
        item:decay()
    end
end

function onDeath(player, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified)
    if not player:isPlayer() then
        return true
    end
    for i = 1, #config do
        if player:getStorageValue(config[i][1]) > 0 then
            addEvent(transform, 15, getThingPos(player), corpse:getId(), config[i][2])
            break
        end
    end
    return true
end
 
if you can do the second too, I appreciate !!
try this?

Lua:
local config = {
   -- {storage, outfit_id}
   {45001, 5},
   {45002, 62},
   {45003, 69}
}

function onLogin(player)
   if player:getGroup():getId() >= 3 then -- 1 = Players, 2 = Tutors, 3 = Sr. Tutor, 4 = GM, 5 = GOD
       return true
   end

   if player:getStorageValue(10005) == 1 then -- Idk what this storage is for, but I left it in.
       return true
   end
   player:setStorageValue(10005, 1)

   for i = 1, #config do
       if player:getStorageValue(config[i][1]) > 0 then
           local outfit = player:getOutfit()
           outfit.lookType = config[config[i][2]]
           player:setOutfit(outfit)
           break
       end
   end
   return true
end
 
Back
Top