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!

Fireable Cannon

brodock

Sorceror
Code:
26/02-23:48 2006-02-26 23:48:29,824 FATAL System.NullReferenceException: Object reference not set to an instance of an object
in <0x0002f> Server.Items.CannonComponent:Damage (Server.Mobile from, Int32 damage)
in <0x0065d> Server.Items.CannonComponent:Explode (Server.Mobile from, Point3D loc, Server.Map map)
in <0x00b60> Server.Items.CannonComponent:CheckFiringAngle (Point3D p, Server.Mobile from)
in <0x00106> Server.Mobiles.BaseCannonGuard:FireCannon (Server.Mobile target)
in <0x0002f> Server.Mobiles.BaseCannonGuard:OnCombatantChange ()
in <0x001f9> Server.Mobile:set_Combatant (Server.Mobile value)
in <0x000e5> Server.Mobiles.ArcherAI:DoActionGuard ()
in <0x000c3> Server.Mobiles.BaseAI:Think ()
in <0x0037f> Server.Mobiles.BaseAI:DoOrderAttack ()
in <0x000ab> Server.Mobiles.BaseAI:Obey ()
in <0x0024b> Server.Mobiles.BaseAI+AITimer:OnTick ()
in <0x000bd> Server.Timer:Slice ()
in <0x005c6> Server.Core:Start (Server.Config.Root _config, Boolean debug, Boolean _service, Boolean _profiling)
Crash: Backing up...done
26/02-23:48 Crash: Generating report...done
26/02-23:48 Crash: Sending email...failed
26/02-23:48 Crash: Restarting...done

How to reproduce:

Staff member add a walking canoneer...

Staff member add an enemy (can be an animal for example)

Staff member says: all kill (and click the animal)

You got the crash
 

Anvil

Wanderer
This has been a bug with this for a long time. I've removed out the cannons that have guards will them. The cannons without guards work just fine. I'm working on the cannons since after I removed the guards scripts now I'm having a problem where the cannons won't fire, but you need to remove the cannons with the guards to prevent your crashing.
 

Greystar

Wanderer
Anvil said:
This has been a bug with this for a long time. I've removed out the cannons that have guards will them. The cannons without guards work just fine. I'm working on the cannons since after I removed the guards scripts now I'm having a problem where the cannons won't fire, but you need to remove the cannons with the guards to prevent your crashing.

Heh, I just made the cannonguards inherit my BaseGuard and they worked fine, but that's cause I fixed a little hole that prevented them from attacking mobiles.
 

Greystar

Wanderer
Dragon Slayer said:
greystar can you post you fix for this please and thanks :)

Its not really a fix for this i basically made them inherit by BaseGuard, which can kill players and mobiles alike. but the following code SHOULD prevent the error from happening

Code:
		public override double GetValueFrom( Mobile m, FightMode acqType, bool bPlayerOnly )
		{
			bPlayerOnly = false;
			return base.GetValueFrom(m, acqType, bPlayerOnly);
		}

if i recall correctly there is a BaseCannonGuard just add that code into that and it should work fine.
 

Anvil

Wanderer
So does your fix actually still have them attack criminals or do they not attack on sight at all anymore? Just curious...
 

Greystar

Wanderer
Anvil said:
So does your fix actually still have them attack criminals or do they not attack on sight at all anymore? Just curious...

My fix just prevents it from crashing when killing mobiles

if you want it to target murderers and criminals you have to add something to do with IsEnemy

Code:
		public override bool IsEnemy( Mobile m )
		{
			if (m == null)
				return false;

			// If you add in this line it will be not an enemy
			if ( m is BaseGuard || m is BaseVendor || m is BaseHealer || m is TownCrier )
				return false;

			GuardedRegion rgn = null;
			if (m.Region != null)
				rgn = m.Region as GuardedRegion;

			if (rgn != null)
			{
				// If you add in this line it will be not an enemy
				//if ( m is PlayerMobile && ( !m.Criminal || ( m.Kills >= 5 && rgn.AllowReds) ) )
				//	return false;

				// If you add in this line it will be an enemy
				return ( m.Criminal || ( m.Kills >= 5 && !rgn.AllowReds) );
			}

			BaseCreature c = m as BaseCreature;
			// This section is entirely for things based on BaseCreature
			if ( c != null )
			{
				if (c.Region != null )
					rgn = c.Region as GuardedRegion;

				if (rgn != null)
				{
					if ( c.Criminal || (( c.Kills >= 5 || c.AlwaysMurderer ) && !rgn.AllowReds ) )
					{
						return true;
					}
				}
			}
			return false; //If you can figure out how to connect this back to basecreatures without a crash, post it please.
		}

the above code may NOT work for you but there are some things in it that should give you a general idea.

PS: Like I said mine inherit my baseguard which has a tone of custom code in it making it hard to get what you are asking me for.
 
I get this error in game keeps saying that im right next to cannon i even telported on top still gives me this saying

you are to far away from cannon
 

Greystar

Wanderer
Dragon Slayer said:
I get this error in game keeps saying that im right next to cannon i even telported on top still gives me this saying

you are to far away from cannon

all i can suggest for that is check the following code throughout the scripts for the cannons

Code:
			if( !from.InRange( m_cannon.Location, 3 ) )
			{
				from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
				return;
			}

look for the inrange when it has to do with the person fireing the cannon.
 
Found the problem in the code check this out

Code:
				else if ( from.Backpack.GetAmount( typeof( CannonBall )) == 0)
					from.Say("You don't have any cannon balls!");
				else if ( from.Backpack.GetAmount( typeof( SulfurousAsh )) < 3)
					from.SendLocalizedMessage( 1049617 ); // You do not have enough sulfurous ash.
				else if ( from.Mounted )
					from.SendLocalizedMessage( 1010097 ); // You cannot use this while mounted.
				else
					from.Say("You are too far from cannon!");

see where says You are too far from cannon" i think this is casuing the problem :( it aint given me the msg im out of sulfurous ash instead jumps straight to this line.
 
okay you fix for keeping it from crashing dont seem to work when the attack a player the still crash so im just going to not use them i guess untell it can be fixed/
 
hey greystar im using your killable guards is there any way you can like supple me the baseguard you are using to make this cannon guards work ? thanks if you can :)
 

Liacs

Sorceror
little question: are you going to work on a catapult script in this way too?

*hops around in excitement and claps hands*

That would be awsome. Anyway: great work on the script!
 

svrnol

Wanderer
Crashing

my shard is up to date clint and everything i have only seen one othere post simaler to this one now when i placed two cannon's a way a part and fire on too the other cannon my shard crashies this need to be fixed right away!
MAKER OF THIS SCIPT WE NEED YOUR HELP!!!!

thanks



_____________________________________________
http://www3.telus.net/svr_world
on uogateway :) - svr world
 

Greystar

Wanderer
For all you looking for help from UOT I think he has been busy doing other projects or RL stuff that does not involve RunUO. I would not expect a quick responce. I have been using these on my shard for a while without fail, no issues, maybe it's just me or how I added them I have no idea.


Also as to the last poster, why would you make the cannonguards fire on other cannonguards?
 

Candle

Sorceror
Liacs said:
little question: are you going to work on a catapult script in this way too?

*hops around in excitement and claps hands*

That would be awsome. Anyway: great work on the script!


Unfortunately from what i've seen the catapult only has 2 views. Same with the ore cart. (sorry to burst your bubble)
 

marvin3634

Wanderer
Ok deeds

Im not much on scripting but i want to make the new boats to replace the old boats. So when you buy a large ship deed it places a LargeshipCD.
Thanx.
 
Top