HiddenTradition_PRC8/_module/nss/ro_pvp_redflag.nss
2024-06-20 15:47:42 -04:00

60 lines
1.3 KiB
Plaintext

void main()
{
object oPC = GetLastUsedBy();
string sName = GetName(oPC);
string sFlag = GetName (OBJECT_SELF);
effect eBlueFlag;
effect eRedFlag;
eBlueFlag = SupernaturalEffect(EffectVisualEffect(VFX_DUR_FLAG_BLUE));
eRedFlag = SupernaturalEffect(EffectVisualEffect(VFX_DUR_FLAG_RED));
if (!GetIsPC(oPC)) return;
//if PC is stealing flag, sets FX and variable
if (GetLocalInt(oPC, "BlueTeam") == 1)
{
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRedFlag, oPC);
SetLocalInt(oPC, "HasFlag", 1);
SendMessageToAllDMs (" "+ sName +" has stolen the "+ sFlag +" ");
return;
}
//check if PC is not a member of any team, and asks if they want to join one
if (GetLocalInt(oPC, "RedTeam") != 1)
{
AssignCommand(OBJECT_SELF, ActionStartConversation(oPC, ""));
return;
}
//rewards PC if delivers opposing flag
if (GetLocalInt(oPC, "HasFlag") == 1)
{
SendMessageToAllDMs (" "+ sName +" has delivered the enemy flag! ");
SetLocalInt (oPC, "HasFlag", 0);
//gives PC a score marker
CreateItemOnObject("scoreartifact", oPC);
//removes flag effect
effect eLoop=GetFirstEffect(oPC);
while (GetIsEffectValid(eLoop))
{
if (GetEffectType(eLoop)==EFFECT_TYPE_VISUALEFFECT)
RemoveEffect(oPC, eLoop);
eLoop=GetNextEffect(oPC);
}
}
}