ThRepairableObject
v1.1 - 15th Feb 2003 - The_Dan

Contents:
Introduction
Making a standard ThRepairableObject
Events & Making you ThRepairableObject actually do something
TUTORIAL: Creating a damageable light source
Changing Damage Effects
Optional Properties

ThRepairableObject is a small user-made (the user being me, Dan) extension to Thievery that allows mappers to create ThieveryObjects that can be temporarily destroyed & repaired in the same style as the supply chest. Whats more, various events can be attached to the different states of the object & so it can be used to affect other actors & create more complex effects.

It as assumed that you know the basics behind properties, triggers & effects. If not, you would be advised not to attempt anything too complex early on.

Back to Top

Making a standard ThRepairableObject:

The class can be found at Actor>Decoration>ThieveryObject>ThRepairableObjectBase>ThRepairableObject (you will have to load the TDRepairable.u package first). Simply place one of these in your level & I will guide you through setting it up:
  1. The default mesh for ThRepairableObject is that of a Thievery light fixture. To change this to a different one, just change the Display>Mesh property of the object. To change the size of the object, change the Display>DrawScale property.

  2. The default collision cylinder used is for the default mesh, & so it will have to be adjusted to represent the chosen mesh. I suggest turning on the radius-view in UED, & using this to judge what makes the most accurate cylinder. Having an accurate cylinder is especially important since this will determine how accurate weapons have tobe, in order to cause damage.

  3. Open up the properties tree of you object & expand the branch entitled ThRepairableObject. This contains the important basic properties of ThRepairableObject, as explained below:

    • bThievesCanDamage: Can thieves damage this object?
      It would be rare that you would have to set this to false, although it depends purely on the circumstances.

    • bGuardsCanDamage: Can guards damage this object?
      Consider carefully what this object is going to affect; thieves are unable to repair anything & so if guards can gain any sort of benefit from destroying this, then they may be temptped to destroy this staright away.

    • binitiallyBroken: Is the object broken when the level starts?
      Remember to take this into account when setting up options related to this object; eg. if a light is going to be initially broken, then the triggerlight must be initially switched off.

    • bDamageWhenBroken: Will the object still trigger damage subroutines if it receives damge when it is already broken?
      OK, not the most obvious one but if the object has been broken, do you still want it to give off a damage-effect & send off a DamegeEvent? You'll see more about this later.

    • DefaultHealth: The initial health value of the object.
      The object will receive this much health whenever it is repaired & will start with this amount of health, at the start of the level, if bInitiallyBroken is false

    • RepairTime: How many seconds of use with the repair kit does it take for this object to be repaired?
      Self-explanitory. Bare in mind that if someone starts repairing the object & then leaves part-way, they WILL NOT have to start from the beginning again. This value represents the TOTAL amount of repair needed.

    • SyncTag: Set to the same SyncTag as any other ThRepairableObjects that should "stay in sync" with this one
      Hmm, confused? You should be. See it this way:
      If you have two ThRepairableObjects with the same SyncTag:
      --When one gets destroyed, they are both destroyed
      --When one is repaired, they are both repaired
      You'll see a use for this later

  4. Thats it! The entire set-up of ThRepairableObject is chosen through its properties.

Back to Top

Events & Making your ThRepairableObject actually do something:

OK, so that was the basics. Using the above information, you should now be able to create an custom object that can be broken & repaired. However it won't do much beyond getting broken & repaired. For it to affect the outside world, you will need to enter some names into the ThROEvents property branch of your object. I'm assuming you know about events & triggers; basically, there are 6 different events that can be triggered by a ThRepairableObject & by filling in the appropriate properties you can define specific actors to be triggered by these events:

  • DamageEvent: This is triggered when the object receives damage

  • BrokenEvent: This is triggered when the object is broken (health = 0)

  • RepairEvent: This is triggered when the object is repaired fully

  • FrobEvent: This is triggered when a player attempts to frob the object, AND the object isn't currently broken

  • TriggerEvent: This is triggered when the object itself is triggered (ie. another object triggers an event matching the tag of your ThRepairableObject) AND the object isn't currently broken.

  • TimerBrokenEvent: This is triggered when the object has been broken for a specific amount of time (defined by the TimerBrokenTime variable). By setting the bTimerBrokenLoop variable to true, you have this event triggered every x seconds that the object is broken (where x = TimerBrokenTime)
Now, plain English never was my best area & so I'll give an example of how the events are used.

Back to Top

TUTORIAL: Creating a damageable light source:

In this tutorial we will be creating a light fixture that normally emits light, but can be damaged to remove the light source & repaired to re-activate the light. (At this point it helps if you have a sample level to work with. If this isn't the case then just use a copy of any of the standard Thievery levels, but be sure NOT to overwrite the original map)
  1. Find a decoration-free spot of wall & add a ThRepairableObject to it. Note: ThRepairableObject is set up to represent a light source, by default.
  2. Rotate the object so that is correctly placed against the wall & adjust the position so that it about waist-height.
  3. Now add a Actor>Light>TriggerLight near to the ThRepairableObject. & move it in the 2D views so that is in about the same central position as the ThRepairableObject.
  4. Set the following properties of the TriggerLight: TriggerLight>bInitiallyOn = True Object>Initialstate = TriggerToggle
  5. TriggerLights have the default tag of "TriggerLight" which will be fine for this tutorial. We want the light to be toggled by the object being broken & repaired: Therefore, set BrokenEvent & RepairEvent to both equal "TriggerLight".
  6. Set bGuardsCanDamage to true. This isn't necessary, but will allow us to view the object changing as it is repaired & broken.
  7. Thats it, all set up! Rebuild lighting & start up your level.

Choose guard & buy a sword & a repair kit. Find your light, & watch it go off & on when you destroy & repair it, respectively.

Note:By changing the ThROOptional>ScaleGlowFunctional & ThROOptional>ScaleGlowBroken properties on your object, you can get it's ScaleGlow to change to specific values when it broken or functional.

Back to Top

Changing Damage Effects:

I've included the support for customisable effects to be triggered when the object is three key-states of damage:
  • DamageEffect: The object has just received damage

  • BrokenEffect: The object has just been broken

  • TimerBrokenEffect: The object has been broken for x seconds (where in this case x = TimerBrokenEffectTime)
The effects generated at these instances can be decided in the ThRODamageEffects branch of the property tree, out of a choice of 5 possible effects:
  • DE_None: No effect, nothing happens

  • DE_Spark: The object releases a burst of sparks (in the same style as watcher sparks)

  • DE_Smoke: A small cloud of smoke drifts up from the object

  • DE_Explosion: A small explosion occurs at the object

  • DE_Custom: A custom effect is generated depending upon the value of the corresponding Custom???Effect property
I don't think this needs much more explanation, & so I would suggest that you just experiment to get the idea of how the damage effects work.

Back to Top

Optional Properties:

Lastly, there are several properties under ThROOptional that have no bearing on the actual functioning of ThRepairableObject & are purely included to enhance the visual/sound effects of the object:

Lighting-based:

  • bFunctionalUnlit: When this is true, the object will be Unlit when in one piece & normally lit when broken.
  • ScaleGlowFunctional & ScaleGlowBroken: These respectively decide the scaleglow of the object when it is either functional or broken.

HUD Names:
In the game, when you centre the crosshair on the object, you will see a name appear in the top-right-hand corner of the screen. This name will be RepairedName or BrokenName depending on whether the object is respectively in one piece or broken.

Sounds:

  • FailedFrobsound: Played from the object when a player attempted to frob it, but it is currently broken. Note: If a player tries to frob it, & it isn't broken, ThieveryObject>Frobsound will be played.
  • DamageSound: Played from the object when it receives damage. By default this is set to the same sound played by the supply chest when it receives damage.
  • BrokenSound: Played when the object is broken.

& lastly...

  • FailedFrobMsg: This is a small string message that will be displayed in the chat area (on the frobbers' screen only) when a player attempts to frob the object, but it is currently broken

Back to Top