Page 1 of 1

Race vs Race_Type

Posted: Sun Aug 31, 2008 10:57 pm
by John Adams
I think we're going to need a LUA function to check Player Character race (the 0 through 18 values). When I look up distinct race,race_type records in my character table, I am finding that every "race" value seem to have many "race_type" values for player characters. I therefore cannot see using GetRaceType(Spawn) to determine the player characters race for such things as racial zoning (leaving the islands) or armor quests etc.
Example, for race 2 (Dwarf), I have the following race_types, and I do not understand why:
109
110
1477
1478
1479
1480
1482
1483
1484
Is this because when you are creating your character, you are picking - what, different features? Or are these "race_types" showing up because of class? Either way, I cannot very well build if/then statements for all those race_types just to determine you are a dwarf, so I can send you to Qeynos instead of Kelethin (just an example, don't worry about the specifics Tyr ~grin~).
See what I mean? Or do I not get how race_types can simply map back to player races?
Thanks

Posted: Sun Aug 31, 2008 11:30 pm
by ZexisStryfe
Well, I can partially answer this.
109
110
1477
1478
1479
1480
1482
1483
1484
These numbers are actually the model IDs for dwarf depending on male/female or what tattoo they have.
As for a LUA function to check race, there should definately be one, however the need for this goes further than just Player Races. This function is necessary for the Master Strikes as well, so the function might as well determine general race (dwarf, bixie, vampire, human, etc.) instead of just player race. No point in making 2 functions if only one is necessary. To this effect there should probably also be a races table so we can define the races ourselves...

Posted: Mon Sep 01, 2008 12:01 am
by John Adams
Oh yeah... I guess male/female would be the same race, but a different race_type (tee hee). I didn't think of that. As for tats, I thought all that was handled by appearances, but I guess not.
I do agree though, we need a race-detecting LUA. I knew I didn't know all the applications yet, so keep them ideas/theories coming.

Posted: Mon Sep 01, 2008 12:16 am
by ZexisStryfe
The way eq2 handles model skins is... odd. In eq1 one model had multiple skins. In eq2 each skin is treated as a separate model. Because of this, each tattoo/scar/woad/etc for each race that can have them is a separate model, causeing like 10 different "dwarf models" and over 30 different "erudite models". Its not like hair, beards, piercings and wings that work like addons.

Posted: Mon Sep 01, 2008 2:46 pm
by John Adams
Ok, then I am moving this to Feature Requests, but hoping to bump it up above the trivial features we might have asked for before - as this impacts various scripting if we cannot determine the players race.
These are the times I wish I knew how to code, cuz I could probably add support for my little whinings like this. Maybe I'll take a look into it anyway. How hard can it be? ~grin LE~

Posted: Thu Oct 09, 2008 8:15 am
by Jabantiz
Don't know if this is still needed but I attempted to code this and it seems to work for me, I have only tested it on players, should work for npc's if their race field is correct in the DB.
GetRace(Spawn) - Returns the ID of the race(1 for Dark Elf, 0 for Barbarian, etc.)
In LuaFunctions.cpp add this at line 759, right above EQ2Emu_lua_GetRaceType

Code: Select all

int EQ2Emu_lua_GetRace(lua_State* state){
	Spawn* spawn = lua_interface->GetSpawn(state);
	if(spawn){
		lua_interface->SetInt32Value(state, spawn->GetRace());
		return 1;
	}
	return 0;
}
In LuaFunctions.h add this at line 56, again right above EQ2Emu_lua_GetRaceType

Code: Select all

int EQ2Emu_lua_GetRace(lua_State* state);
And finally in LuaInterface.cpp add this at line 393, above the GetRaceType one

Code: Select all

lua_register(state, "GetRace", EQ2Emu_lua_GetRace);
This was not in the latest svn revision(151) and is needed for some scripting so thought I would post this for whoever needs it.
**EDIT**
Here are the links to the patch files.
LuaFunctions.h
LuaFunctions.cpp
LuaInterface.cpp

Posted: Sat Oct 11, 2008 6:05 am
by LethalEncounter
Good job! I have added them to the source.