by
RudgerWolvram
» 06 Feb 2015, 00:43
It's "possible" and SKuDD3r is on the right track, however you were asking about skill lose, not alignment loss.
The problem with setting character attributes, like skills, while the character is logged in is the server process keeps those in memory.
For example, I have character X, they have 20 skill in forestry. I manually set their skill in the DB while they are logged in to 60. They go and pick a branch or plant a tree, now their skill in forestry is 20.563.
So in order for it to work, once the character died, you could trigger on the skill table update and check the char_death log table for recent death (within 10 seconds) of the Time column. Then check the characters alignment to see if it's positive. You could also do a multiplier. say their skill is between 0 and 15, then multiply the skill loss by .5 to reduce the loss by half, if 16-30, then .25 to reduce by 75%, etc.
Anyway, once the trigger modifies the skill values, the player will need to not do anything with those skills and re-log in order for them to take effect.
So yes, it's possible, just requires the players to do something.
Also, in the midst of battles, it won't be that effective. If they lose skill in 1h swords, and they run back, re-equip and jump back into the fight and hit someone with a sword, the server will undo what the trigger is attempting since they didn't re-log.