Areas and Fixes
Added CCOH and missing areas Changed some areas to be craftable, Fixed some on death issues, Fixed the Gaurd
This commit is contained in:
78
_module/nss/werewolf_friends.nss
Normal file
78
_module/nss/werewolf_friends.nss
Normal file
@@ -0,0 +1,78 @@
|
||||
// Makes werewolves friendly to entering werewolf PCs.
|
||||
void were_wolf_friend(object oPC)
|
||||
{
|
||||
//Get area.
|
||||
object oArea = GetArea(oPC);
|
||||
//Get first object in area.
|
||||
object oNPC = GetFirstObjectInArea(oArea);
|
||||
//As long as objects are valid. Do following.
|
||||
|
||||
PrintString("werewolf_friends: were_wolf_friend() called by " + GetName(oPC) + " in "+GetName(oArea)+" ... makes werewolves friendly to the aforementioned werewolf in this area.");
|
||||
|
||||
while(oNPC != OBJECT_INVALID)
|
||||
{
|
||||
// if the thing is a creature, continue wasting CPU time
|
||||
if (GetObjectType(oNPC)==OBJECT_TYPE_CREATURE)
|
||||
{
|
||||
// PrintString("werewolf_friends: were_wolf_friend() called by " + GetName(oPC) + " - "+GetName(oNPC)+" is a creature, but is it a werewolf?");
|
||||
// If object is a lycanthrop and hostile towards the PC werewolf.
|
||||
if (GetTag(oNPC)=="PCwerewolf" && GetIsEnemy(oPC,oNPC) == TRUE)
|
||||
{
|
||||
PrintString("werewolf_friends: were_wolf_friend() called by " + GetName(oPC) + " - "+GetName(oNPC)+" is a werewolf and is an enemy of the PC, so will now be made a friend.");
|
||||
// Make object friendly towards werewolf.
|
||||
SetIsTemporaryFriend(oPC, oNPC);
|
||||
}
|
||||
}
|
||||
//Take next object.
|
||||
oNPC = GetNextObjectInArea(oArea);
|
||||
}
|
||||
}
|
||||
|
||||
//Makes entering npc friendly towards every werewolf PC on module.
|
||||
void ww_npcfriend(object oNPC)
|
||||
{
|
||||
PrintString("werewolf_friends: ww_npcfriend() called by " + GetName(oNPC) + "... makes all PC's with AFF_WEREWOLF==1 friendly to this NPC.");
|
||||
//Take first player from player list.
|
||||
object oPC = GetFirstPC();
|
||||
//Do following until whole player list is studied.
|
||||
while(oPC != OBJECT_INVALID)
|
||||
{
|
||||
//If player is a werewolf.
|
||||
if(GetLocalInt(oPC,"AFF_WEREWOLF") == 1)
|
||||
{
|
||||
//Make npc(werewolf) friendly towards pc.
|
||||
SetIsTemporaryFriend(oPC, oNPC);
|
||||
PrintString("werewolf_friends: were_wolf_friend() called by " + GetName(oNPC) + " - "+GetName(oPC)+" is Werewolf PC, so will now be made a friend of the NPC.");
|
||||
}
|
||||
//Take next pc from list.
|
||||
oPC = GetNextPC();
|
||||
}
|
||||
}
|
||||
|
||||
//Checks who is entering.
|
||||
void werewolf_friends(object oCreature)
|
||||
{
|
||||
object oMod = GetModule();
|
||||
string sArea = GetName(GetArea(oCreature));
|
||||
|
||||
// PrintString("werewolf_friends: called by " + GetName(oCreature) + " GetRacialType["+IntToString(GetRacialType(oCreature))+"] in area '"+sArea+"'.");
|
||||
|
||||
// If entering object is pc and AFF_WEREWOLF==1.
|
||||
// Make every Werewolf(NPC) on area friendly towards entering Werewolf(PC).
|
||||
if ((GetLocalInt(oCreature,"AFF_WEREWOLF") == 1)&&GetIsPC(oCreature)==TRUE)
|
||||
{
|
||||
were_wolf_friend(oCreature);
|
||||
}
|
||||
|
||||
// If entering object is werewolf and it is not pc or dm.
|
||||
// Make werewolf friendly towards every werewolf on module.
|
||||
if (GetTag(oCreature)=="PCwerewolf" && GetIsPC(oCreature)==FALSE && GetIsDM(oCreature) == FALSE)
|
||||
{
|
||||
// We should do this BEFORE we destroy werewolf spawns triggered by werewolf PCs
|
||||
// because otherwise existing werewolves in the area are not made friends.
|
||||
// Better to waste time making friends with things that are about to be
|
||||
// destroyed than have werewolves randomly attack a werewolf(PC) because he stepped
|
||||
// on a werewolf spawn the moment he came in.
|
||||
ww_npcfriend(oCreature);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user