View unanswered posts | View active topics It is currently Sun Nov 19, 2017 11:28 am



Reply to topic  [ 3 posts ] 
 Throwable Scanner (TDExplosive) 
Author Message

Joined: Wed Dec 26, 2012 6:14 am
Posts: 6
Reply with quote
Post Throwable Scanner (TDExplosive)
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.

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:

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


Wed Nov 12, 2014 4:27 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 627
Location: Halifax, Canada
Reply with quote
Post Re: Throwable Scanner (TDExplosive)
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
Profile

Joined: Wed Dec 26, 2012 6:14 am
Posts: 6
Reply with quote
Post 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

TimedFuze Throwable Camera.lua

Camera.lua


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.


Wed Nov 12, 2014 4:40 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


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

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.025s | 17 Queries | GZIP : Off ]