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!

XmlSiege system for damageable structures - beta release

ArteGordon

Wanderer
XmlSiege system for damageable structures - beta release

XmlSiege beta release 0.6
updated 4/17/06
ArteGordon

SUMMARY
This set of attachments provides a system for allowing objects and structures to be damaged by siege weapons and repaired by siege tools.
Weapons included are the SiegeCannon and SiegeCatapult that fire siege cannonballs, and the SiegeRam that uses siege logs.
Hand siege weapons are also supported.

This is an early beta release. It works in its current form, but I will be adding things and making changes, so this is more for people to play around with and make suggestions.

CHANGELOG:
New to version 0.6
updated 4/17/06

- adjustment to the HandSiegeAttack attachment attack timer that prevents people from trying to get around the attack delay by repeatedly manually retargeting.

- added individual siege weapon scaling factors that affect damage and range. These are set by the overridable WeaponDamageFactor and WeaponRangeFactor properties in BaseSiegeWeapon.cs
SiegeCannons now have a 20% damage bonus and 20% increase in range when compared to catapults using the same projectiles.

- added support for degraded weapon damage and range performance as the weapon takes damage. By default, weapon damage will be reduced by up to 60% from its max value depending on how damaged the weapon is, and firing range reduced by up to 30%. This can be configured by changing or overriding these settings in BaseSiegeWeapon.cs
Code:
  public virtual double DamageReductionWhenDamaged { get { return 0.4; } } // scale damage from 40-100% depending on the damage it has taken 
  public virtual double RangeReductionWhenDamaged { get { return 0.7; } } // scale range from 70-100% depending on the damage it has taken

- added individual siege projectile damage scaling factors for creatures and structures. These are set by the overridable MobDamageMultiplier and StructureDamageMultiplier properties in BaseSiegeProjectile.cs. This allows different types of cannonballs to do different amounts of damage to creatures and to structures by overriding these settings in their class definitions.

- destroyed objects will no longer report damage taken when they are hit.

- catapult launch animation is working again.

- added a new siege weapon, the SiegeRam for close range attacks on structures. It has a faster attack speed than either the cannon or catapult, and the new SiegeLog ammunition can produce heavy damage to structures but is ineffective against creatures and has very short range.
The ram can also be loaded with SiegeLog stacks so that it can attack repeatedly without having to reload after each attack.



ramming speed!


- added the new SiegeLog siege ammunition type for use in the SiegeRam and 3 examples, the LightSiegeLog, HeavySiegeLog, and IronSiegeLog. They vary in damage and speed.

- added the SiegeRamDeed that can be used to sell Siege Rams.

- added the AutoRepairFactor setting in XmlSiege.cs to allow you to specify the fraction of HitsMax to be repaired on each OnTick of the autorepair system. (thanks to Prohor Meletevich for the suggestion)
Code:
  public virtual double AutoRepairFactor { get { return 0.1; } } // fraction of HitsMax to repair on each autorepair OnTick. A value of 1 will fully repair.

- added the XmlChestSiege attachment which is a version of the XmlSiege attachment that can be put onto containers to allow them to spill their contents when destroyed.

New to version 0.5
updated 4/6/06

- added the AutoRepairTime property to XmlSiege attachments that allow them to automatically restore destroyed objects back to their fully repaired state after some period of time. This can be used under conditions where you would like to have players use the siege capability to destroy structures, but not leave them permanently destroyed. For example having permanently locked dungeon doors or wall barriers that can only be passed by breaking them down.
Giving it a value of zero disables auto repair. The default is no auto repair.
Auto repair only occurs when an object is destroyed (hits == 0), not when it is just damaged.

- added a few static functions that can be used by external scripts to access siege damage information. GetHits and GetHitsMax will return a value of -1 if the target does not support siege damage. Refer to them like
Code:
int hits = XmlSiege.GetHits(targetobject);
Code:
public static int GetHits(object target)
public static int GetHitsMax(object target)
public static void Attack(Mobile from, object target, int firedamage, int physicaldamage)

- added support for handheld siege weapons. Any equippable weapon can be given the ability to apply siege damage to a target. This is accomplished with the new HandSiegeAttack attachment that lets the object that it is attached to do damage to a target that has the XmlSiege attachment on it.
For example, by adding this to a weapon script such as Mace.cs

Code:
  public override void OnDoubleClick(Mobile from)
  {
  	HandSiegeAttack.SelectTarget(from, this);
  }

you can siege attack a target object by double clicking on the mace and targeting the object. In this case, you dont actually have to worry about adding the HandSiegeAttack attachment to the weapon - it will be done automatically in the SelectTarget routine if it hasnt already been added.
You will also have to add this to the top of the specific weapon script
Code:
using Server.Engines.XmlSpawner2;

The speed of attack and damage done can be modified by changing the value of these constants in HandSiegeAttack.cs
Code:
  private const double DamageScaleFactor = 0.5; // multiplier of weapon min/max damage used to calculate siege damage.
  private const double BaseWeaponDelay = 9.0;  // base delay in seconds between attacks.  Actual delay will be reduced by weapon speed.

Anything that can be attacked with the other siege weapons can also be hand attacked.
Attacks will automatically continue until either the attacker or target move.


Always knock before entering... or was that knock down..


I asked them not to park here


I got your key right here.


New to version 0.4
updated 4/5/06

- added a minimum targeting distance to each weapon so that you cannot attack things that are too close. This will also prevent them from targeting themselves.

- firing animation no longer follows moving mobiles.

- cannons and catapults can now target ground locations. Projectiles with area damage, will cause damage to objects around the targeted ground location when the projectile hits.

- modified weapon dragging to automatically release if the mobile dragging it goes offline or is stabled.

- damage to mobiles is now appropriately modified by their physical and fire resistances if AOS is enabled.

- an allowharmful check is made on mobiles before applying damage.

- added new base classes for weapons and projectiles. This will simplify adding new weapons but this changes the serialization of the existing siegecannonballs, siegecatapults, and siegecannons. To convert existing objects from beta 0.3 or earlier to the new type, just follow these steps:

1) temporarily modify the deserialization for the abstract SiegeCannonball class at the beginning of SiegeCannonball.cs to look like this

Code:
  public override void Deserialize(GenericReader reader)
  {
  	base.Deserialize(reader);

  	//int version = reader.ReadInt();
  }

and do the same thing in SiegeCannon.cs and SiegeCatapult.cs

2) restart the server
3) do a save
4) uncomment the
Code:
int version = reader.ReadInt();
lines that you commented out in those files.

New to version 0.3a
updated 4/4/06

- added deeds for cannons and catapults. (thanks to Anvil for the suggestion) Note, these can only be used once and the weapons are not re-deedable.

New to version 0.3
updated 4/3/06

- added the new SiegeCatapult weapon. They are similar to cannons, but are not restricted by line-of-sight when choosing targets. The base weapon loading delay is 5 seconds longer than cannons. They accept the same ammunition as cannons.
Note that there are firing animations for all facings except for North. If anyone can find the catapult launch arm itemids for that facing let me know.

ready, aim


fire!


- cannons and catapults can now be dragged by a mobile. The new Connect/Release context menu options have been added to support this function.
Just select Connect from the context menu and target a mobile. When the mobile moves the weapon will be pulled behind it. Selecting Release will disconnect the weapon from the mobile.
This feature makes use of the new XmlDrag attachment that allows any object with the attachment to be dragged by a mobile.
Only newly created cannons or catapults will have this attachment automatically added. Existing weapons will need to have them manually added. This can be done with a command like

[global addatt xmldrag where siegecannon

- added the IsDraggable and IsPackable properties to cannons and catapults to control how you would like to allow them to be moved. Both are true by default.

- added FixedFacing property to the cannons and catapults to allow them to be setup so that they cannot be reoriented.

- added new constructors for the xmlsiege attachmets that allow optionally specification of the DestroyedItemID as well as the hits, resistances, and repair resources.
The [availatt will list all available attachments and their constructors, so you can see the list using that command.

- added some additional effects properties to fiddle around with. The LightDamageEffectID, MediumDamageEffectID, and HeavyDamageEffectID. By setting these you can experiment with different effects at different levels of damage.

- adjusted the firing effect of the fierycannonball to look like a fireball instead of a regular cannonball.

- improved the firing animations so that the firing effect more accurately reflects the weapon and target locations. This should fix the 'underground' cannonball effects.

- added mouseover information on the siege weapons as to whether or not they are loaded and what they are loaded with.

- added access to the siege weapon properties through the siege addon components, so you can do a [props on any component, and set the corresponding properties on base weapon addon.

- damage is now delayed to correspond to the time when the projectile actually reaches the target instead of being applied as soon as the weapon is fired.

New to version 0.2b
updated 3/25/06

- fixed a line of sight problem that was giving the "Cannot see target" message for certain target items and mobiles.

New to version 0.2a
updated 3/25/06

- fixed a problem with the Next/Previous option for siege cannons that was incorrectly placing them at a Z of 0 when rotating instead of leaving them in their current location.

New to version 0.2
updated 3/23/06

- added support for multis such as boats, camps, and player houses.
To add an attachment to a multi use a command like

[area addatt xmlsiege where basemulti

and target around the multi.
Cannons can attack multis by simply targeting any part of the multi that is within the line of sight of the cannon.
To access attachments on multis, use xmlfind with the Range restriction to search for basemultis and then select the siege attachment by selecting the blue button shown on the individual search result listings.

[xmlfind basemulti 20

will set up a search for all basemultis within 20 tiles.

Let that woman go!


Two cannons are better than one




Sorry, this is a no docking zone


Now this is what I call a house-warming party


- changed the damage display to use flame effects instead of rehueing.
Flame color and density will change with damage level.
Either or both can be selected by changing the UseEffectsDamageIndicator or UseColorDamageIndicator settings in xmlsiege.cs
The flame effects depend on nearby player movement, so they only get sent when players are nearby.

- the DestroyedItemID for multis is automatically put into multi range and so will have 0x4000 added to whatever value you assign.

- repair can now be area-based. You can repair an object by just targeting within 2 tiles of it. This makes it easy to repair things that are difficult to target directly, such as addons and multis. For multis, you still need to target near the 'handle' for the multi, which is generally near the center.

- repairing a structure from the destroyed state now incurs a penalty in time and resources (default is 3x more for each).

- staff have instant repair with no resource cost.


DESCRIPTION:
This system makes use of the XmlSpawner2 attachment system and the XmlSpawner2 package must be installed to support it. You dont need to use the xmlspawners themselves, and it doesnt matter whether you use the standard distribution spawners or any other spawning system but you do need the XmlSpawner2 package installed.

Because the attachment system neither requires nor makes any changes to serialization/deserializations of any item or mobile, it can be safely added and removed at any time now or in the future without interfering with any other systems that you might have installed.

You can safely add the XmlSiege attachment to any object. The damage effects are fully reversable and no permanent changes will be made. If you delete the attachment, the object will be restored to its original itemid and color (for the exception, see the section below on the option of permanent destruction).

INSTALLATION:
- have the latest version of xmlspawner2 installed. XmlSpawner2
- drop in the scripts and go. No modifications to any scripts are required.

UNINSTALLING THE SYSTEM:
If you have tried it out and wish to uninstall the system and undo any siege damage effects, you should first delete all of the XmlSiege attachments to restore objects to their original form before removing the scripts. The following command will do this:

[global delatt xmlsiege

Then just remove all of the scripts for the system.

FEATURES:
Note that ANY non-frozen object can be made damageable - walls, doors, signs, trees, multis, addons - anything. You just have to tag them with the xmlsiege attachment.

Creating damageable objects
To create a damageable object, just tack an XmlSiege attachment onto it, with

[addatt xmlsiege

and target the object. That will add the default 1000 hits to the structure, with 30% fire and physical resistance, and a repair requirement of 1 stone, 20 iron, 20 wood to repair 100 hits.
You can also specify optional arguments to the attachment. The additional constructors that take arguments are

xmlsiege hitsmax
xmlsiege hitsmax resistfire resistphysical
xmlsiege hitsmax resistfire resistphysical wood iron stone

HitsMax specifies the maximum number of hits the structure can take before being destroyed.
ResistFire and ResistPhysical are the percentage reduction in that type of damage that the object will take.
Wood, Iron, Stone - are the amount of each resource that will be required to repair 100 hits of damage on the object using the SiegeRepairTool

If you target an addon component, such as part of a structure spawned with the MULTIADDON keyword, then that part of the addon will become damageable.
If you attach it to the entire addon (which is hard to do with manual targeting), then the entire addon will become damageable.
For example, spawn the example wall.txt multi file with

MULTIADDON,wall.txt/attach/xmlsiege

and now the entire addon will take damage if any part of it is hit.

If you just spawned it and then added the attachment to individual wall segments, then only those segments would take damage.

Modifying XmlSiege settings on an object
To modify the xmlsiege settings on a damageable object with an XmlSiege attachment already on it, open up the attachment list gump using the getattachment command

[getatt

and target the object that you wish to modify/inspect. The gump will list the attachments on the object. Click the scroll to the left of the XmlSiege entry and it will open the properties gump for the attachment.

Seeing object damage
Once an object is damaged it will change color to indicate the level of damage.
The default colors are
green=67-99% of max
yellow=34-66%
red=1-33%

Blue is also temporarily assigned to objects that have just had the XmlSiege attachment added to them so that you can see what is damageable.

I dont really like the color system for damage indication, but I'm still working on possible alternatives at the moment.

Once the Hits for an object reach zero, then the ItemID of the object will be changed to the value specified in the DestroyedItemID propery of the xmlsiege attachment.
Individual attachments can have their own DestroyedItemID settings.
The default is a lava pool.

Permanent destruction
If you change DestroyedItemID setting to zero, then when the Hits of the object reach zero the object will be permanently destroyed - gone, no repair, never to return. Use this with care. Any other setting of DestroyedItemID is fully reversable and will not lead to any permanent changes to the target.
You might want to apply this setting for objects like cannons to allow them to be actually destroyed.

Repairing damageable objects
SiegeRepairTool - this is used to repair damaged objects.

Adding the tool
To add one of these, just do an

[add siegerepairtool

Using the tool - Just double-click to use and target the damaged object to be repaired. It can be given either limited (set UsesRemaining to a value > 0) or unlimited number of uses (set UsesRemaining to a value < 0).
Repair resources
You must have the required resources to repair the targeted object. The default setting is to repair 100 hits of damage per use.

Objects can require wood, iron, and/or stone for repair.
Iron = IronIngot
Wood = Board
Stone = Granite

The required resources for any given object can be specified in the XmlSiege attachment.

All of the resources must be in the pack of the person doing the repair.
Repair time
The speed of the repair will depend on their Blacksmith and Carpentry skills as well as dexterity. With max skill and dex it can be as fast as 3 seconds. With no skill it can take up to 15 seconds.
If you are missing any of the resources, the repair will not be done but any of the other resources that were needed and that you were carrying will be consumed.


Siege Cannon
Placing a cannon
you can use the [add command to place one. It requires a facing argument of 0-3, like

[add siegecannon 0

Changing the cannon facing
Then you can change the facing while it is placed using the 'Previous/Next' options in the context menu that comes up when you click it.

Moving a cannon
To move a cannon you must first pack it up using the 'Backpack' context menu option. This takes time (15 seconds) and you must be next to it at the beginning and end of packing. When finished you will have a crate in your pack that you can place anywhere.

Firing a cannon
To fire a cannon you must first load a cannonball into it. Then double-click the cannon and select the target.
The target must be within the cannonball range, and within the firing arc of the cannon. Note, that you can target mobiles as well as structures, and mobiles will also take splash damage from area damage cannonball attacks.

Taking damage
The cannon is configured with an xmlsiege attachment by default, so it can take damage from other cannons as well.

Cannonballs
I have added a few different types of premade cannonballs, but you can easily modify them or add your own. You can even create them and change their settings on the fly since all of their properties are accessible.
Cannonballs have the following configurable properties:

Range - maximum range in tiles
Area - number of tiles surrounding the target that will also take damage
AccuracyBonus - mod that affects chance of hitting the target
FiringSpeed - mod that reduces the minimum interval between firing.
PhysicalDamage - amount of physical damage delivered
FireDamage - amount of fire damage delivered

If you want to see more dramatic damage effects, just try increasing the Area, FireDamage or PhysicalDamage settings on them.
To allow you to fire them faster, change the FiringSpeed. Higher is better.
For longer range attacks, change the Range property.

The premade cannonballs included are

lightcannonball, ironcannonball, explodingcannonball, fierycannonball

To try some, just use the [add command like

[add ironcannonball 30

Loading a cannonball
Just double-click a ball and then target a cannon. You must be close enough to both, although you can dclick the ball, and then move to the cannon.

Screenshots

Using a fierycannonball on an addon with each component individually damageable, and an orc in the wrong place at the wrong time


Ok, so I forgot my keys. This works too...


Files:
You can find the installation files here:
http://xmlspawner.15.forumer.com/index.php?showtopic=337
 

ArteGordon

Wanderer
Attacking a multiaddon that has individual components tagged with the xmlsiege attachment (either manually or specified in the multi.txt file)


Only those parts of the addon are subject to damage.


and the components can be individually repaired
 

ArteGordon

Wanderer
Attacking a multiaddon that has an xmlsiege attachment on the main addon rather than on the individual components.


Attacking any part of the addon damages the whole


When destroyed all components of the addon are destroyed
 

Lord_Shaka

Wanderer
Just one word for this:

FUCKING AMAZING !!

we had similar projects before... but none with all this capabilities !!!

Thanks Arte for this !!

I´m going to start testing it and I´ll post my results here;;;;


FREAKING AMAZING !
 

ArteGordon

Wanderer
suggestions will be much appreciated, particularly any balance issues if you get a chance to test it with player groups. The current damage/resource/timing settings are a best first guess. I dont have a big player base so it is harder for me to test things that might be imbalanced in big groups.

Right now I see the damage/repair balance as being something that is hard to estimate. I wanted settings that gave an advantage to larger skilled groups on either side, but a smaller skilled group should also be able to take on a larger unskilled group.
Also the pace of a siege exchange will depend on those settings.

There might also be things like limiting the number of siege weapons allowed per unit area by setting a min distance between weapons that could be used to add balance.

Currently repair is somewhat regulated by only allowing one repair at a time on a target, so that you cant have multiple people piling on to rapidly repair an object.

Having an area-repair option is also something I am considering for the repair tool. It could be skill-based with higher skill repairing a larger area.
 

Jeff

Lord
...............................................................................wow.................................................................did i say wow yet?
 

ArteGordon

Wanderer
If you would like to try blasting something as a test, you can drop this multiaddon text file into your Spawns or main RunUO folder and spawn the plaster house shown in the screenshots using an xmlspawner with the following entry

MULTIADDON,plasterhouse.txt

and then play with tagging different addon components using the '[addatt xmlsiege' command.
 

Attachments

  • plasterhouse.txt
    2.2 KB · Views: 38

ArteGordon

Wanderer
thanks. A little tip for people trying this out on actual multis like boats or basehouses, etc.
It will work, but there are some things that are particular to multis which are not like ordinary items.

First, the cannon doesnt currently recognize targeting of multi components, so it can be tricky to know what to attack since you actually have to hit the handle of the multi itself. For boats, for example, it is the base of the mast.

Second, in order to actually have the multi change ids when destroyed, you need to use a value for DestroyedItemID that is greater than the minimum multi value of 0x4000 or 16384. Ive tried it out with a large value that doesnt map into an existing multi (like 25000) and that allows you to cause the multi to "disappear" when destroyed. It will reappear when repaired.

I'll have to play around with it a bit more to add better support for real multis.
 

Jeff

Lord
Ok art, you want feedback? AWSOME. now to the things you should do with this system.

Ever play shadowbane? Well if not ill explain. Granted I didnt play it for to long but you could build a town and live in it manage it tax it and such. It basically became you bind point and possible your income. You could then declare war on other towns and siege them. This would be a cool system to make a spin off of. Make it so if you sieged their area you could/would recieve their income and such. Dunno just a few ideas if you wanted to take this system one step further.
 

ArteGordon

Wanderer
yeah, since the system doesnt require any mods to existing scripts I think that it would be easy to integrate it into something like Ronin's player government system where you could have things happen when you destroyed property in someone elses town. It would just be a simple hook into the existing damage detection routines.
 

Jeff

Lord
ArteGordon said:
yeah, since the system doesnt require any mods to existing scripts I think that it would be easy to integrate it into something like Ronin's player government system where you could have things happen when you destroyed property in someone elses town. It would just be a simple hook into the existing damage detection routines.
ya that would be awsome. I would totally start working on that if my list of things to make wasnt 10 long :(
 

Lord_Shaka

Wanderer
ArteGordon said:
yeah, since the system doesnt require any mods to existing scripts I think that it would be easy to integrate it into something like Ronin's player government system where you could have things happen when you destroyed property in someone elses town. It would just be a simple hook into the existing damage detection routines.

That would be great !!!! making a plugin for ronin's system that allow people to destroy other cities, but you need to put that allowed only during a war btw cities !!! it would be AWESOME !!
 

ArteGordon

Wanderer
Lord_Shaka said:
That would be great !!!! making a plugin for ronin's system that allow people to destroy other cities, but you need to put that allowed only during a war btw cities !!! it would be AWESOME !!
yeah, should definitely be doable. I have to work out the multi thing so that player houses and boats and such will look right with damage, but I think that I have that figured out.
 
Top