easiest way is probably to use player quest and a spell. For example, call if blessing of the kings with the stat buff. then, have it check for faction and/or global. With a global of "FactionA" (triggered with the turn in), but also the option of having FactionB and FactionC(not triggered), let the spell = 9000 in this example and faction_id = 600, 601, and 602 respectively:
player.pl in template folder
Code:
sub EVENT_ENTERZONE {
quest::settimer("check",1);
}
sub EVENT_TIMER {
my $factioncheck = undef;
if ($qglobals{kingdomfaction} ) { #global is defined
if ($qglobals{kingdomfaction} eq "FactionA") { #FactionA has control
$factioncheck = $client->GetCharacterFaction(600);
if ($factioncheck >= 850) { #FactionA and character faction over 850
if (!$client->FindBuff(9000)) { #No Buff? Then cast
quest::selfcast(9000);
}
}
else {
if ($client->FindBuff(9000)) { #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}
elsif ($qglobals{kingdomfaction} eq "FactionB") {
$factioncheck = $client->GetCharacterFaction(601);
if ($factioncheck >= 850) { #FactionB and character faction over 850
if (!$client->FindBuff(9000)) { #No Buff? Then cast
quest::selfcast(9000);
}
}
else {
if ($client->FindBuff(9000)) { #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}
elsif($qglobals{kingdomfaction} eq "FactionC") {
$factioncheck = $client->GetCharacterFaction(602);
if ($factioncheck >= 850) { #FactionA and character faction over 850
if (!$client->FindBuff(9000)) { #No Buff? Then cast
quest::selfcast(9000);
}
}
else {
if ($client->FindBuff(9000)) { #Has buff but not enough faction. Fade buff
$client->BuffFadeBySpellID(9000);
}
}
}
}
else {
if ($client->FindBuff(9000)) { #Global not set but has buff
$client->BuffFadeBySpellID(9000);
}
}
}
Variations could also be used such as checking a player's global value (pledging alliance to a kingdom) or for an item. Several possibilities. If that doesn't work for you, let me know.
Another possibility is to use the quest::setstat command (I think that is it), but that could be more tricky.
The other possibility that I know of would simply be using a database query and updating values in the quest script (or adding a command). I really do not think that is optimal. It'd have the query in it though as UPDATE character format for typical sql update. I think you'd have to update blob file so could be a tad bit tricky. If you really really wanted to do it this way, let me know and I'll help you;p I do suggest one of the other methods though.
Edited--Since you mentioned you haven't really used quest globals, you'd need to have the hand in trigger the "flag". So in your king script when a player turns in the item, you would need to do like a quest::setglobal("kingdomfaction","FactionA",7,"F" ) in your event turn-in where FactionA is the value of the variable (just that it is defined) and 7 is for all players for the variable named kingdomfaction.