Hey, I'm not sure if anyone checks this board, but I've been searching the internet and this is my last hope. I had an idea for non-handheld scanners, such as grenades, dropship bombs, and bullets, and started to read over similar lua files in the game. I took an impulse grenade and stripped it down and gave it a rock sprite.
Code:
AddDevice = TDExplosive PresetName = Throwable Camera Description = What could this be? AddToGroup = Grenades AddToGroup = Bombs Mass = 1 RestThreshold = -500 HitsMOs = 1 GetsHitByMOs = 1 ScriptPath = Dummy.rte/Devices/Explosives/Camera.lua SpriteFile = ContentFile FilePath = Ronin.rte/Devices/Sprites/Stone.bmp FrameCount = 1 SpriteOffset = Vector X = -2 Y = -4 EntryWound = AEmitter CopyOf = Dent Metal No Spark ExitWound = AEmitter CopyOf = Dent Metal No Spark GoldValue = 5 AngularVel = 7 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 2 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 10 DeepCheck = 0 JointStrength = 100 JointStiffness = 0.5 JointOffset = Vector X = -1 Y = 2 DrawAfterParent = 0 //DetonationSound = Sound // Priority = 1000 // AddSample = ContentFile // Path = Base.rte/Sounds/Explode1.wav // AddSample = ContentFile // Path = Base.rte/Sounds/Explode2.wav StanceOffset = Vector X = 8 Y = 5 StartThrowOffset = Vector X = -12 Y = -5 EndThrowOffset = Vector X = 12 Y = -5 MinThrowVel = 5 MaxThrowVel = 25 TriggerDelay = 10000 ActivatesWhenReleased = 0 GibImpulseLimit = 6000 GibWoundLimit = 2 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = -3 Y = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = 1 Y = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = -2 Y = -3
and tried to take inspiration from the Heavy Digger's lua file and a timer for the impulse grenade (TimedFuze.lua). This is the most recent rewrite of Camera.lua:
Code:
function Update(self) --[[if self.Fuze then if self.Fuze:IsPastSimMS(3000) then]]-- local position = self.Pos --This was supposed to clear out an 11x11 square around the camera. --for a=-5, 5 do --for b=-5, 5 do --SceneMan:RevealUnseen(position.X + a, position.Y + b, self.parent.Team); for t=1,4 do SceneMan:RevealUnseenBox(position.X, position.Y, 500, 500, t-1); end --[[end end elseif self:IsActivated() then self.Fuze = Timer() end end]]--
end
Whenever I run this, it doesn't do anything. Not when I load the map, not when I buy the bomb (with actor), not when the order is delivered, and not when the bomb is thrown (or after the timer runs out). Am I using the SceneMan:RevealUnseenBox command incorrectly? It reveal the entire scene as soon as my order was delivered whenever I set the lua to an update(self) function containing only the line "for t=1,4 do SceneMan:RevealUnseenBox(0,0,SceneMan.SceneWidth,SceneMan.SceneHeight,t-1) end". ( no newlines) I want information on how and when the functions of the script are called, and how to use RevealUnseenBox (and RevealUnseen). Thanks for any help, mckryall
I'm not 100% sure what's going wrong but your script is way messier than needed and that probably makes it less fun to debug. Are there any console errors?
Either way, try something like this for starters. If nothing happens, put a print in somewhere and see if it's showing up in the console at all:
Code:
function Update(self) if self:IsActivated() then --Flags as true once it's been actually thrown, so it won't do anything if you drop it from a ship. Remove this if you'd like it to start revealing as soon as it exists for i = 0, 3 do SceneMan:RevealUnseenBox(self.Pos.X, self.Pos.Y, 100, 100, i); end end end
This should keep revealing a 100 by 100 pixel box around the grenade once it's been thrown.
Wed Nov 12, 2014 4:48 am
mckryall
Joined: Wed Dec 26, 2012 6:14 am Posts: 6
Re: Throwable Scanner (TDExplosive) [Solved!]
I got it to work! I completely rewrote my script. I had to attach a fuse script to the grenade, and I attached my main script to the payload. Here are the files: Throwable Camera.ini
Code:
AddDevice = MOSRotating PresetName = Throwable Camera Payload ScriptPath = Dummy.rte/Devices/Explosives/Camera2.lua Mass = 5 HitsMOs = 1 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/palette.bmp FrameCount = 1 SpriteOffset = Vector X = -1 Y = -1 AtomGroup = AtomGroup AutoGenerate = 0 AddAtom = Atom Offset = Vector X = 0 Y = 0 Material = Material CopyOf = Air DeepCheck = 0 GibSound = Sound Priority = 1000 AddSample = ContentFile Path = Base.rte/Sounds/Geiger1.wav AddSample = ContentFile Path = Base.rte/Sounds/Geiger2.wav AddSample = ContentFile Path = Base.rte/Sounds/Geiger3.wav AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = 1 Y = 1
AddDevice = TDExplosive PresetName = Throwable Camera Description = What could this be? AddToGroup = Grenades AddToGroup = Bombs Mass = 1 RestThreshold = -500 HitsMOs = 1 GetsHitByMOs = 1 ScriptPath = Dummy.rte/Devices/Explosives/TimedFuze Throwable Camera.lua SpriteFile = ContentFile FilePath = Ronin.rte/Devices/Sprites/Stone.bmp FrameCount = 1 SpriteOffset = Vector X = -2 Y = -4 EntryWound = AEmitter CopyOf = Dent Metal No Spark ExitWound = AEmitter CopyOf = Dent Metal No Spark GoldValue = 5 AngularVel = 7 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 2 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 10 DeepCheck = 0 JointStrength = 100 JointStiffness = 0.5 JointOffset = Vector X = -1 Y = 2 DrawAfterParent = 0 //DetonationSound = Sound // Priority = 1000 // AddSample = ContentFile // Path = Base.rte/Sounds/Explode1.wav // AddSample = ContentFile // Path = Base.rte/Sounds/Explode2.wav StanceOffset = Vector X = 8 Y = 5 StartThrowOffset = Vector X = -12 Y = -5 EndThrowOffset = Vector X = 12 Y = -5 MinThrowVel = 5 MaxThrowVel = 25 TriggerDelay = 10000 ActivatesWhenReleased = 0 GibImpulseLimit = 6000 GibWoundLimit = 2 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = -3 Y = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = 1 Y = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Offset = Vector X = -2 Y = -3
TimedFuze Throwable Camera.lua
Code:
function Update(self) if self.Fuze then if self.Fuze:IsPastSimMS(1500) then local Payload = CreateMOSRotating("Throwable Camera Payload", "Ronin.rte") Payload.Pos = self.Pos Payload.Vel.X = self.Vel.X Payload.Vel.Y = self.Vel.Y MovableMan:AddParticle(Payload) --Payload:GibThis()
self:GibThis() end elseif self:IsActivated() then self.Fuze = Timer() end end
Camera.lua
Code:
function Create(self) self.Vel.Y = 0 end
function Update(self) self.direction = Vector(self.Vel.X, self.Vel.Y); --self.Vel.X = self.Vel.X*1.005 if self.Vel.Y > 0 then self.Vel.Y = self.Vel.Y - 0.5 elseif self.Vel.Y < 0 then self.Vel.Y = self.Vel.Y + 0.5 end local glow = CreateMOPixel("Techion.rte/Dihelical Cannon Large Effect Particle"); glow.Pos = Vector(self.Pos.X, self.Pos.Y); glow.Vel = self.Vel MovableMan:AddParticle(glow) for t=1,4 do SceneMan:RevealUnseenBox(self.Pos.X-150,self.Pos.Y-150,300,300,t-1) end end
This was written in B28(27?) because I'm using OSX 10.7 and can't update (I'm on a school computer). Throw it up in a high arc and it will start glowing, move horizontally, and reveal a 300x300 square.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum