RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

BaseAnimal 2.0

Thagoras

Sorceror
BaseAnimal 2.0

BaseAnimal 2.0

This is the Update of BaseAnimal. I've made a number of changes to the original script...such as requires a new thread.

BaseAnimal is a package which allows for your animals to act more like animals. Deer run from players, wolves hunt deer. Bears steal your food and eat your crops. An so on.

2.0 brings a new element to the system. Animal Husbandry. You want to be a farmer? Now you can. I've included a number of farm animals, so to give examples on how this system can be used. Most of them have specific breeds. Cows, for example, have breeds for milk and meat. Sheep have milk, meat and wool breeds. They can be cross-bred but the best milk-givers are purebreds. Chickens lay eggs daily in nests.

Animals can also age now. They're born, they age, they reproduce and they die (unless they're killed before then).

This system should be backward compatible. A simple command will turn all current BaseAnimals into 2.0 compliant critters (otherwise they are babies). [global set update true where baseanimal (I think that's correct).

With this system, I've added a number of things. The various animals have different cuts of meat...which are all cookable. I've added a MilkingBucket, MilkKeg, ButterChurn, CreamPitcher, MeasuringCup. A number of these adds concern Vhaerun's Food system. I wasn't happy with how one made cream with the flour sifter from...not milk, but water. The measuring cup fixes this. The MilkKeg is where milk is collected after milking. Can be poured into pitchers from the keg, for drinking. Or the CreamPitcher can target the keg and skim cream. The Measuring cup may be targeted by either the keg or cream pitcher to get a cup of cream or milk. I made it to display the age of milk (loosely).

Wild animals are BaseAnimals that can be turned into mounts with the Bridle or pack horse/llama with the saddlebag. There are two distros here. Included just so when you release the pack animal, it shakes off its pack and becomes a wild animal again. (still need to work it out so it follows the rules of the WildHorses though).

Ranch. BIG add. Ranch Stone, Ranch Extension Deed, Fences, Gates, Fencing Hammer, Branding Iron and Fencing Kit. And of course a stockman (rancher) to sell ranch stuff.
The ranch stone is the heart of the ranch. Only the owner (the one who placed it) can access the gump. With the gump you can get the Fencing Hammer and Branding Iron. You can also transfer ownership of any branded animals to another player, transfer the ranch to another player, unlock (movable true) all the fences/gates, absorb a nearby ranch that you already own or redeed the ranch stone. When the stone is redeeded it unlocks all the fences of that ranch (fences placed with that fencing hammer) while leaving any neighboring fences locked. The ranchstone can only be placed in legal housing regions.

The branding iron works like this. When you first tame a baseanimal, you can brand it. You then become the owner of it and it displays your brand. When it produces offspring, if it's the mother, you retain ownership of those offspring, but your brand is gone. You may brand those offspring without first taming them. If you fail to brand them, and they produce offspring, you no longer own them and you must tame them to brand them.

When you reclaim an animal, if you're the owner, you automatically get control of it...as if you tamed it. I went under the assumption that you needed to tame it to begin with. Transfer Animal works about like this except you give the animal to another player.

The fencing hammer sets the fences and gates into the ground (so they don't decay). Both must be purchased from the Stockman or crafted with the Fencing Kit. Gates may only be opened by the owner of the ranch, to prevent his livestock from escaping.

And finally, the Mildred the Animal Trader. She doesn't actually sell any animals. I, um, couldn't figure out how to get her to sell all the different types of breeds. But she will buy them. I think the prices may be a bit low (especially since some of them are resource producers) but you can easily tweak that in the script.

If you have any issues I will support as best I can. If you have any comments or suggestions, I would love to hear them. Feel free to change whatever you want. The system still doesn't work exactly how I want it, but that's the limit of my abilities, for the moment.
 

Attachments

  • BaseAnimal.zip
    126.4 KB · Views: 168

Sythen

Sorceror
Thanks Thagoras, this looks very cool and I'm definately going to use this system. Much appreciated. :)
 

milva

Sorceror
This looks great! But will have to see if there are problems with this and fstaming, tnks for sharing :)
 

Thagoras

Sorceror
milva;852742 said:
This looks great! But will have to see if there are problems with this and fstaming, tnks for sharing :)

I don't use FS Taming. However, much of the animals behavior depends on them being independent (not tamed or summoned). If they're not independent, they act like normal basecreatures. FS Taming seems to be heavy on controlled animals. There don't seem to be any major distro edits which would affect BaseAnimal. As long as there are no variable conflicts, they both should be able to run side by side.
 
This sounds great but am not sure if it would have any conflicts with my shard.

I am running RunUO RC2 and I don't think I have any custom packages outside of Nerun's, props hope I spelled that correctly.

So is this a drag and drop ready to go package? Or is this in combination to other packages that I would need to make it all work?
 

Thagoras

Sorceror
Well, there are a couple edits you need to make inside the BaseCreature.cs and BaseAI.cs having to do with the AI...otherwise it is pretty drag and drop.

This system has been tweaked so you shouldn't have to worry about a whole lot. I've included the farm animals and a few others, so you can see what adjustments need to be made for any future animals you wish to do this to (you won't have to worry about deleting all of a given type of animal when you convert it to baseanimal).
 

Thagoras

Sorceror
Ok, gosh, explain the Ranch. In the attached pic, you see my ranch on my 'live' shard.

The ranch deed is required to place the ranch stone. The ranch may only be placed in valid housing regions (it does a check when you place it). It defaults to a size of 10 (but may be increased with the ranch extension deed up to 50). Fences and gates may placed within those 10 spaces from the stone...so it would be a 20 space diameter. They are set into place (made movable false so they don't decay) with the Fencing Hammer. I made these to work so ranch stones may be placed overlapping...so a farmer could have a huge, fenced in pasture for his livestock. Where one stone would stop setting fences, another could start. And so, ranch extension deeds could be avoided, and still have a huge ranch.

Located just about in the center of the pic is the ranch stone. Double click it to get the Gump. Only the owner (one who placed it) may access the gump (of course GMs and higher may also).
Gump is as follows:
Ranch Name - (defaults to playermobile.name + 's ranch)
Owner's name
Toggle Branding Iron - places or removes the branding iron in owner's backpack
Reclaim Animal - set's Controlled true, Control master to Owner, Control order to follow and control target to owner of an animal which was branded by the owner
Transfer Animal - Does the above but to another player, and changes the owner to that player...the brand stays though (can be changed IF that other player has a ranch stone with branding iron)
Toggle Fencing Hammer - places or removes the fencing hammer in owner's backpack
Unlock Fences - set movable true to all fences hammered with the fencing hammer from this stone
Rename Ranch - renames the ranch...and brand
Redeed Ranch Stone - unlocks all fences belonging to this stone and places the ranch deed in owner's pack
Absorb Other Ranch - I put this in because when I first wrote the script, I had the range set to 10...and so it took multiple stones to cover an area. I wanted just the one gump to control all the stones...and those stones to be redeeded. So that's what this does. IF you're the owner of two ranches close to each other, and their radii overlap...as in, if your ranch could encompass another ranch, you could absorb it. And in doing so, all the fences and gates respond to the absorbing ranch stone...so you don't have to rehammer all the fences and gates.
Transfer Ownership - transfers the ranch ownership to another player.
Size - the current size of the ranch
Area - area = pi R squared.

Branding Iron - comes from the stone hot, has a 50/50 chance of cooling with each use. Planned on making it so one could reheat it with a fire. Toggle stone to get a fresh one. This makes the BaseAnimal recognize the brander as its owner (for use with reclaim animal). It also puts the Ranch Name in its name display (when you hold the cursor on it). To assist with possible horse thieves...and finding your stock. You cannot sell to the Animal trader if you don't own the animal.
 

Attachments

  • Felagund_10-10_15.38.jpg
    Felagund_10-10_15.38.jpg
    219.3 KB · Views: 110

ft2085267

Sorceror
open FencingKit
:confused:

Code:
Exception: 
System.ArgumentOutOfRangeException: index out of range. Must be non-negative and less than the size of the collection. 
Parameter name: index 
   In System.Collections.CollectionBase.System.Collections.IList.get_Item (Int32 index) 
   In Server.Engines.Craft.CraftItemCol.GetAt (Int32 index) 
   In Server.Engines.Craft.CraftSystem.AddRes (Int32 index, Type type, TextDefinition name, Int32 amount, TextDefinition message) 
   In Server.Engines.Craft.DefFenceCrafting.InitCraftList () 
   In Server.Engines.Craft.CraftSystem .. ctor (Int32 minCraftEffect, Int32 maxCraftEffect, Double delay) 
   In Server.Engines.Craft.DefFenceCrafting .. ctor () 
   In Server.Engines.Craft.DefFenceCrafting.get_CraftSystem () 
   In Server.Items.FencingKit.get_CraftSystem () 
   In Server.Items.BaseTool.OnDoubleClick (Mobile from) 
   In Server.Mobile.Use (Item item) position f: \ RUNUO \ Stygian Abyss ML \ Server \ Mobile.cs: line number 4446 
   In Server.Engines.XmlSpawner2.XmlAttach.UseReq (NetState state, PacketReader pvSrc) 
   In Server.Network.MessagePump.HandleReceive (NetState ns) position f: \ RUNUO \ Stygian Abyss ML \ Server \ Network \ MessagePump.cs: line number 144 
   In Server.Network.MessagePump.Slice () location f: \ RUNUO \ Stygian Abyss ML \ Server \ Network \ MessagePump.cs: line number 129 
   In Server.Core.Main (String [] args) position f: \ RUNUO \ Stygian Abyss ML \ Server \ Main.cs: line number 503
 

Thagoras

Sorceror
ft2085267,

I'm not sure about the sheep in the walls. I didn't modify the animals to the point of them being any different than other mobiles (they follow the same rules as other mobiles). Perhaps the walls aren't locked down? (set movable = false) When they're "born" they MoveToWorld at the mother's position...so if she can't get somewhere, neither can they. The only thing I can figure is that the walls aren't flagged right. Can other animals and monsters pass through the walls?

Your second issue confuses me too. The only guess I could make is that your svn is different than what I used for these. This was made with runuo final and is a generic craft form (was based on the other crafting systems).

Edit: (about first issue) Although my girlfriend pointed out that it appears that the sheep walk on her when they walk in front of her. We were standing next to each other diagonally and a sheep walked between us and it appeared to walk on top of her when it really just walked between us.
 
Code:
Errors:
 + Customs/BaseAnimal/Animals/Boar.cs:
    CS0115: Line 209: 'Server.Mobiles.Boar.OnCarve(Server.Mobile, Server.Items.C
orpse, Server.Item)': no suitable method found to override
I get that for every animal as well as this for fencing hammer:

+ Customs/BaseAnimal/Ranch/FencingHammer.cs:
CS0115: Line 25: 'Server.Items.FencingHammer.MlSpeed': no suitable method fo
und to override

(2.0 Final)
 

Thagoras

Sorceror
Code:
Errors:
+ Customs/BaseAnimal/Animals/Boar.cs:
CS0115: Line 209: 'Server.Mobiles.Boar.OnCarve(Server.Mobile, Server.Items.C
orpse, Server.Item)': no suitable method found to override
I get that for every animal as well as this for fencing hammer:

Quote:+ Customs/BaseAnimal/Ranch/FencingHammer.cs:
CS0115: Line 25: 'Server.Items.FencingHammer.MlSpeed': no suitable method fo
und to override

(2.0 Final)

I'm guessing you don't have Mondain's Legacy on your system. My Bad.

Delete this from FencingHammer
Code:
		#region Mondain's Legacy
		public override float MlSpeed{ get{ return 2.75f; } }
		#endregion

and remove in red from the animal files
Code:
		public override void OnCarve( Mobile from, Corpse corpse[COLOR="Red"], Item with[/COLOR])
		{
			base.OnCarve( from, corpse[COLOR="Red"], with[/COLOR] );
 
Thagoras;865635 said:
I'm guessing you don't have Mondain's Legacy on your system. My Bad.

Delete this from FencingHammer
Code:
		#region Mondain's Legacy
		public override float MlSpeed{ get{ return 2.75f; } }
		#endregion

and remove in red from the animal files
Code:
		public override void OnCarve( Mobile from, Corpse corpse[COLOR="Red"], Item with[/COLOR])
		{
			base.OnCarve( from, corpse[COLOR="Red"], with[/COLOR] );

Thanks man, that did it.

None of the features depend on ML then?
 

Thagoras

Sorceror
None of the features depend on ML then?

The FencingHammer was just copied from one of the ML hammers (I forget which).

As far as the OnCarve method, I believe that ML references the tool used to carve for some kind of bonus. Never really looked into it too much. My server just required me to have those arguments in the method for it to run.
 
ok I'm in dependency hell,

it apparently requires vhaerun's crops, which in turn requires vharun's cooking, which requires.... god knows what

How can I remove its dependency on vhaerun's CRL? I mean I realize I'll have lose herbivorous animals to do this, but Its better than installing more and more things I don't need or want

EDIT: nvm, I must be blind, I see the if statements now



Just for the others who may want this system but do not have ML or Vhaerun's CRL, In addition to commenting out the "# if cropsystem" parts in baseanimnal (theres 4 or 5 I think), you will also have to comment out the section for RawLambLeg in Scripts/Items/Food/CookableFood.cs and the sections for Bacon, Ham and LambLeg in Scripts/Items/Food/Food.cs

And if you do not have a bounty system installed ( I assume this one: http://www.runuo.com/forums/custom-script-releases/98249-bounty-system-updated-runuo-2-0-a.html)

you will need to comment this out of baseanimal:

Code:
Head head = new Head(String.Format("the head of {0}", cor.Owner.Name));
                            head.Owner = cor.Owner;
                            head.Name = cor.Owner.Name;
                            head.Killer = cor.Killer;
                            head.CreationTime = cor.TimeOfDeath;
                            head.MoveToWorld(cor.Location, cor.Map);
                            MoveRandomly(head);
 
Top