Lineage 2 Tower Forum

Full Version: Character Class check
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dodgy what is the right "if" script for check self class and do something?

i try use

    LUA Programming
Command("/target %self");
ShowToClient("Class", L2Class2String(GetTarget():GetClass()));
my_class = (GetTarget():GetClass());
Sleep(3000);
 
if (my_class == "Human Fighter") then
TargetNpc("NPC1", 10001);
end



and have no results

help me pls Confused
my_class = L2Class2String(GetTarget():GetClass());

If you don't have function L2Class2String, the return value is a number of that class instead of "Human Fighter"

Actually you don't need to target yourself to get your class.
You can try something like this:

    LUA Programming
ShowToClient("Class", L2Class2String(GetMe():GetClass()));
my_class = L2Class2String(GetMe():GetClass());
Sleep(3000);
 
if (my_class == "Human Fighter") then
TargetNpc("NPC1", 10001);

(01-10-2014 19:56 PM)SimonHM Wrote: [ -> ]my_class = L2Class2String(GetTarget():GetClass());

If you don't have function L2Class2String, the return value is a number of that class instead of "Human Fighter"

Actually you don't need to target yourself to get your class.
You can try something like this:

    LUA Programming
ShowToClient("Class", L2Class2String(GetMe():GetClass()));
my_class = L2Class2String(GetMe():GetClass());
Sleep(3000);
 
if (my_class == "Human Fighter") then
TargetNpc("NPC1", 10001);


ty. but i solve problem without L2Class2String and find classes ID , its easy way
yah, sure.
The L2Class2String sometime return the name like this "Orc Fighter."
(Some classes have the extra dot "." in the end of name class when using L2Class2String function)
Reference URL's