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

UOT

Knight
Fireable Cannon

LATEST UPDATE
Fixed the support for older clients. Added all six ships that are damagable by the cannon. These ships will co-exsts with the distro ships so all your old ships will remain invulnerable to cannon attacks. When they are sunk all the mobiles that are on the ship will be sent to shore according to the Strandedness script so it sends you to where ever you would end up if you logged in when in water.

____________________________________________________________________________
Well since the last one I posted was for beta 24 or 25 I thought it was time for an update. And since I learned quite a bit since then ;) I thought I'd add a few features to it as well. Instead of listing what was fixed or added from the last one since most weren't here that long I'll just start the run down from the beginning.

There are 4 deeds, 1 for each direction, to add the cannons:
CannonNorthDeed
CannonSouthDeed
CannonEastDeed
CannonWestDeed

These will add the cannons with the person placing the deed as the owner, the deed's name will say the direction and the amount of hitpoints remaining for the cannon.
If you add the cannons directly adding one of the 4:
CannonNorth
CannonSouth
CannonEast
CannonWest

The owner will be null and only staff (Counselor and up) can use them.
OnMouseOver the Hit Points and the Owner's Name will be displayed. The Context Menu has Disassemble, which allows only the owner to re-deed the cannon, and Heal (there was no localized context string for repair), which will attempt to repair the cannon. To repair the cannon you'll need a minimum skill of 70.0 in Blacksmithing and 10 ingots (doesn't matter which type) on failed attempt you may lose up to 5 ingots.

To move a cannon you can "hitch" it to a mount. Just say hitch within 3 tiles of your cannon, then target a mount that belongs to you, to hitch it. Once hitched you can move the cannon. You can't mount the mount while it's dragging your cannon or it will unhitch, if your mount dies or is released the cannon will unhitch. To unhitch the cannon you must be in an area where the cannon is clear of obsticles and say unhitch. When unhitched the cannon will be facing the direction it was facing while hitched.
*Note: Hitched cannons still take damage. Hitched cannons won't go thru moongates.

Also added 5 mobiles, each will only attack players with negative karma and don't move. 4 of them, 1 for each direction:
CannonGuardNorth
CannonGuardSouth
CannonGuardEast
CannonGuardWest

which always have the cannons pointing in that one direction and one that turns the cannon towards his target:
TurnableCannonGuard
*Note: They don't need any ammo or sulfurous ash to fire

The Damage methods (ICannonDamage) and the Repiar methods (ICannonRepair) are interfaces so they can be easily added to any item to make them be damaged by cannons. The code that you would need to copy over are marked by the region tags. The amount of damage done can be adjusted in line 137 and 138 ( MinDamage and MaxDamage ). The firing rate is set at 10 seconds (bypassed for staff). The ammo required is 1 CannonBall and 5 SulfurousAsh. And it follows the map rules as far as who and what gets harmed. The damage is 50% physical and 50% Fire at the tile of impact with 100% of the damage points, 1 and 2 tiles away it's 100% fire damage and it's at respectively 1/2 and 1/3 of the damage points. Well I think that covers everything...Enjoy!
 

Attachments

  • CannonDamageBoat.zip
    7.3 KB · Views: 1,216
  • FireableCannon.zip
    13.6 KB · Views: 1,326

daat99

Moderator
Staff member
That's great UOT, I wanted to do something similar for a long time but wasn't able to :)
 

Zero_effect

Wanderer
Great script

I have watched the demonstration of your script (the .rpv files that you gave in another thread about month ago). The second movie shows how one cannon fires at a boat and then it start sinking. Is this feature available in this version or it will be in the next?
 

UOT

Knight
You can easily make the modifications to create a sinkable boat. I didn't add them because I'm still undecided on the repair, how to ditribute the hitpoints over the 6 different ships and what sort of notoriety checks I should add. If you don't feel like waiting and want to add it without repair and with no restrictions, as to who can damage them where, all you need to do to add this:
find in baseboat where it says BaseBoat : BaseMulti and add the ICannonDamage interface to it so it looks like this BaseBoat : BaseMulti, ICannonDamage then inside the baseboat class add
Code:
		#region ICannonDamage vars
		private int m_Hits = 1000;//change both values to change starting hitpoints
		private int m_HitsMax = 1000;//change both values to change starting hitpoints

		
		[CommandProperty( AccessLevel.GameMaster )]
		public int Hits
		{
			get{ return m_Hits; }
			set
			{
				if ( value > m_HitsMax )
					m_Hits = m_HitsMax;
				else
					m_Hits = value;
				InvalidateProperties();
			}
		}
		
		[CommandProperty( AccessLevel.GameMaster )]
		public int HitsMax{ get{ return m_HitsMax; } set{ m_HitsMax = value; } }
		
		public void Damage( Mobile from, int damage )
		{
			m_Hits -= damage;
			from.Send( new Server.Network.DamagePacket(from,damage) );
			OnDamaged();
		}
		
		public void OnDamaged()
		{
			if ( m_Hits <= 0 )
			{
				
				new DecayTimer( this ).Start();

				m_Decaying = true;
			}
		}
		#endregion
Now for those of you that are impatient I just want to let you know this will affect all the boats on you shard, they will all become fair game. Also doing it this way, the only way to repair the boat is dry docking it since the dry dock won't retain the hit points and will create a new boat.

Also a few people asked my about making the turning cannon guard tamable and movable, well I have a movable guard already scripted and the reason I haven't added him to this package is because with the current AIs available they are as dumb as a rock. Once I can make a decent AI for them to make proper use of their cannon the taming part wil be easy.
 

joshw

Sorceror
On firing the cannon at another cannon it freezes my client and is there a way to make it take damage from spells and melee attacks?
 

UOT

Knight
joshw said:
On firing the cannon at another cannon it freezes my client and is there a way to make it take damage from spells and melee attacks?

I'm guessing you are using a client older then version 4.0.7a if so you'll need to change all instances of DamagePacket in the FireableCannon script to DamagePacketOld but then you'll have problems with you players that have a patched up client so you can just comment that line. I'll add support for the old packet when I post the next version, which will included the damageable boats. I should have it done later this evening.

As for the making them damageable by melee and spells, there is no way to do that without changing distro files and I don't want to do that but it is doable even though you'll have to change a lot of files. That's why these boats I'll be releasing are going to be separate from the distro ones that way you can have both damageable boats as well as standard non damageable ones (Leave those poor fisherman alone! :) )
 

Zero_effect

Wanderer
There is some problems when you place a cannon on a ship and move the ship - the cannon is not staying at the same place after that.
 

UOT

Knight
Zero_effect said:
There is some problems when you place a cannon on a ship and move the ship - the cannon is not staying at the same place after that.
I know, I should've added a check to make sure you can't place the cannons on the boats until I found a rememdy to that problem. For now just tell your players not to place them on boats. It seems that for every one tile movement the cannon moves 3 tiles.
 

Gator81

Wanderer
Since I belive I cannot make a request, I would like to make some suggestions that you may consider for future addons to this wonderfull script.

would it be possible to configure the cannons to be use for starting an event? I know I could do it manually but I am thinking like to have 6 cannons go off at the same time without the need for materials?
maby even a check where it dosnt look for materials if your a admin or selected level
a possible gump that could be used to setup and controll one or a group of cannons... for like a faction/guild/player targeting prop. this way if someone from another faction came in the area it could be configured to target them and start shooting at them.

these are just some suggestions, it is in no means a request since that would be against the rules.

thanks for considering these suggestions.
 

UOT

Knight
I could add the accesslevel check for no ammo requirement, the only reason I hadn't added it before was to make sure it consumed the ammo and sulfurous ash correctly, that's why the bypass for staff is only for the delay. Linking cannons seems like a bit of a waste, maybe I'll add an option for the cannon guards to have a setable list of enemies to fire at which would give the same effect. It might be some time before you see either of these though since I'm working on making a standardized code so I can add catapult and maybe balista to the arsenol.
 

Gator81

Wanderer
Thats ok, I may try to get my hands dirty with experminting with it, I have no real scripting skills, so by the time i get some of it figured out you will probally have it done with the ballista and catapult :)
 

RANCID77

Wanderer
Is there a way to make it so the Cannon Guards shoot faster?? I have it set up now so they attack players instead of evil creatures because of a quest i got goin on and just want to know if they can be set to shoot faster or if its gonna be to much of a pain for me to even try that.. thnx
 

Gator81

Wanderer
cool, could you show the changes you made? I am not scripter but it would help me along with what I am trying to do :)

'copy and past'

hehe
 
Top