View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:43 pm



Reply to topic  [ 5 posts ] 
 dofile help 
Author Message
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post dofile help
Ok, so for a request for Gotcha! I want to make a one-use healing gun. After browsing the LuaDocs, I see two possible ways to do the self-gibbing. One, it looks like there's an "IsActivated" function on HeldDevices, so could I do this in Update()?
Code:
if IsActivated() then
   (stuff)
   self.GibThis();
end

Or, another way Grif said is the option, having a particle do the Lua in it's Create() function. Would the particle be able to access that which it was fired from, like self.Parent.GibThis()?

EDIT: Got that done.
NOW, how do I retrieve a method from a dofile? I tried dofile("file"):method(params);, but that failed mightily, as well as just plain dofile("file"); and later self:method(params);, and the same but without the self:.


Last edited by Duh102 on Sat May 16, 2009 7:16 pm, edited 2 times in total.



Sat May 16, 2009 3:45 pm
Profile
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: Self gib help on HDFirearm
Couldn't you just give it a ridiculously high fire rate, fullauto, have the healing thing set as the tracer and a self destruct particle as the main round?
If you make the main round hitsmos and non-fireignoresthis with the muzzleoffset inside the gun the gun will self destruct after one use.


Sat May 16, 2009 4:04 pm
Profile WWW
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: Self gib help on HDFirearm
Did it. It seems that the HDFirearm's update(self) is not called until it is out of an Actor's hands. I followed 411570N3's advice and made the particles do the work, both health-ing and gibbing.

NOW, how do I retrieve a method from a dofile? I tried dofile("file"):method(params);, but that failed mightily, as well as just plain dofile("file"); and later self:method(params);, and the same but without the self:.


Sat May 16, 2009 7:14 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: Self gib help on HDFirearm
Duh102 wrote:
Did it. It seems that the HDFirearm's update(self) is not called until it is out of an Actor's hands. I followed 411570N3's advice and made the particles do the work, both health-ing and gibbing.

NOW, how do I retrieve a method from a dofile? I tried dofile("file"):method(params);, but that failed mightily, as well as just plain dofile("file"); and later self:method(params);, and the same but without the self:.


What? A function and a method are very different. Just dofile("myfile"); at the top, and any functions defined in that file will be loaded and usable.


Sat May 16, 2009 8:08 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: dofile help
Got it now. Thanks Daman.


Sat May 16, 2009 8:46 pm
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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.050s | 13 Queries | GZIP : Off ]