I want to make a one-shot weapon that gibs itself after you fire it. After doing some searching and reading on lua scripting I've found that you can't attach lua scripts to weapons(while they're being held by an actor at least) so the workaround seems to be to make an emitter that emits invisible particles that have the script attached to them instead. So this is what I have so far:
The gibself script:
Code:
function Update(self)
   self:GibThis();
end
The emitter:
Code:
AddEffect = AEmitter
   PresetName = GibEmitter
   Mass = 0.001
   PinStrength = 99999
   LifeTime = 100
   HitsMOs = 0
   GetsHitByMOs = 0
   RestThreshold = -500
   OrientToVel = 1
   SpriteFile = ContentFile
      FilePath = myMod.rte/Devices/Weapons/Sprites/Flashes/Null.bmp
   ScriptPath = myMod.rte/Scripts/GibSelf.lua
   FrameCount = 1
   SpriteOffset = Vector
      X = 0
      Y = 0
   AngularVel = 0
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Air
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Air
      Resolution = 4
      Depth = 10
   DeepCheck = 0
I've attached that emitter to the weapon like so:
Code:
   AddEmitter = AEmitter
      CopyOf = GibEmitter
      ParentOffset = Vector
         X = 0
         Y = 0
But it doesn't work, the weapon doesn't gib at all let alone after use. I have a feeling it's because the lua script is just gibing the invisible particles instead. So how can I have the script gib the MO that its emitter is attached to?
Thanks.