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

Possible? Diff EXP Gain For Diff Vocs for Certain Creature

Call Me Taffy

Call Me Maybe
Joined
Aug 9, 2009
Messages
651
Reaction score
123
Is that even possible in a short enough code that wouldn't take a decent coder that long?

Basically, I was looking to see if certain vocs could gain diff exp on certain creatures.

Example:

Key:
-> = Killing

Sorcerer -> Earth Elementals gaining (200% exp),
Knight -> Energy Elementals gaining (200% exp),
Druid -> Water Elementals gaining (200% exp), and
Paladin -> Fire Elementals gaining (200% exp).

I'm pretty clueless, but if I could guess, I'd say it's a function onKill, if isSorcerer and if monster is ~ then do get monster experience *2. Yea, I'm sure you can tell I'm a noob in scripting.

Thanks in advance for the help everyone...
 
Go to onAttackedCreatureKilled in creature.cpp an try this:
Code:
if(target != this)
{
	int experience = target->getGainedExperience(this));
	if ((vocation == 1 && target->getName() == "Earth Elemental") or (vocation == 2 && target->getName() == "Energy Elemental") or (vocation == 3 && target->getName() == "Water Elemental") or (vocation == 4 && target->getName() == "Fire Elemental"))
		experience *= 2;

	onGainExperience(experience);
}

Untested :(
 
Crap source edits. Never learned that compiling stuff.
Never too late to learn though, and I'll have a look into it.

Thanks for replying xD
 
You could do it in lua aswell, just do OnKill if target name = Bla Bla and Get player Vocation Bla add Exp Bla elseif getPlayerVocation Bla addExp Bla. =o
 
Code:
function onKill(cid, target)
	local monstahs = {
		["earth elemental"] = {voc = 1, add_exp = 1234},
		["energy elemental"] = {voc = 4, add_exp = 1234},
		["water elemental"] = {voc = 2, add_exp = 1234},
		["fire elemental"] = {voc = 3, add_exp = 1234}
	}
	local now = monstahs[getCreatureName(target):lower]
	if (not now) then
		return true
	end

	if (getPlayerVocation(cid) == now.voc) then
		doPlayerAddExperience(cid, now.add_exp)
	end

	return true
end
 
Code:
function onKill(cid, target)
	local monstahs = {
		["earth elemental"] = {voc = 1, add_exp = 1234},
		["energy elemental"] = {voc = 4, add_exp = 1234},
		["water elemental"] = {voc = 2, add_exp = 1234},
		["fire elemental"] = {voc = 3, add_exp = 1234}
	}
	local now = monstahs[getCreatureName(target):lower]
	if (not now) then
		return true
	end

	if (getPlayerVocation(cid) == now.voc) then
		doPlayerAddExperience(cid, now.add_exp)
	end

	return true
end

Isn't possible getting creature race instead of name? Would be shorter than writing all creatures names in the script and adding exp to each. Also isn't exp possible to do in percentage? Just giving ideas.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
Back
Top