//////////////////////////////////////////////////////////////////////////////// // hos_alignment - Harvest of Souls - Alignment Shift fix // By Deva Bryson Winblood. 10/8/2004 //////////////////////////////////////////////////////////////////////////////// //////////////////////////////// // PROTOTYPES //////////////////////////////// // FILE: hos_alignment FUNCTION: AdjustAlignmentPartyProtected() // This function will allow you to shift the alignment of a target and only // team/party members that can perceive him/her when the event occurs will // also be shifted. This protects party members from having their alignment // shifted by actions they could not perceive or disuade. // - oSubject // - nAlignment: // -> ALIGNMENT_LAWFUL/ALIGNMENT_CHAOTIC/ALIGNMENT_GOOD/ALIGNMENT_EVIL: oSubject's // alignment will be shifted in the direction specified // -> ALIGNMENT_ALL: nShift will be added to oSubject's law/chaos and // good/evil alignment values // -> ALIGNMENT_NEUTRAL: nShift is applied to oSubject's law/chaos and // good/evil alignment values in the direction which is towards neutrality. // e.g. If oSubject has a law/chaos value of 10 (i.e. chaotic) and a // good/evil value of 80 (i.e. good) then if nShift is 15, the // law/chaos value will become (10+15)=25 and the good/evil value will // become (80-25)=55 // Furthermore, the shift will at most take the alignment value to 50 and // not beyond. // e.g. If oSubject has a law/chaos value of 40 and a good/evil value of 70, // then if nShift is 15, the law/chaos value will become 50 and the // good/evil value will become 55 // - nShift: this is the desired shift in alignment // * No return value void AdjustAlignmentPartyProtected(object oSubject, int nAlignment, int nShift); //////////////////////////////// // FUNCTIONS //////////////////////////////// // FUNCTIONS TO USE: // AddToParty() // RemoveFromParty() // AdjustAlignment() // GetIsPC() // GetObjectSeen() // GetCurrentAction() // GetNearestCreature() // GetFirstFactionMember() // GetNextFactionMember() int fnIsAnyoneResting(object oMember) { // RETURN: TRUE if anyone on this faction is resting int bRet=FALSE; object oFaction=GetFirstFactionMember(oMember); while(GetIsObjectValid(oFaction)&&bRet==FALSE) { // check each member if (GetCurrentAction(oFaction)==ACTION_REST&&oFaction!=oMember) bRet=TRUE; oFaction=GetNextFactionMember(oMember); } // check each member return bRet; } // fnIsAnyoneResting() void fnRejoinFaction(object oSubject, object oLeader) { // PURPOSE: Put the PC back on the team /*if (fnIsAnyoneResting(oLeader)) { // delay and recurse DelayCommand(2.0,fnRejoinFaction(oSubject,oLeader)); } // delay and recurse else { // rejoin */ AddToParty(oSubject,oLeader); //} // rejoin } // fnRejoinFaction() void fnAdjustAlignment(object oSubject, int nAlignment, int nShift) { // PURPOSE: Called for individual members object oLeader; /*if (fnIsAnyoneResting(oSubject)) { // delay and recurse DelayCommand(2.0,fnAdjustAlignment(oSubject,nAlignment,nShift)); } // delay and recurse else { // do it*/ oLeader=GetFirstFactionMember(oSubject); if (oLeader==oSubject) oLeader=GetNextFactionMember(oSubject); RemoveFromParty(oSubject); AdjustAlignment(oSubject,nAlignment,nShift); if (GetIsObjectValid(oLeader)) fnRejoinFaction(oSubject,oLeader); //} // do it } // fnAdjustAlignment() void AdjustAlignmentPartyProtected(object oSubject, int nAlignment, int nShift) { // PURPOSE: Handle Alignment shift in a protected manner /*object oPC=GetFirstFactionMember(oSubject); while(GetIsObjectValid(oPC)) { // check to see if anyone can see you if (oPC!=oSubject&&GetObjectSeen(oSubject,oPC)) { // can see SendMessageToPC(oPC,"Your alignment has been shifted due to actions of "+GetName(oSubject)+"."); DelayCommand(1.0,fnAdjustAlignment(oPC,nAlignment,nShift)); } // can see oPC=GetNextFactionMember(oSubject); } // check to see if anyone can see you DelayCommand(0.5,fnAdjustAlignment(oSubject,nAlignment,nShift));*/ AdjustAlignment(oSubject,nAlignment,nShift); } // AdjustAlignmentPartyProtected() //void main(){}