Data Realms Fan Forums http://45.55.195.193/ |
|
Setting mass in lua. http://45.55.195.193/viewtopic.php?f=73&t=19169 |
Page 1 of 2 |
Author: | Dylanhutch [ Sun Jul 04, 2010 7:11 am ] |
Post subject: | Setting mass in lua. |
How would I make a bullet first have 0 mass then wait 2 seconds and then have 0.25 mass? Or make the bullet 0 mass then slowly add mass. |
Author: | Duh102 [ Sun Jul 04, 2010 7:14 am ] |
Post subject: | Re: Setting mass in lua. |
In a .lua file: Code: function Update(self) self.Mass = self.Mass + 1; end will make your mass go up by 1 every frame. Code: function Create(self) this.timer = Timer(); this.Mass = 0; end function Update(self) if self.timer:IsPastSimMS(2000) self.Mass = 0.25; end end would make your mass go to 0.25 from 0 after 2 seconds. I haven't tried this but I don't see why it wouldn't work. |
Author: | Dylanhutch [ Sun Jul 04, 2010 7:20 am ] |
Post subject: | Re: Setting mass in lua. |
Thanks a lot Duh i'll test it out now! EDIT Worked. |
Author: | carnaxcce [ Sun Jul 04, 2010 8:21 pm ] |
Post subject: | Re: Setting mass in lua. |
I have a quick question about this too. If I wanted to have the bullet gib after it reached like, 100 mass, how would I do that? |
Author: | Duh102 [ Sun Jul 04, 2010 8:28 pm ] |
Post subject: | Re: Setting mass in lua. |
As long as your bullet can gib, meaning it is a MOSRotating, AEmitter, Attachable, Actor, etc, use this: Code: function Update(self) self.Mass = self.Mass + 1; if self.Mass > 100 then self:GibThis(); end end You can change the 1 and 100 to whatever numbers you like. Also, if you want to be more sophisticated and not do this every frame but every time period... Code: function Create(self) self.timer = Timer(); end function Update(self) if self.timer:IsPastSimMS(500) then self.Mass = self.Mass + 1; self.timer:Reset(); end if self.Mass > 100 then self:GibThis(); end end I forgot the "then" after the if condition in the previous code examples, you need that. |
Author: | carnaxcce [ Sun Jul 04, 2010 9:25 pm ] |
Post subject: | Re: Setting mass in lua. |
Ok, so what I did is copy the Coalition Rocket Launcher, deleted the homing missile parts, and made sure it worked. Then I put the lua file in: Quote: AddAmmo = Round PresetName = Round Coalition Rocket Launcher Path = mod.rte/Mass.lua ParticleCount = 1 Particle = AEmitter CopyOf = Particle Coalition Rocket Launcher Shell = AEmitter CopyOf = Shell Coalition Rocket Launcher FireVelocity = 40 ShellVelocity = 5 Separation = 5 And now it errors, and I don't know why. |
Author: | Duh102 [ Sun Jul 04, 2010 9:42 pm ] |
Post subject: | Re: Setting mass in lua. |
The ini variable to change is ScriptPath, not Path. Put ScriptPath = where the red is instead of Path = and it should work. |
Author: | carnaxcce [ Sun Jul 04, 2010 9:50 pm ] |
Post subject: | Re: Setting mass in lua. |
OK, changed that, but now it says "Cannot match property at line 369," which, assuming that it doesn't count empty lines, is that line. |
Author: | Duh102 [ Sun Jul 04, 2010 9:55 pm ] |
Post subject: | Re: Setting mass in lua. |
It counts every line actually, unless you have block quotes (the /* */ things). I assume you are using b23 since you have the homing rocket launcher, did you accidentally type it or tab it wrong? It should be on the same tab line as PresetName and the capitalization must be ScriptPath. |
Author: | carnaxcce [ Sun Jul 04, 2010 10:02 pm ] |
Post subject: | Re: Setting mass in lua. |
It's actually b22, just with all the data files copied over from b23 (long story). Does that make a difference? Does it just not count comment lines? Sorry that was phrased so inelegantly. Anyway, this is what it is now: Quote: AddAmmo = Round PresetName = Round Coalition Rocket Launcher ScriptPath = Mod.rte/Mass.lua ParticleCount = 1 Particle = AEmitter CopyOf = Particle Coalition Rocket Launcher Shell = AEmitter CopyOf = Shell Coalition Rocket Launcher FireVelocity = 40 ShellVelocity = 5 Separation = 5 Mod folder name is, well, Mod.rte, lua file is Mass.lua. |
Author: | Duh102 [ Sun Jul 04, 2010 10:03 pm ] |
Post subject: | Re: Setting mass in lua. |
b23 is the only version that can do Lua, so yes it does matter. If you aren't using b23 you can't use any Lua. |
Author: | carnaxcce [ Sun Jul 04, 2010 10:09 pm ] |
Post subject: | Re: Setting mass in lua. |
The revolver cannon works, and that uses lua... Can b23 be used on a non-moderator account on a mac? (It's actually not that long of a story). |
Author: | Duh102 [ Sun Jul 04, 2010 10:17 pm ] |
Post subject: | Re: Setting mass in lua. |
I'm afraid I don't follow? As long as you have a registration key you can use b23 (though you might need to upgrade it through licensing.datarealms.com) |
Author: | CrazyMLC [ Sun Jul 04, 2010 10:46 pm ] |
Post subject: | Re: Setting mass in lua. |
Moderator is to Mac as Administrator is to Windows? If so, There's no "Run as Moderator" button? >_> |
Author: | Mad Alex [ Sun Jul 04, 2010 10:51 pm ] |
Post subject: | Re: Setting mass in lua. |
Quote: AddAmmo = Round PresetName = Round Coalition Rocket Launcher ScriptPath = Mod.rte/Mass.lua ParticleCount = 1 Particle = AEmitter CopyOf = Particle Coalition Rocket Launcher Shell = AEmitter CopyOf = Shell Coalition Rocket Launcher FireVelocity = 40 ShellVelocity = 5 Separation = 5 You need to attach the script to particle, not round. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |