View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:43 am



Reply to topic  [ 27 posts ]  Go to page Previous  1, 2
 Setting mass in lua. 
Author Message
User avatar

Joined: Sun Jul 04, 2010 8:09 pm
Posts: 12
Reply with quote
Post Re: Setting mass in lua.
@MLC, yes. You need Administrator privileges to run B23. So I just copied all the files over. I've been using stuff that uses lua with no problems...


EDIT: After I put the lua at the particle, it worked. Could copying all the files from B23 to B22 made it so I can use lua?


Mon Jul 05, 2010 12:03 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Setting mass in lua.
Maybe all that was changed to include lua was content in dll files and stuff like that. It's possible.


Mon Jul 05, 2010 12:23 am
Profile WWW
User avatar

Joined: Sun Jul 04, 2010 8:09 pm
Posts: 12
Reply with quote
Post Re: Setting mass in lua.
That's probably what it was. In the frameworks, it has a bunch of files that, well, i dunno what they do. Still, they probably changed from B22 to B23. After all, I did change ALL of the data files it accessed.

EDIT: Yeah, if you change the resource files with another program, it becomes that program. Thus, I'm running B23 under the name of B22. Interesting...


Mon Jul 05, 2010 1:33 am
Profile
User avatar

Joined: Sun Apr 25, 2010 12:04 am
Posts: 303
Location: Australia
Reply with quote
Post Re: Setting mass in lua.
Also, how would I make an actor gain health?
<edit> At say 1 hp/sec</edit>

I have searched so much but can't find the code, and the wiki is broken.
I really think we should have a forum wiki.


Mon Jul 05, 2010 1:41 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Setting mass in lua.
function Update(self)
if self.hptimer == nil then
self.hptimer = Timer();
elseif self.hptimer:IsPastSimMS(1000) == true then
self.hptimer:Reset();
self.Health = self.Health + 1;
end
end


Mon Jul 05, 2010 1:57 pm
Profile
User avatar

Joined: Sun Apr 25, 2010 12:04 am
Posts: 303
Location: Australia
Reply with quote
Post Re: Setting mass in lua.
Um... Any way to stop it healing when health is more than 100?


Oh and, I tried 'if self.health < 100 then'


Tue Jul 06, 2010 5:19 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Setting mass in lua.
You probably didn't try hard enough. Change

elseif self.hptimer:IsPastSimMS(1000) == true then

to

elseif self.hptimer:IsPastSimMS(1000) == true and self.Health < 100 then


Tue Jul 06, 2010 5:22 am
Profile
User avatar

Joined: Sun Apr 25, 2010 12:04 am
Posts: 303
Location: Australia
Reply with quote
Post Re: Setting mass in lua.
Thanks. :)

It worked :grin:
I tried that 2 minutes ago, but i used:

Code:
function Update(self)
if self.hptimer == nil then
self.hptimer = Timer();
elseif self.hptimer:IsPastSimMS(1000) == true and
self.health < 100 then
self.hptimer:Reset();
self.Health = self.Health + 1;
end
end


Tue Jul 06, 2010 5:27 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Setting mass in lua.
In your non-working script,

Code:
self.health < 100 then
self.hptimer:Reset();
self.Health = self.Health + 1;

needed to be

Code:
if self.health < 100 then
self.hptimer:Reset();
self.Health = self.Health + 1;
end

You forgot the "if" and the "end".


Tue Jul 06, 2010 5:41 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: Setting mass in lua.
Health should also have been capitalized.


Tue Jul 06, 2010 5:43 am
Profile WWW
User avatar

Joined: Sat Jun 19, 2010 5:02 pm
Posts: 331
Location: Mekkan
Reply with quote
Post Re: Setting mass in lua.
I'm not and administrator on my Mac, and I run B23 just fine...


Thu Jul 15, 2010 7:44 pm
Profile
User avatar

Joined: Sun Jul 04, 2010 8:09 pm
Posts: 12
Reply with quote
Post Re: Setting mass in lua.
I got what I was doing to work, with a few changes:

1. I use the Autocannon now, since the missle was propelled, and changing it's mass had next to no effect.
2. The code now reads:
Quote:
function Create(self)
local endmass = self.Mass^16
end

function Update(self)
self.Mass = self.Mass^2;
if self.Mass > endmass then
self:GibThis();
end
end


What happens is the rounds fire, then after a few seconds fall slowly, and the smoke trail makes 'em look like streamers. A few more gibs to add some oomph, and it's done.


Sat Jul 17, 2010 5:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 27 posts ]  Go to page Previous  1, 2

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.245s | 13 Queries | GZIP : Off ]