Data Realms Fan Forums
http://45.55.195.193/

Can not settle function.
http://45.55.195.193/viewtopic.php?f=73&t=24546
Page 1 of 1

Author:  Major [ Mon Jul 11, 2011 7:52 am ]
Post subject:  Can not settle function.

Is there a function that defines weather it is possible for an MO to settle or not?
I took a look through the wiki briefly but couldn't find one.

Author:  Abdul Alhazred [ Mon Jul 11, 2011 8:15 am ]
Post subject:  Re: Can not settle function.

I'm not aware of any function like that, but in my experience all objects that have not been declared "MissionCritical = 1" will settle eventually.

Author:  Major [ Mon Jul 11, 2011 8:23 am ]
Post subject:  Re: Can not settle function.

Is there a good and simple way to prolong the settling?

Author:  TheLastBanana [ Mon Jul 11, 2011 7:44 pm ]
Post subject:  Re: Can not settle function.

You can try both of these:
http://wiki.datarealms.com/index.php/Lu ... t#ToSettle
http://wiki.datarealms.com/index.php/Lu ... NotResting
Neither are very effective, though. Setting the object to MissionCritical is the only way to guarantee it won't settle, but then it'll never settle at all.

Author:  Major [ Tue Jul 12, 2011 8:19 am ]
Post subject:  Re: Can not settle function.

Well then MissionCritical is perfect.

Edit: Now I'm getting an error in my mine script, and the mine refuses to detonate.
Quote:
ERROR:UKB.rte/Devices/Ronald AP Mine.lua:19:"(eof)"expected near "end"

And here is the mine script:
Code:
function Create(self)
   self.DetonationTimer = Timer()
   self.MissionCritical = 1
end

function Destroy(self)
end

function Update(self)
   if self.DetonationTimer:IsPastSimMS(500) then
      for actor in MovableMan.Actors do
         if (actor.Pos - self.Pos).Magnitude < 60 then
            self:GibThis();
         end
      end
   end
   self.DetonationTimer:Reset();
   end
end


I've mostly tacked together a few bits of code from other mods, fiddling with it, as I am terrible at Lua.
Can someone please tell me what I'm doing wrong?

Author:  CaveCricket48 [ Tue Jul 12, 2011 9:19 am ]
Post subject:  Re: Can not settle function.

Right after
Code:
   self.DetonationTimer:Reset();

You have an extra 'end.'

Author:  Major [ Tue Jul 12, 2011 12:08 pm ]
Post subject:  Re: Can not settle function.

Mmmm... That stops the error, but the mine still refuses to detonate. Also, it still settles.
Anything you can suggest?

Author:  Coops [ Tue Jul 12, 2011 12:20 pm ]
Post subject:  Re: Can not settle function.

Make it a TDExplosive?

Not only that but your reseting your timer every frame, so it would never be able to get past 500 Milliseconds.

Try this instead:

Code:
function Update(self)
   if self.DetonationTimer:IsPastSimMS(500) then
      for actor in MovableMan.Actors do
         if (actor.Pos - self.Pos).Magnitude < 60 then
            self:GibThis();
         else
            self.DetonationTimer:Reset();
         end
      end
   end
end

Author:  Mehman [ Tue Jul 12, 2011 1:14 pm ]
Post subject:  Re: Can not settle function.

Indeed, a TDExplosive will never settle, you can give it a ridiculously large TriggerDelay (eg 999999999 = 16666.67 h) or reset the timer and detonate it using lua(self:GibThis() ).
Also activate it using self:Activate() to prevent its name from being displayed on top of it.

Author:  CaveCricket48 [ Tue Jul 12, 2011 1:16 pm ]
Post subject:  Re: Can not settle function.

To keep something from settling, it either had to be a live actor, or pinned and with ToSettle = 0 (or MissionCritical = 1, but I never used that so I can't say for sure).

Held devices (including HDFirearms and TDExplosives) can still settle if the dropped weapons limit is reached.

Author:  TheLastBanana [ Tue Jul 12, 2011 8:08 pm ]
Post subject:  Re: Can not settle function.

MissionCritical can only be set from the INI file.

Author:  Major [ Wed Jul 13, 2011 8:40 am ]
Post subject:  Re: Can not settle function.

Thanks guys! The mine works like a charm!

Author:  Major [ Sat Jul 16, 2011 12:09 pm ]
Post subject:  Re: Can not settle function.

Sorry to resurrect the thread, but is there a way to stop the mine from detecting itself in the Actor detection code?

Edit: Nevermind, I figured out a way.

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