From Data Realms Wiki

Revision as of 23:11, 16 June 2010 by Petethegoat (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Attachables Tutorial

You can attach either an "Attachable" object or an "AEmitter."


Here's an example Attachable object.

AddEffect = Attachable

   InstanceName = Soldier Helmet A
   AddToGroup = Coalition Parts
   Mass = 3
   Sharpness = 1
   HitsMOs = 0
   GetsHitByMOs = 1
   SpriteFile = ContentFile
      FilePath = Base.rte/Actors/Coalition/HelmetA.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -7
      Y = -4
   AngularVel = 6
   EntryWound = AEmitter
      CopyOf = Dent Metal Light
   ExitWound = AEmitter
      CopyOf = Dent Metal Light
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Military Stuff
      Resolution = 4
      Depth = 0
   DeepCheck = 0
   JointStrength = 50
   JointStiffness = 0.6
   JointOffset = Vector
      X = 0
      Y = 0
   DrawAfterParent = 1
   GibImpulseLimit = 1500

   GibWoundLimit = 5

As you may or may not see, Attachables are pretty much the exact same thing as MOSRotating objects, except for one small difference.

JointStrength = 50

   JointStiffness = 0.6
   JointOffset = Vector
      X = 0

      Y = 0

This means that Attachable objects can have a parent object that they attach to. The strength determines how much force it takes to break the Attachable off the parent. The stiffness effects how easily the Attachable will recieve that force. And the offset determines where on the parent object the Attachable will be located.

To attach an Attachable to something you have to have a parent object, say, an AHuman, and an Attachable that you've already made. Then use the simple code in the AHuman's code. somewhere above where you define the gibs.

AddAttachable = Attachable

      CopyOf = Soldier Helmet A
      ParentOffset = Vector
         X = -1

         Y = -4

Here are what Attachables can and cannot do:

  • They do not rotate freely. You can't make a dynamic chain.
  • They do rotate with their parent object. They will keep the same relative rotation to the parent.
  • They cannot be attached in two directions. You can't attach a Dropship to one end of an Attachable and connect it to an AHuman
  • They can have gibs just like a MOSRotating and can be wounded just like a MOSRotating
  • Attachables can only be Attachables. You cannot attach Actors, Rockets, Guns, Brains using AddAttachable.

AEmitters as Attachables

Also able to be attached are AEmitters. AEmitters are attached similarly to Attachables:

AddEmitter = AEmitter

      CopyOf = Some emitter
      ParentOffset = Vector
         X = -1

         Y = -4

Then the emitters function just like they would anywhere else. The emitters will emit in the direction that they were attached relative to the parent object. If the parent object rotates, then the emitter will rotate with it, and emit in the new direction. However, if the parent object flips, as AHumans do when turning around, the emitter will not flip accordingly.

The last way to attach stuff is through TerrainObjects. TerrainObjects are placed in scenes or through the build phase, and can have child objects. The difference between attaching Attachables and using TerrainObjects, is that you can attach anything to a TerrainObject.

To attach a child object to a TerrainObject, use this code:

AddChildObject = SOPlacer

      PlacedObject = Actor //Or any other class
         CopyOf = Brain Case //Or any other InstanceName
      Offset = Vector //Where you want to place it in relation to the TerrainObject(optional)
         X = 8
         Y = -38
      Rotation = Matrix //Rotation in relation to the TerrainObject (optional)

         AngleDegrees = 180
Personal tools