[DiscordArchive] You have two onLogin functions.
[DiscordArchive] You have two onLogin functions.
Archived author: Aldori • Posted: 2025-09-09T14:17:58.573000+00:00
Original source
You have two onLogin functions.
You should also look into mapping those spell IDs to a table and then loop through that table for removing the racials. Something like RACIALS_TO_REMOVE. That way you don’t need to write out RemoveSpell a bunch of times. It’s a lot of duplicate code.
Also, are you wanting/meaning to delete & relearn the racial spells on each login?
![[Image: image.png?ex=690c0725&is=690ab5a5&hm=08c...56ced8d02&]](https://cdn.discordapp.com/attachments/448835144564867094/1414980083818434742/image.png?ex=690c0725&is=690ab5a5&hm=08cef7b52988ddeda896c7f54bd1445c37b9fa4a26bd11cc310968f56ced8d02&)
Archived author: Band • Posted: 2025-09-09T14:25:41.205000+00:00
Original source
That is a great point... I should probably just create a table like the original mod does and do that. I could even store the variables in a table as well. I guess I was trying to do everything in the script since it was easier to manage at a glance.
The reason why is that currently there is an issue with the mod that causes racials to be reverted back to their defaults when the character logs back in. It is tied to this setting in the worldserver config. I was scared to turn that off because it could cause issues itself and I believe the Playerbots module uses spell validation a lot
![[Image: image.png?ex=690c0725&is=690ab5a5&hm=08c...56ced8d02&]](https://cdn.discordapp.com/attachments/448835144564867094/1414980083818434742/image.png?ex=690c0725&is=690ab5a5&hm=08cef7b52988ddeda896c7f54bd1445c37b9fa4a26bd11cc310968f56ced8d02&)
Archived author: Aldori • Posted: 2025-09-09T14:35:21.334000+00:00
Original source
Also if I’m not mistaken, the RemoveSpell function should also remove the known spell from the character_spell table so you probably don’t need to call both dbCleanRacials and removeAllRacials functions.
Or a better approach would be to first add a check if the player knows said spell before attempting to remove it. You can just loop through the spell IDs if you map them to a table
if player:HasSpell() then player:RemoveSpell().
Archived author: Band • Posted: 2025-09-09T14:39:08.604000+00:00
Original source
I originally attempted with just using the RemoveSpell function but ran into the SQL Insert issue from before, only after including the character_spell table deletes did it stop. It was weird and would revert my player back to its original state after logging out because the validation failed
Archived author: Aldori • Posted: 2025-09-09T14:43:06.533000+00:00
Original source
Gotcha. Probably a weird scenario with that config setting then.
So what I would do then is just add the check for if the player knows the spell prior to calling RemoveSpell. Map all of those IDs to the table and through it.
Also don’t forget about the second onLogin function. You might get weird issues with that
Archived author: Band • Posted: 2025-09-09T14:43:58.202000+00:00
Original source
Yea I removed that, it was an error of mine. Thanks for catching it
Do you foresee many database issues using this method? I am already working on creating the sql table to store the variables for the player and the racial spell IDs
Archived author: Aldori • Posted: 2025-09-09T14:45:35.369000+00:00
Original source
Oh you don’t need to create a sql table. I meant a local table in the script. Otherwise you’ll be adding an extra DB call to get those
Archived author: Band • Posted: 2025-09-09T14:45:54.465000+00:00
Original source
Ohhhhhhhhhh... I have no idea how to do that
Archived author: Aldori • Posted: 2025-09-09T14:46:04.434000+00:00
Original source
You see “local NAME_TO_RACE = {“ near the top?
That’s a table.
Archived author: Aldori • Posted: 2025-09-09T14:46:46.550000+00:00
Original source
So you’d make a SPELLS_TO_REMOVE = { x, y, z }