82 lines
2.9 KiB
Plaintext
82 lines
2.9 KiB
Plaintext
//////////////////////////////////////////////////////////////////////////
|
|
// Dwarven Altar
|
|
// By Deva Bryson Winblood. 12/29/2003
|
|
//////////////////////////////////////////////////////////////////////////
|
|
#include "hos_alignment"
|
|
void fnCreateNew(location lLoc,string sResRef)
|
|
{ // create new unit
|
|
object oWP=GetWaypointByTag("DWF_RESOURCES");
|
|
object oTemp=GetObjectByTag("DWF_PROXY");
|
|
object oNew=CreateObject(OBJECT_TYPE_CREATURE,sResRef,lLoc);
|
|
SetLocalString(oNew,"sTeamID","DWF");
|
|
ChangeFaction(oNew,oTemp);
|
|
} // fnCreateNew()
|
|
|
|
|
|
void main()
|
|
{
|
|
object oPC=GetLastUsedBy();
|
|
object oNearM=GetNearestObjectByTag("slave1");
|
|
object oNearF=GetNearestObjectByTag("slave2");
|
|
int nAGE=GetAlignmentGoodEvil(oPC);
|
|
int nALC=GetAlignmentLawChaos(oPC);
|
|
effect eLightning=EffectVisualEffect(VFX_IMP_LIGHTNING_M);
|
|
effect eDmg=EffectDamage(d8(2),DAMAGE_TYPE_ELECTRICAL);
|
|
string sID=GetLocalString(oPC,"sTeamID");
|
|
object oSlave;
|
|
object oNew;
|
|
location lLoc;
|
|
int nR;
|
|
string sRes;
|
|
int nGender;
|
|
float fDist=GetDistanceBetween(OBJECT_SELF,oSlave);
|
|
object oMod=GetModule();
|
|
int nEP=GetLocalInt(oMod,"nEvilPower");
|
|
if (oNearM!=OBJECT_INVALID) oSlave=oNearM;
|
|
else if (oNearF!=OBJECT_INVALID) oSlave=oNearF;
|
|
if (sID=="DWF")
|
|
{ // correct team to use the altar
|
|
if ((nAGE==ALIGNMENT_NEUTRAL&&nALC==ALIGNMENT_NEUTRAL)||nAGE==ALIGNMENT_GOOD)
|
|
{ // allowed alignment
|
|
fDist=GetDistanceBetween(OBJECT_SELF,oSlave);
|
|
if (oSlave!=OBJECT_INVALID&&fDist<10.0)
|
|
{ // slave available
|
|
SendMessageToPC(oPC,"You have freed a slave and trained them.");
|
|
AdjustAlignmentPartyProtected(oPC,ALIGNMENT_GOOD,5);
|
|
AdjustAlignmentPartyProtected(oPC,ALIGNMENT_LAWFUL,5);
|
|
nEP=nEP-5;
|
|
if (nEP<1) nEP=0;
|
|
SetLocalInt(oMod,"nEvilPower",nEP);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eLightning,oSlave,1.0);
|
|
lLoc=GetLocation(oSlave);
|
|
nGender=GetGender(oSlave);
|
|
DelayCommand(2.0,DestroyObject(oSlave));
|
|
nR=d100();
|
|
if (nR<86)
|
|
{ // normal
|
|
sRes="exslvf";
|
|
if (nGender!=GENDER_FEMALE) sRes="exslvm";
|
|
} // normal
|
|
else
|
|
{ // advanced training
|
|
sRes="exslvf2";
|
|
if (nGender!=GENDER_FEMALE) sRes="exslvm2";
|
|
} // advanced training
|
|
DelayCommand(2.1,ApplyEffectAtLocation(DURATION_TYPE_INSTANT,eLightning,lLoc,1.0));
|
|
DelayCommand(2.2,fnCreateNew(lLoc,sRes));
|
|
} // slave available
|
|
else
|
|
{ // no slave
|
|
SendMessageToPC(oPC,"No slave is near the altar to be freed and trained.");
|
|
} // no slave
|
|
AssignCommand(oPC,ClearAllActions());
|
|
AssignCommand(oPC,ActionStartConversation(oPC,"altar_good",TRUE,FALSE));
|
|
} // allowed alignment
|
|
else
|
|
{ // corrupted
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eLightning,oPC,1.0);
|
|
ApplyEffectToObject(DURATION_TYPE_INSTANT,eDmg,oPC,1.0);
|
|
} // corrupted
|
|
} // correct team to use the altar
|
|
}
|