Refreshing Character Alignment In Game

Place for sharing your game modifications for Life is Feudal: Your Own
User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Refreshing Character Alignment In Game

Post by Azzerhoden » 06 Aug 2015, 02:30

I've been playing around with a new trigger to adjust the alignment penalties when a criminal act is committed. The trigger is functioning correctly, but I noticed that the alignment value in game does not update to reflect this.

Is there a server command that can be run from the command line to refresh a players GUI?
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!


Alakar
Beta Tester
 
Posts: 202
Joined: 23 Jan 2015, 07:39

Re: Refreshing Character Alignment In Game

Post by Alakar » 06 Aug 2015, 20:45

The game sever only queries the character's alignment when the character first logs in and is created.

-Alakar

User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Re: Refreshing Character Alignment In Game

Post by Azzerhoden » 07 Aug 2015, 23:14

Alakarsiann wrote:The game sever only queries the character's alignment when the character first logs in and is created.

-Alakar


Right, which causes some side issues.

Anyhow, I've added the following trigger to reduce the impact to alignment penalties.

Code: Select all
CREATE DEFINER=`root`@`localhost` TRIGGER `character_alignment_fix` BEFORE UPDATE ON `character` FOR EACH ROW BEGIN
   set @diff = ABS(new.Alignment) - ABS(old.Alignment);
   IF (new.Alignment < old.Alignment) then
      IF (@diff < 10000000) then
         set new.Alignment = old.Alignment;
      ELSE
         set new.Alignment = new.Alignment + (@diff/2) ;
      END IF;
   END IF;
END


This makes alignment hits for knock out, looting, trespassing, and initial attacks not apply an alignment penalty in the database. You will still have it in game, until you log out and back in.

In addition, praying will not raise your alignment until both client and database are back in sync. Death will apply the penalty as it exists in the client at the moment death occurs.
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!


Alakar
Beta Tester
 
Posts: 202
Joined: 23 Jan 2015, 07:39

Re: Refreshing Character Alignment In Game

Post by Alakar » 08 Aug 2015, 00:08

Nice, I've just been logging all alignment changes for each character since the server start trying to figure out what to do lol.

-Alakar

User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Re: Refreshing Character Alignment In Game

Post by Azzerhoden » 08 Aug 2015, 16:05

Actually, I changed it up, and am going with the following:
Code: Select all
CREATE DEFINER=`root`@`localhost` TRIGGER `character_alignment_fix` BEFORE UPDATE ON `character` FOR EACH ROW BEGIN
   IF (new.LastTimeUsedPraiseYourGodAbility > 0) THEN
      set new.LastTimeUsedPraiseYourGodAbility = 0;
   END IF;
END


This will allow players to repeatedly pray to raise alignment, without having the issues of different values in the client and database
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!

User avatar
Custodian
Mod Developer
 
Posts: 655
Joined: 08 Jun 2015, 14:58
Location: Lisbon

Re: Refreshing Character Alignment In Game

Post by Custodian » 08 Aug 2015, 16:42

Azzerhoden wrote:This makes alignment hits for knock out, looting, trespassing, and initial attacks not apply an alignment penalty in the database. You will still have it in game, until you log out and back in.

There are default variables, which you can alter at server config to do this
Spoiler

Change them, and it would affect you ingame. Numbers are alignment loss/gain for the action.

Update: Seems like those variabes does not work (checked).

Return to Game mods