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



Reply to topic  [ 5 posts ] 
 Call a function on reload 
Author Message
User avatar

Joined: Thu Jul 17, 2014 5:44 am
Posts: 15
Reply with quote
Post Call a function on reload
I'm trying to make a weapon with magazines taped together, which makes every other reload faster. I'm not very familiar with Cortex Command's API, and the wiki isn't all that helpful. This was the best I could do, but I'm pretty sure I'm doing it wrong:

Code:
function Update(self)
   if self:IsReloading() then
      stuff
   end
end


Fri Oct 30, 2015 9:57 pm
Profile

Joined: Tue Oct 20, 2015 2:56 am
Posts: 62
Location: Under a bridge.
Reply with quote
Post Re: Call a function on reload
Couldn't you just edit the reload time and clip of a gun? Or am I misunderstanding.


Fri Oct 30, 2015 10:13 pm
Profile
User avatar

Joined: Thu Jul 17, 2014 5:44 am
Posts: 15
Reply with quote
Post Re: Call a function on reload
I want the reloading to go something like this: fast (flipping taped magazines and loading second one) - slow (both mags are empty now) - fast - slow - fast - slow, ad infinitum. If you don't understand what I mean, I'm referring to "jungle style" (taped or clipped together) magazines.


Fri Oct 30, 2015 10:58 pm
Profile
User avatar

Joined: Thu Jul 17, 2014 5:44 am
Posts: 15
Reply with quote
Post Re: Call a function on reload
Bump


Mon Nov 02, 2015 6:20 am
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post Re: Call a function on reload
Have you tried using this function: http://wiki.datarealms.com/LuaDocs/Held ... eReloading ?

Something like this
Code:
function Update(self)
   if self:DoneReloading() then
      if self.ReloadTime >= 2000 then
        self.ReloadTime = 1000
      else
        self.ReloadTime = 2000
      end
   end
end


I have not tested this code btw.


Tue Nov 03, 2015 9:43 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.062s | 14 Queries | GZIP : Off ]