So I have set up opposition groups for the wildlife on my server. This way the carnivores hunt and kill the herbivores and weaker prey based similarly on what they would eat in the wild. There are a few things I would like to do. The first is somehow add a hunger measurement to the animals. The hungrier they are the higher chance they have of attacking their prey animals. I think this could be done using a switch that changes their FightMode from "Aggresor" to "Closest" at a certain hunger level. Thus switching on their aggression to their opposition group. Additionally when they do kill their prey animal they should fill their hunger back up just like when a player eats a food item. Also switching their FightMode back to "Aggressor" turning off their opposition aggression. Possibly displaying an overhead message similar to when a monster loots a corpse but instead it says something like * you see the animal eat its prey*
As of right now I am using
to try to balance out the amount of animals that are hunting. This helped but the animals that spawn are still hunting way too much. Basically 50% of the animals that spawn are hunting constantly. There are corpses all over the place. As soon as a prey animal spawns it is attacked and killed by surrounding carnivorous animals.
Also they were attacking players even though humans were not part of their opposition when their fightmode is set to "closest". I have added
and this seems to work well but is there a better way to do this? Here is a sample of how my animals are set up. Any help with working out the ideas mentioned above would be greatly appreciated.
As of right now I am using
C#:
FightMode = Utility.RandomBool() ? FightMode.Closest : FightMode.Aggressor;
Also they were attacking players even though humans were not part of their opposition when their fightmode is set to "closest". I have added
C#:
public override bool IsEnemy( Mobile m )
{
if ( m.BodyValue == 400 || m.BodyValue == 401 )
return false;
return base.IsEnemy( m );
}
C#:
using System;
using Server.Mobiles;
namespace Server.Mobiles
{
[CorpseName( "a grizzly bear corpse" )]
[TypeAlias( "Server.Mobiles.Grizzlybear" )]
public class GrizzlyBear : BaseCreature
{
[Constructable]
public GrizzlyBear() : base( AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4 )
{
Name = "a grizzly bear";
Body = 212;
BaseSoundID = 0xA3;
Tag = "Animal";
FightMode = Utility.RandomBool() ? FightMode.Closest : FightMode.Aggressor;
SetStr( 126, 155 );
SetDex( 81, 105 );
SetInt( 16, 40 );
SetHits( 127, 155 );
SetMana( 0 );
SetDamage( 8, 13 );
SetDamageType( ResistanceType.Physical, 100 );
SetResistance( ResistanceType.Physical, 25, 35 );
SetResistance( ResistanceType.Cold, 15, 25 );
SetResistance( ResistanceType.Poison, 5, 10 );
SetResistance( ResistanceType.Energy, 5, 10 );
SetSkill( SkillName.MagicResist, 25.1, 40.0 );
SetSkill( SkillName.Tactics, 70.1, 100.0 );
SetSkill( SkillName.Wrestling, 45.1, 70.0 );
Fame = 1000;
Karma = 0;
VirtualArmor = 24;
Tamable = true;
ControlSlots = 1;
MinTameSkill = 70.0;
}
public override void GenerateLoot()
{
//AddLootPouch(LootPack.PoorPouch);
AddLoot(LootPack.OldDirtPoor);
}
public override bool CanRummageCorpses{ get{ return true; } }
public override int Meat{ get{ return 10; } }
public override int Fur{ get{ return 16; } }
public override FoodType FavoriteFood{ get{ return FoodType.Fish | FoodType.FruitsAndVegies | FoodType.Meat; } }
public override PackInstinct PackInstinct{ get{ return PackInstinct.Bear; } }
public override bool AlwaysMurderer { get { return true; } }
public override OppositionGroup OppositionGroup
{
get{ return OppositionGroup.Bears; }
}
public override bool IsEnemy( Mobile m )
{
if ( m.BodyValue == 400 || m.BodyValue == 401 )
return false;
return base.IsEnemy( m );
}
public GrizzlyBear( Serial serial ) : base( serial )
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize( writer );
writer.Write( (int) 0 );
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}
Last edited: