• 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 How can I set new corpse for specific vocation?

Ramirez

New Member
Joined
Apr 11, 2013
Messages
19
Reaction score
0
Hey

I'd like to set different corpses on my vocations and change its description.
For example how can I change the corpse for vocation 2 to image id 328 and make it decay to image 329 with a description "You see a dead saiyan."?
 
Last edited:
I changed it to:

[cpp]uint16_t Player::getLookCorpse() const

{
uint16_t saiyans, def;

saiyans = 328; // corpse for saiyans
def = 1547; // corpse for non-vocation

if (getVocationId() == 1)
return saiyans;

return def;
}[/cpp]but there is no corpse at all after player's death.

Should I return item id or image id? What should I do in items.xml?
 
This can be done in Lua as well. The following script will create a corpse based on the players sex:

LUA:
local t = {
	[0] = 3065,
	[1] = 3058
}
 
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) then
		for i = 1, #deathList do
			local corpse, k = doCreateItem(t[getPlayerSex(cid)], 1, getThingPos(cid)), ""
			for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
				k = k .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
			end
		end
	end
	return true
end
I have modified it a little and it might work, though I haven't tested it:

LUA:
local t = {
	[{1, 5}] = {3065, 3058},
	[{2, 6}] = {3065, 3058},
}
 
function onDeath(cid, corpse, deathList)
	if isPlayer(cid) then
		for voc, sex in pairs(t) do
			if isInArray(voc, getPlayerVocation(cid)) then
				for i = 1, #deathList do
					local corpse, k = doCreateItem(getPlayerSex(cid) == 0 and sex[1] or sex[2], 1, getThingPos(cid)), ""
					for i = 1, math.min(getConfigInfo('deathAssistCount') + 1, #deathList) do
						k = k .. (i == 1 and "" or ", ") .. (isMonster(deathList[i]) and "a " or "") .. getCreatureName(deathList[i])
					end
				end
			end
		end
	end
	return true
end
 
It would go in data/creaturescripts with an "onDeath" event in creaturescripts.xml.

If you plan to make this a major part of your server, I would suggest doing what was provided above - source editions. Using an onDeath event would be sufficient for events.
 
Yeah it's pretty major part but if I change it in the source as above it doesn't work. There is no corpse after player's death.
I suppose that I should return items's id instead of image's id. Am I right?
 
Yeah it's pretty major part but if I change it in the source as above it doesn't work. There is no corpse after player's death.
I suppose that I should return items's id instead of image's id. Am I right?

Unfortunately, I haven't spent much time coding in C/C++, I am not the one you want advising you on what to do there. I am still in the "trial and error" phase of learning it, which can be a pain in the a**. Hopefully a support team member can assist you. Good luck!
 
Back
Top