Author |
Message |
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
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 |
|
|
Abdul Alhazred
DRL Developer
Joined: Tue Aug 11, 2009 5:09 am Posts: 395
|
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 |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
Re: Can not settle function.
Is there a good and simple way to prolong the settling?
|
Mon Jul 11, 2011 8:23 am |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Can not settle function.
You can try both of these: http://wiki.datarealms.com/index.php/Lu ... t#ToSettlehttp://wiki.datarealms.com/index.php/Lu ... NotRestingNeither 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 |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Can not settle function.
Right after Code: self.DetonationTimer:Reset(); You have an extra 'end.'
|
Tue Jul 12, 2011 9:19 am |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
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 |
|
|
Coops
Joined: Wed Feb 17, 2010 12:07 am Posts: 1545 Location: That small peaceful place called Hell.
|
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 |
|
|
Mehman
Joined: Tue Nov 17, 2009 7:38 pm Posts: 909 Location: France
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Can not settle function.
MissionCritical can only be set from the INI file.
|
Tue Jul 12, 2011 8:08 pm |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
Re: Can not settle function.
Thanks guys! The mine works like a charm!
|
Wed Jul 13, 2011 8:40 am |
|
|
Major
Joined: Sun May 30, 2010 5:30 am Posts: 853 Location: Auckland, NZ
|
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 |
|
|
|