Data Realms Fan Forums http://45.55.195.193/ |
|
One shot .lua help. http://45.55.195.193/viewtopic.php?f=73&t=28955 |
Page 1 of 1 |
Author: | MesoTroniK [ Wed Jan 04, 2012 10:03 pm ] |
Post subject: | One shot .lua help. |
Hey guys I'm using this script to make a gun gib after it runs out of ammo. It works if I'm the one directly controlling the actor. But if he is using the gun autonomously it just reloads like normal. Would appreciate advice on how to solve this. Thanks in advance Code: function Create(self) end function Update(self) if ToMagazine(self.Magazine).RoundCount == 0 then self:GibThis() end end |
Author: | Asklar [ Wed Jan 04, 2012 10:09 pm ] |
Post subject: | Re: One shot .lua help. |
Code: function Create(self) end function Update(self) if ToMagazine(self.Magazine) == nil then self:GibThis() end end My guess is that the AI auto-reloads it, so it doesn't reach 0 ammo. Instead, you should check if the magazine still exists, and if it doesn't it gibs. I'm not sure if the code will work though, I tend to have problems with magazines. |
Author: | CaveCricket48 [ Wed Jan 04, 2012 10:18 pm ] |
Post subject: | Re: One shot .lua help. |
Try: Code: function Create(self) end function Update(self) if self.Magazine == nil or ToMagazine(self.Magazine).RoundCount == 0 then self:GibThis() end end |
Author: | MesoTroniK [ Thu Jan 05, 2012 5:40 am ] |
Post subject: | Re: One shot .lua help. |
CaveCricket48 wrote: Try: Code: function Create(self) end function Update(self) if self.Magazine == nil or ToMagazine(self.Magazine).RoundCount == 0 then self:GibThis() end end That works perfect. Thanks |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |