View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:24 am



Reply to topic  [ 13 posts ] 
 Can not settle function. 
Author Message
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post 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.


Mon Jul 11, 2011 7:52 am
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post 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.


Mon Jul 11, 2011 8:15 am
Profile
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post Re: Can not settle function.
Is there a good and simple way to prolong the settling?


Mon Jul 11, 2011 8:23 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Mon Jul 11, 2011 7:44 pm
Profile WWW
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post 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?


Tue Jul 12, 2011 8:19 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Can not settle function.
Right after
Code:
   self.DetonationTimer:Reset();

You have an extra 'end.'


Tue Jul 12, 2011 9:19 am
Profile
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post 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?


Tue Jul 12, 2011 12:08 pm
Profile
User avatar

Joined: Wed Feb 17, 2010 12:07 am
Posts: 1545
Location: That small peaceful place called Hell.
Reply with quote
Post 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


Tue Jul 12, 2011 12:20 pm
Profile
User avatar

Joined: Tue Nov 17, 2009 7:38 pm
Posts: 909
Location: France
Reply with quote
Post 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.


Tue Jul 12, 2011 1:14 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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.


Tue Jul 12, 2011 1:16 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Can not settle function.
MissionCritical can only be set from the INI file.


Tue Jul 12, 2011 8:08 pm
Profile WWW
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post Re: Can not settle function.
Thanks guys! The mine works like a charm!


Wed Jul 13, 2011 8:40 am
Profile
User avatar

Joined: Sun May 30, 2010 5:30 am
Posts: 853
Location: Auckland, NZ
Reply with quote
Post 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.


Sat Jul 16, 2011 12:09 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 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.071s | 13 Queries | GZIP : Off ]