Data Realms Fan Forums
http://forums.datarealms.com/

Making an Explosive That Starts The Timer on Contact
http://forums.datarealms.com/viewtopic.php?f=1&t=45626
Page 1 of 1

Author:  Galahir950 [ Tue Apr 15, 2014 7:40 pm ]
Post subject:  Making an Explosive That Starts The Timer on Contact

How can I make this throwing knife activate the countdown once it hits something?
Code:
AddDevice = TDExplosive
   PresetName = Active Explosive Throwing Knife
   Description = A explosive throwing knife.
   AddToGroup = Bombs
   AddToGroup = Raptor Defense Industries
   PinStrength = 3
   Mass = 7
   RestThreshold = -500
   HitsMOs = 1
   GetsHitByMOs = 1
   SpriteFile = ContentFile
      FilePath = RDI.rte/Devices/Explosives/Knife Bomb.bmp
   FrameCount = 2
   SpriteOffset = Vector
      X = -3
      Y = -3
   EntryWound = AEmitter
      CopyOf = Dent Metal No Spark
   ExitWound = AEmitter
      CopyOf = Dent Metal No Spark
   GoldValue = 15
   AngularVel = 9
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   TriggerDelay = 4000
   ActivatesWhenReleased = 1
   GibImpulseLimit = 10000
   GibWoundLimit = 9
   GibSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Sounds/Explode2.wav
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Side Thruster Blast Ball 1
      Count = 2
      MinVelocity = 50
      MaxVelocity = 75
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Gray
      Count = 16
      Spread = 3.1
      MinVelocity = 50
      MaxVelocity = 60
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Yellow
      Count = 14
      Spread = 3.1
      MinVelocity = 50
      MaxVelocity = 60
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Air Blast
      Count = 20
      MinVelocity = 50
      MaxVelocity = 75
   AddGib = Gib
      GibParticle = MOSRotating
         CopyOf = Flame Ball 1
      Count = 5
      Spread = 3.1
      MaxVelocity = 6
      MinVelocity = 2
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 1
      Count = 12
      Spread = 3.1
      MaxVelocity = 10
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 2
      Count = 10
      Spread = 3.1
      MaxVelocity = 12
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 2 Glow
      Count = 2
      Spread = 3.1
      MaxVelocity = 10
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = AEmitter
         CopyOf = Explosion Trail 1
      Count = 2
      Spread = 3.1
      MaxVelocity = 40
      MinVelocity = 20
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Flame Smoke 1
      Count = 6
      Spread = 3.1
      MaxVelocity = 12
      MinVelocity = 3
      LifeVariation = 0.50
   GibImpulseLimit = 6000
   GibWoundLimit = 1

AddDevice = TDExplosive
   PresetName = Explosive Throwing Knife
   Description = A explosive throwing knife.
   AddToGroup = Bombs
   AddToGroup = Raptor Defense Industries

   Mass = 7
   RestThreshold = -500
   HitsMOs = 1
   GetsHitByMOs = 1
   SpriteFile = ContentFile
      FilePath = RDI.rte/Devices/Explosives/Knife Bomb000.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -3
      Y = -3
   EntryWound = AEmitter
      CopyOf = Dent Metal No Spark
   ExitWound = AEmitter
      CopyOf = Dent Metal No Spark
   GoldValue = 15
   AngularVel = 9
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   JointStrength = 80
   JointStiffness = 0.5
   DrawAfterParent = 1
   DetonationSound = Sound
      AddSample = ContentFile
         Path = RDI.rte\Devices\SatchelCharge\ActivateC-4.wav
   StanceOffset = Vector
      X = -12
      Y = -5
   StartThrowOffset = Vector
      X = -12
      Y = -5
   EndThrowOffset = Vector
      X = -12
      Y = -5
   MinThrowVel = 3
   MaxThrowVel = 30
   TriggerDelay = 99999
   ActivatesWhenReleased = 1
   AddGib = Gib
      GibParticle = TDExplosive
         CopyOf = Active Explosive Throwing Knife
      Count = 1
      Spread = 2.25
      MaxVelocity = 0.1
      MinVelocity = 0
      InheritsVel = 0
   GibImpulseLimit = 1
   GibWoundLimit = 1

Author:  Asklar [ Wed Apr 16, 2014 1:07 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

Just add a lua script to the Active Explosive Throwing Knife.

Code:
function create(self)
self:Activate();
end


Then, when it's created, it's gonna activate itself.

Author:  Galahir950 [ Wed Apr 16, 2014 1:53 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

Thanks!

Edit: How do I get it to do a trigger delay?

MOS Rotating doesnt work with TriggerDelay. I had to use MOS rotating because TDExplosive would just create the explosive and not activate it.

Author:  CaveCricket48 [ Wed Apr 16, 2014 2:39 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

You'll have to use a script that gibs the MOSRotating after a set period of time.

Code:
function Create(self)

   self.gibtimer = Timer();

end

function Update(self)

   if self.gibTimer:IsPastSimMS(4000) then
      self:GibThis();
   end

end

Author:  Galahir950 [ Wed Apr 16, 2014 2:54 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

CaveCricket48 wrote:
You'll have to use a script that gibs the MOSRotating after a set period of time.

Code:
function Create(self)

   self.gibtimer = Timer();

end

function Update(self)

   if self.gibTimer:IsPastSimMS(4000) then
      self:GibThis();
   end

end

Would That be in 2 different files, or in the same one?

Author:  CaveCricket48 [ Wed Apr 16, 2014 3:02 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

Same script file, attached to the MOSRotating.

Author:  Galahir950 [ Wed Apr 16, 2014 3:26 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

CaveCricket48 wrote:
Same script file, attached to the MOSRotating.


I attatched it to the MOSRotating, but it wont detonate it. it just sits there, even when I set the timer to 1.

Code:
AddActor = MOSRotating
   PresetName = Active Explosive Throwing Knife
   Description = A explosive throwing knife.
   PinStrength = 3
   Mass = 7
   RestThreshold = -500
   HitsMOs = 1
   GetsHitByMOs = 1
   ScriptPath = RDI.rte/Devices/Explosives/arm.lua
   SpriteFile = ContentFile
      FilePath = RDI.rte/Devices/Explosives/Knife Bomb.bmp
   FrameCount = 2
   SpriteOffset = Vector
      X = -3
      Y = -3
   EntryWound = AEmitter
      CopyOf = Dent Metal No Spark
   ExitWound = AEmitter
      CopyOf = Dent Metal No Spark
   GoldValue = 7
   AngularVel = 9
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   GibImpulseLimit = 10000
   GibWoundLimit = 9
   GibSound = Sound
      AddSample = ContentFile
         FilePath = Base.rte/Sounds/Explode2.wav
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Side Thruster Blast Ball 1
      Count = 2
      MinVelocity = 50
      MaxVelocity = 75
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Gray
      Count = 16
      Spread = 3.1
      MinVelocity = 50
      MaxVelocity = 60
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Grenade Fragment Yellow
      Count = 14
      Spread = 3.1
      MinVelocity = 50
      MaxVelocity = 60
   AddGib = Gib
      GibParticle = MOPixel
         CopyOf = Air Blast
      Count = 20
      MinVelocity = 50
      MaxVelocity = 75
   AddGib = Gib
      GibParticle = MOSRotating
         CopyOf = Flame Ball 1
      Count = 5
      Spread = 3.1
      MaxVelocity = 6
      MinVelocity = 2
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 1
      Count = 12
      Spread = 3.1
      MaxVelocity = 10
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 2
      Count = 10
      Spread = 3.1
      MaxVelocity = 12
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Explosion Smoke 2 Glow
      Count = 2
      Spread = 3.1
      MaxVelocity = 10
      MinVelocity = 0
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = AEmitter
         CopyOf = Explosion Trail 1
      Count = 2
      Spread = 3.1
      MaxVelocity = 40
      MinVelocity = 20
      LifeVariation = 0.50
      InheritsVel = 1
   AddGib = Gib
      GibParticle = MOSParticle
         CopyOf = Flame Smoke 1
      Count = 6
      Spread = 3.1
      MaxVelocity = 12
      MinVelocity = 3
      LifeVariation = 0.50
   GibImpulseLimit = 1
   GibWoundLimit = 1

AddDevice = TDExplosive
   PresetName = Explosive Throwing Knife
   Description = A explosive throwing knife.
   AddToGroup = Bombs
   AddToGroup = Raptor Defense Industries

   Mass = 7
   RestThreshold = -500
   HitsMOs = 1
   GetsHitByMOs = 1
   SpriteFile = ContentFile
      FilePath = RDI.rte/Devices/Explosives/Knife Bomb000.bmp
   FrameCount = 1
   SpriteOffset = Vector
      X = -3
      Y = -3
   EntryWound = AEmitter
      CopyOf = Dent Metal No Spark
   ExitWound = AEmitter
      CopyOf = Dent Metal No Spark
   GoldValue = 15
   AngularVel = 9
   AtomGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 2
      Depth = 0
   DeepGroup = AtomGroup
      AutoGenerate = 1
      Material = Material
         CopyOf = Concrete
      Resolution = 4
      Depth = 10
   DeepCheck = 0
   JointStrength = 80
   JointStiffness = 0.5
   DrawAfterParent = 1
   DetonationSound = Sound
      AddSample = ContentFile
         Path = RDI.rte\Devices\SatchelCharge\ActivateC-4.wav
   StanceOffset = Vector
      X = -12
      Y = -5
   StartThrowOffset = Vector
      X = -12
      Y = -5
   EndThrowOffset = Vector
      X = -12
      Y = -5
   MinThrowVel = 3
   MaxThrowVel = 30
   TriggerDelay = 99999
   ActivatesWhenReleased = 1
   AddGib = Gib
      GibParticle = MOSRotating
         CopyOf = Active Explosive Throwing Knife
      Count = 1
      Spread = 2.25
      MaxVelocity = 0.1
      MinVelocity = 0
      InheritsVel = 0
   GibImpulseLimit = 1
   GibWoundLimit = 1


LUA

Code:
function Create(self)

   self.gibtimer = Timer();

end

function Update(self)

   if self.gibTimer:IsPastSimMS(1) then
      self:GibThis();
   end

end

Author:  CaveCricket48 [ Wed Apr 16, 2014 3:32 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

Are there any errors in the Lua console?

Author:  Galahir950 [ Wed Apr 16, 2014 3:41 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

This is the console.

Code:
function Create(self)

   self.GibTimer = Timer(1);

end

function Update(self)

   if self.GibTimer:IsPastSimMS(3000) then
      self:GibThis();
   end

end


Attachments:
dasdasd.png
dasdasd.png [ 28.57 KiB | Viewed 6941 times ]

Author:  Arcalane [ Wed Apr 16, 2014 4:02 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

Galahir950 wrote:
This is the console.

Code:
function Create(self)

   self.GibTimer = Timer(1);

end

function Update(self)

   if self.GibTimer:IsPastSimMS(3000) then
      self:GibThis();
   end

end


It should just be "self.GibTimer = Timer();" - you do not put a number within those brackets.

Author:  Galahir950 [ Wed Apr 16, 2014 4:07 am ]
Post subject:  Re: Making an Explosive That Starts The Timer on Contact

thank you

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/