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

Solved different corpses for each vocation

FilipeJF

New Member
Joined
Jan 9, 2012
Messages
124
Reaction score
4
In my server the vocations are different races.

I want to know how to make an elf become an elf when he die, a orc become an orc when die ... and so on.

I tried this script, but it did not work:

Code:
local array = {
  [1] = 2160,
  [2] = 2160,
  [3] = 2160,
  [4] = 2160
}

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

So, here I am, with the same doubt. Someone know how to make it work or another way to do this?
 
I make the script work fine!

The problem was a script conflict into creaturescripts. But now it's ok. Thanks, Dantez!
 
HI! Why after die my corpse is ID:1
(21:06 You see water.
You recognize TEST CORPSE. He was killed by a Vasto Lorde.
ItemID: [1].)
but in vocation.xml my corpse is (corpse="2905")

i use TFS 0.3.5

best regards.
 
HI! Why after die my corpse is ID:1
(21:06 You see water.
You recognize TEST CORPSE. He was killed by a Vasto Lorde.
ItemID: [1].)
but in vocation.xml my corpse is (corpse="2905")

i use TFS 0.3.5

best regards.
try this
Lua:
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
 
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.


my only keeps creating the item with id 1
 
Back
Top