////////////////////////////////////////////////////////////////////// // Real Time Strategy - NWN - Faction Choose - OnEnter //=================================================================== // By Deva Bryson Winblood. 02/23/2003 ////////////////////////////////////////////////////////////////////// void fnSetFactionToFriendly(object oPC,string sID) { // Set faction that you control to friendly object oMember=GetObjectByTag(sID+"_PROXY"); if (oMember!=OBJECT_INVALID) { // !OI AdjustReputation(oPC,oMember,100); } // !OI else { SendMessageToPC(oPC,"CRITICAL AREA: A creature placed with tag "+sID+"_PROXY could not be found and is required to set faction you control to friendly!!!"); } } // fnSetFactionToFriendly() void main() { object oPC=GetEnteringObject(); string sTeamID=GetName(OBJECT_SELF); int nTeamNum=StringToInt(GetStringRight(sTeamID,1)); sTeamID=GetStringLeft(sTeamID,GetStringLength(sTeamID)-1); object oMod=GetModule(); object oTeamLead=GetLocalObject(oMod,"oTeamLead"+sTeamID); object oWP=GetWaypointByTag("ABORT_"+sTeamID); string sTeamName=GetLocalString(oPC,"sTeamID"); effect eGhost=EffectVisualEffect(VFX_DUR_GLOBE_INVULNERABILITY); object oDoor=GetObjectByTag("DOOR_"+sTeamID); if (oTeamLead==OBJECT_INVALID&&GetStringLength(sTeamName)<1) { // You are now the leader SetLocalObject(oMod,"oTeamLead"+sTeamID,oPC); SetLocalInt(oMod,"n"+sTeamID+"Num",nTeamNum); SetLocalInt(oPC,"nTeamNum",nTeamNum); SetLocalString(oPC,"sTeamID",sTeamID); fnSetFactionToFriendly(oPC,sTeamID); AddJournalQuestEntry(sTeamID,1,oPC,FALSE,FALSE); AddJournalQuestEntry(sTeamID+"UNITS",1,oPC,FALSE,FALSE); SendMessageToPC(oPC,"You have taken control of the team with the ID:"+sTeamID); DelayCommand(1.0,ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eGhost,oPC,10.0)); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,JumpToObject(oWP)); AssignCommand(oDoor,ActionCloseDoor(oDoor)); AssignCommand(oDoor,ActionDoCommand(SetLocked(oDoor,TRUE))); AssignCommand(oDoor,ActionSpeakString("*click*")); ExecuteScript("adjust_alignment",oPC); } // You are now the leader else if (GetStringLength(sTeamName)>0) { // you already command a team SendMessageToPC(oPC,"You have already chosen a team and cannot choose another."); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,JumpToObject(oWP)); } // you already command a team else { // this team already has a leader SendMessageToPC(oPC,"This team already has a leader. Choose a different one."); AssignCommand(oPC,ClearAllActions()); AssignCommand(oPC,JumpToObject(oWP)); } // this team already has a leader }