View Full Version : Is it possible to determine the class of a character?
Aristeus
12-02-2015, 02:24 PM
Trying to determine the class of a character for a script, as far as i can tell there's no function for it and I can't seem to come up with another way to determine it.
Anyone have an idea?
viser14
12-02-2015, 03:23 PM
as far as i understand, the only way to do it is by hp/mp calculations based on the lvl of the char. hope this helps.
Aristeus
12-02-2015, 03:35 PM
as far as i understand, the only way to do it is by hp/mp calculations based on the lvl of the char. hope this helps.
Thanks, it'll only work to determine Knight, Paladins and then if it's a mage class but it's better than nothing.
viser14
12-02-2015, 03:37 PM
to differentiate between mage classes, check the weapon slot for rod or wand
Aristeus
12-02-2015, 04:12 PM
to differentiate between mage classes, check the weapon slot for rod or wand
Good idea, thanks again.
shadowart
12-02-2015, 04:22 PM
You can also try casting vocation specific spells.
texmex47
12-02-2015, 06:38 PM
Just calculate max hp. Will at least be a lot easier then, but mage will still either be druid or sorcerer.
Every character starts with 150hp.
You gain 5hp on rookgaard.
So at lvl 8 you have 150 + (7 x 5) = 185
If your level is 107, and you have 680hp as maximum:
680 - 185 = 495
Now take away 8 levels too
107 - 8 = 99
495 / 99 = 5
druids and sorcs gain 5hp per lvl.
asnwer: you are a druid or sorc.
you can then check, if the answer is 5, compare weapon ids (rods VS wands).
I made a script for it.
This only works if your character left rookgaard or dawnport at level 8.
function GetVocation(level, health)
local vocation = nil
local level = level
local health = health
local basehp = 185
local baselvl = 8
local calchp = health - basehp
local calclvl = level - baselvl
local answer = calchp / calclvl
if (answer == 5) then
vocation = 'Druid or Sorcerer'
elseif (answer == 10) then
vocation = 'Paladin'
elseif (answer == 15) then
vocation = 'Knight'
else
vocation = 'Unknown'
end
return vocation
end
print(GetVocation(Self.Level(), Self.MaxHealth()))
If you want to save the value to a variable, just write:
local MyVocation = GetVocation(Self.Level(), Self.MaxHealth())
Aristeus
12-02-2015, 07:04 PM
Just calculate max hp. Will at least be a lot easier then, but mage will still either be druid or sorcerer.
Chose to do it through calculating health.
Changed the function a bit so you don't have to put in any values when you use it.
The prints were mostly just so that i could see that it was working.
function VocationDetection()
local HealthLevel = (Self.MaxHealth() - 185) / (Self.Level() - 8)
if (HealthLevel == 15) then
Vocation = Knight
print('Vocation: Knight')
end
if (HealthLevel == 10) then
Vocation = Paladin
print('Vocation: Paladin')
end
if (HealthLevel == 5) then
Vocation = Mage
print('Vocation: Mage')
end
end
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.