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

Different corpse by vocation in 0.3.6

PuszekLDZ

https://tibia74.eu
Premium User
Joined
Jan 2, 2020
Messages
329
Solutions
1
Reaction score
85
Location
Lodz
Hello there.

I did changes in c++ and I got problem, how to add and register that lua script in 0.3.6 server

i wasnt working with 0.3.6 - and i dont know how to add it... any one could chceck it and try to help me
how to parse it well and add a script to be used server?

code does a corpse change, but with ItemID"1" - it wont get a " corpse="xxxx" " from vocation.xml
without carpse="xxxx" in voc - it wont do anything.

script to add to server
local voc_list =
{ [1] = {2160},
[2] = {2160},
[3] = {2160},
[4] = {2160} }

function onDeath(cid, corpse)
doTransformItem(corpse.uid, voc_list[getPlayerVocation(cid)][1])
doDecayItem(corpse.uid)
return true
end

c++ code changes
How about a C++ code?

vocations.h
Change:

Code:
int32_t lessLoss, capGain;
To:
Code:
int32_t lessLoss, capGain, corpse;


Under:
Code:
void setAttackable(bool v) {attackable = v;}
Add:
Code:
bool getCorpse() const {return corpse;}
void setCorpse(int32_t v) {corpse = v;}


vocations.cpp
Under:
Code:
if(readXMLInteger(p, "attackspeed", intValue))
    voc->setAttackSpeed(intValue);
Add:
Code:
if(readXMLInteger(p, "corpse", intValue))
    voc->setCorpse(intValue);


Under:
Code:
attackSpeed = 1500;
Add:
Code:
corpse = -1;

player.cpp
Change:
Code:
Item* corpse = Creature::createCorpse(deathList);
To:
Code:
Item* corpse;
if(getVocation()->getCorpse() >= 0)
    corpse = Item::CreateItem(getVocation()->getCorpse());
else
    corpse = Creature::createCorpse(deathList);

With this code you will be able to change corpses of each vocation.

Sample:
<vocation id="1" name="Sorcerer" description="a sorcerer" corpse="0" needpremium="0"...
When you type zero there, no corpse will be created. Delete whole corpse="" to use default ones.

Let me know if it's working, not tested.
 
something like?
Lua:
local voc_list = {
    [1] = {2160},
    [2] = {2160},
    [3] = {2160},
    [4] = {2160}
}

function onDeath(cid, corpse)
    local playerVocation = getPlayerVocation(cid)
   
    if voc_list[playerVocation] ~= nil then
        local newCorpseItemID = voc_list[playerVocation][1]
        doTransformItem(corpse.uid, newCorpseItemID)
        doDecayItem(corpse.uid)
        return true
    else
        return false
    end
end

It is better to abandon TFS 0.3.6 and 0.4 as they are very old. Everyone is moving to TFS 1.x, like Nekiro. With scripts, you will always find it easy to get what you want, or even easy to adapt a script according to your needs. As Levi said, it's better to use 1.x.
 
something like?
Lua:
local voc_list = {
    [1] = {2160},
    [2] = {2160},
    [3] = {2160},
    [4] = {2160}
}

function onDeath(cid, corpse)
    local playerVocation = getPlayerVocation(cid)
  
    if voc_list[playerVocation] ~= nil then
        local newCorpseItemID = voc_list[playerVocation][1]
        doTransformItem(corpse.uid, newCorpseItemID)
        doDecayItem(corpse.uid)
        return true
    else
        return false
    end
end

It is better to abandon TFS 0.3.6 and 0.4 as they are very old. Everyone is moving to TFS 1.x, like Nekiro. With scripts, you will always find it easy to get what you want, or even easy to adapt a script according to your needs. As Levi said, it's better to use 1.x.
dosn`t work ;)
 

Similar threads

Back
Top