78 lines
2.1 KiB
Plaintext
78 lines
2.1 KiB
Plaintext
////////////////////////////////////////////////////////////////////////////////
|
|
//
|
|
// Allegiance System
|
|
// opw_pc_align
|
|
// By Don Anderson
|
|
// dandersonru@msn.com
|
|
//
|
|
// Aligns Player with Specific Faction
|
|
//
|
|
// This is placed in the OnUsed Event of a Sign
|
|
//
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "opw_inc_pstat"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastUsedBy();
|
|
object oAlign = OBJECT_SELF;
|
|
string sName = GetName(oAlign);
|
|
string sAlign = GetTag(oAlign);
|
|
|
|
if(GetIsDM(oPC) == TRUE) return;
|
|
|
|
//Already has Allegiance
|
|
int nAllege = GetLocalInt(oPC,"FACTION");
|
|
if(nAllege > 0)
|
|
{
|
|
if(nAllege == 1) SpeakString("You have already allied yourself with the forces of Good.");
|
|
if(nAllege == 2) SpeakString("You have already allied yourself with the forces of Evil.");
|
|
if(nAllege == 3) SpeakString("You have already allied yourself to be Neutral.");
|
|
return;
|
|
}
|
|
|
|
//Now for which Faction
|
|
string sFaction = GetStringLeft(sAlign,7);
|
|
if(sFaction == "FACTION")
|
|
{
|
|
string sFNumber = GetStringRight(sAlign,3);
|
|
int nFNumber = StringToInt(sFNumber);
|
|
|
|
if(nFNumber > 0)
|
|
{
|
|
//Faction Name can be anywhere in Name Field of Sign
|
|
int nEvil = FindSubString(sName,"Evil");
|
|
int nGood = FindSubString(sName,"Good");
|
|
int nNeutral = FindSubString(sName,"Neutral");
|
|
|
|
if(nEvil != -1)//Faction 1
|
|
{
|
|
AlignEvil(oPC);
|
|
SpeakString("You have allied yourself with the forces of Evil.");
|
|
NBDE_SetCampaignInt("ALLEGIANCE","FACTION",nFNumber,oPC);
|
|
SetLocalInt(oPC,"FACTION",1);
|
|
return;
|
|
}
|
|
|
|
if(nGood != -1)//Faction 2
|
|
{
|
|
AlignGood(oPC);
|
|
SpeakString("You have allied yourself with the forces of Good.");
|
|
NBDE_SetCampaignInt("ALLEGIANCE","FACTION",nFNumber,oPC);
|
|
SetLocalInt(oPC,"FACTION",2);
|
|
return;
|
|
}
|
|
|
|
if(nNeutral != -1)//Faction 3
|
|
{
|
|
AlignNeutral(oPC);
|
|
SpeakString("You have allied yourself to be Neutral in state affairs.");
|
|
NBDE_SetCampaignInt("ALLEGIANCE","FACTION",nFNumber,oPC);
|
|
SetLocalInt(oPC,"FACTION",3);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|