Author |
Message |
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
About MOPixels
How can i make an MOPixel bullet explode on contact instead of penetrating and killing?
or something similar...
|
Wed Aug 31, 2011 7:27 am |
|
|
Kettenkrad
Joined: Mon Oct 25, 2010 5:51 am Posts: 1198 Location: Sydney
|
Re: About MOPixels
Well..
MOPixels and MOSParticles can't have gibs, but there are a few ways to make them 'explode'.
Mehman uses .lua scripts which spawns the 'explosion' on 'destruction' of the pixel, which imo is the best option. I use a more simple method of using an AEmitter to fire the bullet, as well as a small MOSRotating which gibs on impact. If you use the AEmitter method you can also make shiny smoke effects and stuff.
|
Wed Aug 31, 2011 7:36 am |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Quote: Well..
MOPixels and MOSParticles can't have gibs, but there are a few ways to make them 'explode'.
Mehman uses .lua scripts which spawns the 'explosion' on 'destruction' of the pixel, which imo is the best option. I use a more simple method of using an AEmitter to fire the bullet, as well as a small MOSRotating which gibs on impact. If you use the AEmitter method you can also make shiny smoke effects and stuff. would you mind telling me how, im totally new to this, I've been on the wiki and nothing like this is there. Maybe you could post a sample code and an explanation.
|
Wed Aug 31, 2011 8:08 am |
|
|
Kettenkrad
Joined: Mon Oct 25, 2010 5:51 am Posts: 1198 Location: Sydney
|
Re: About MOPixels
Ok, so I'll use Mehman's method, as it works better and is far cooler. Are you familiar with .lua scripts? You don't need to be. So, on your bullet, we'll attach a script to it, telling it to explode after some complex mathematical stuff sorts itself out. This will be your explosion. in your weapon code, add something along the lines of this too it: Code: AddActor = AEmitter PresetName = Exploshn Mass = 0.50 Sharpness = 1 HitsMOs = 1 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = -1 Y = -1 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Metal Resolution = 1 Depth = -1 OrientToVel = 1.00 EmissionEnabled = 1 EmissionsIgnoreThis = 0 AddEmission = Emission EmittedParticle = MOSParticle CopyOf = Tiny Smoke Ball 1 ParticlesPerMinute = 6000 StartTimeMS = 0 Spread = 2.25 MaxVelocity = 0 MinVelocity = 0 PushesEmitter = 0
// ^ not sure what for... //Add Gibs here
GibImpulseLimit = 200 GibWoundLimit = 1
Just put it after the gun if you want. Don't forget to add Gibs to it. If you're stuck just use the dummy grenade launcher Gibs or something. This is Mehman's script (forgive me Mehman). Code: function Create(self) end function Update(self) local ray = SceneMan:CastObstacleRay(self.Pos , self.Vel*1.05*TimerMan.DeltaTimeSecs*FrameMan.PPM , Vector() , Vector() , self.ID , 0 , 1); if ray > 0 or self.ToDelete == true then local lr = CreateAEmitter("Your Explosion Emitter"); -- Place the name of your explosion here. lr.Pos = self.Pos+((self.Vel/125)*ray); lr.Vel = Vector(0,0); MovableMan:AddMO(lr); lr:GibThis(); self.ToDelete = true; end end
It creates an explosion (the AEmitter) on impact. Don't forget to insert the name of the explosion AEmitter inside the quotation marks. If you place that code in a new text document then save as -> all types, and add the extension .lua on the end of the file name, your script is ready. Anyway, find the bullet you want to explode, and add the line: Code: ScriptPath = YourMod.rte/YourFoldersAndStuff/ThatLuaFileYouMadeBefore.lua With a tab in front. You can place it anywhere in the bullet's slab of code, but it's easiest if it's under the PresetName or something. Uuh. I think I forgot something. Too tired. Have a play around with that and see what happens. Oh and welcome to the forums and modding and stuff.Saw join date.
|
Wed Aug 31, 2011 9:24 am |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Kettenkrad wrote: Ok, so I'll use Mehman's method, as it works better and is far cooler. Are you familiar with .lua scripts? You don't need to be. So, on your bullet, we'll attach a script to it, telling it to explode after some complex mathematical stuff sorts itself out. This will be your explosion. in your weapon code, add something along the lines of this too it: Code: AddActor = AEmitter PresetName = Exploshn Mass = 0.50 Sharpness = 1 HitsMOs = 1 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Base.rte/Null.bmp FrameCount = 1 SpriteOffset = Vector X = -1 Y = -1 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Metal Resolution = 1 Depth = -1 OrientToVel = 1.00 EmissionEnabled = 1 EmissionsIgnoreThis = 0 AddEmission = Emission EmittedParticle = MOSParticle CopyOf = Tiny Smoke Ball 1 ParticlesPerMinute = 6000 StartTimeMS = 0 Spread = 2.25 MaxVelocity = 0 MinVelocity = 0 PushesEmitter = 0
// ^ not sure what for... //Add Gibs here
GibImpulseLimit = 200 GibWoundLimit = 1
Just put it after the gun if you want. Don't forget to add Gibs to it. If you're stuck just use the dummy grenade launcher Gibs or something. This is Mehman's script (forgive me Mehman). Code: function Create(self) end function Update(self) local ray = SceneMan:CastObstacleRay(self.Pos , self.Vel*1.05*TimerMan.DeltaTimeSecs*FrameMan.PPM , Vector() , Vector() , self.ID , 0 , 1); if ray > 0 or self.ToDelete == true then local lr = CreateAEmitter("Your Explosion Emitter"); -- Place the name of your explosion here. lr.Pos = self.Pos+((self.Vel/125)*ray); lr.Vel = Vector(0,0); MovableMan:AddMO(lr); lr:GibThis(); self.ToDelete = true; end end
It creates an explosion (the AEmitter) on impact. Don't forget to insert the name of the explosion AEmitter inside the quotation marks. If you place that code in a new text document then save as -> all types, and add the extension .lua on the end of the file name, your script is ready. Anyway, find the bullet you want to explode, and add the line: Code: ScriptPath = YourMod.rte/YourFoldersAndStuff/ThatLuaFileYouMadeBefore.lua With a tab in front. You can place it anywhere in the bullet's slab of code, but it's easiest if it's under the PresetName or something. Uuh. I think I forgot something. Too tired. Have a play around with that and see what happens. Oh and welcome to the forums and modding and stuff.Saw join date. Thank you very much..that was a ton of help i just wanted to see what it looked like in code and now ive got it, thank you. Edit: ERRRRROR
Last edited by Martin2195 on Sun Sep 04, 2011 10:39 pm, edited 1 time in total.
|
Sun Sep 04, 2011 10:01 pm |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Now that i had time to play with the code...it gives me an error at line 17. Code: AddActor = AEmitter PresetName = Explodez Mass = 0.50 Sharpness = 1 HitsMOs = 1 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Mod.rte/Images/Round.bmp FrameCount = 1 SpriteOffset = Vector X = -1 Y = -1 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Bullet Metal Resolution = 1 <----------------------here and every other line after give errors (if this is commented out) Depth = -1 OrientToVel = 1 EmissionEnabled = 1 EmissionsIgnoreThis = 0 AddEmission = Emission EmittedParticle = MOSParticle CopyOf = Tiny Smoke Ball 1 ParticlesPerMinute = 6000 StartTimeMS = 0 Spread = 2.25 MaxVelocity = 0 MinVelocity = 0 PushesEmitter = 0
AddGib = Gib GibParticle = MOPixel CopyOf = Glow Explosion Huge Count = 1 Spread = 2.25 MaxVelocity = 0.1 MinVelocity = 0 InheritsVel = 0 AddGib = Gib GibParticle = MOSParticle CopyOf = Side Thruster Blast Ball 1 Count = 10 MinVelocity = 50 MaxVelocity = 75 AddGib = Gib GibParticle = MOPixel CopyOf = Grenade Fragment Gray Count = 20 MinVelocity = 50 MaxVelocity = 100 AddGib = Gib GibParticle = MOPixel CopyOf = Grenade Fragment Yellow Count = 20 MinVelocity = 50 MaxVelocity = 100 AddGib = Gib GibParticle = MOPixel CopyOf = Air Blast Count = 40 MinVelocity = 50 MaxVelocity = 75 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 1 Count = 15 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 2 Count = 12 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 2 Glow Count = 3 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = AEmitter CopyOf = Explosion Trail 1 Count = 3 Spread = 3.1 MaxVelocity = 40 MinVelocity = 20 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Flame Smoke 1 Count = 5 Spread = 3.1 MaxVelocity = 10 MinVelocity = 3 LifeVariation = 0.50
GibImpulseLimit = 200 GibWoundLimit = 1 And when i put the code after the weapon there is an error in the round code, line 3 Code: AddAmmo = Round InstanceName = Awesome Round SMG ScriptPath = Mod.rte/Explosion.lua <--------------------here ParticleCount = 1 Particle = MOPixel InstanceName = Particle SMG Mass = 0.008 RestThreshold = 500 LifeTime = 1500 Sharpness = 250 HitsMOs = 1 GetsHitByMOs = 0 Color = Color R = 0 G = 0 B = 0 Atom = Atom Material = Material CopyOf = Bullet Metal TrailColor = Color R = 155 G = 155 B = 155 TrailLength = 25 Shell = MOSParticle CopyOf = Casing FireVelocity = 80 ShellVelocity = 10 Separation = 5
|
Sun Sep 04, 2011 10:38 pm |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: About MOPixels
Depth = -1 might be what's causing problems on that first error. Try Depth = 1
Is Mod.rte/Explosion.lua actually the filepath of the script's file? If not, fix that accordingly.
|
Sun Sep 04, 2011 10:49 pm |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Azukki wrote: Depth = -1 might be what's causing problems on that first error. Try Depth = 1
Is Mod.rte/Explosion.lua actually the filepath of the script's file? If not, fix that accordingly. yes that is the actual scripts file path...ill try the Depth thing and let you know what happens.
|
Sun Sep 04, 2011 10:54 pm |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Code: AddActor = AEmitter PresetName = Explodez ScriptPath = Mod.rte/Explosion.lua Mass = 0.50 Sharpness = 1 HitsMOs = 1 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Mod.rte/Images/Round.bmp FrameCount = 1 SpriteOffset = Vector X = -1 Y = -1 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Metal Resolution = 1 Depth = 1 OrientToVel = 1 EmissionEnabled = 1 EmissionsIgnoreThis = 0 AddEmission = Emission EmittedParticle = MOSParticle CopyOf = Tiny Smoke Ball 1 ParticlesPerMinute = 6000 StartTimeMS = 0 Spread = 2.25 MaxVelocity = 0 MinVelocity = 0 PushesEmitter = 0
AddGib = Gib GibParticle = MOPixel CopyOf = Glow Explosion Huge Count = 1 Spread = 2.25 MaxVelocity = 0.1 MinVelocity = 0 InheritsVel = 0 AddGib = Gib GibParticle = MOSParticle CopyOf = Side Thruster Blast Ball 1 Count = 10 MinVelocity = 50 MaxVelocity = 75 AddGib = Gib GibParticle = MOPixel CopyOf = Grenade Fragment Gray Count = 20 MinVelocity = 50 MaxVelocity = 100 AddGib = Gib GibParticle = MOPixel CopyOf = Grenade Fragment Yellow Count = 20 MinVelocity = 50 MaxVelocity = 100 AddGib = Gib GibParticle = MOPixel CopyOf = Air Blast Count = 40 MinVelocity = 50 MaxVelocity = 75 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 1 Count = 15 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 2 Count = 12 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Explosion Smoke 2 Glow Count = 3 Spread = 3.1 MaxVelocity = 10 MinVelocity = 0 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = AEmitter CopyOf = Explosion Trail 1 Count = 3 Spread = 3.1 MaxVelocity = 40 MinVelocity = 20 LifeVariation = 0.50 InheritsVel = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Flame Smoke 1 Count = 5 Spread = 3.1 MaxVelocity = 10 MinVelocity = 3 LifeVariation = 0.50
GibImpulseLimit = 200 GibWoundLimit = 1
AddAmmo = Round InstanceName = Awesome Round SMG ParticleCount = 1 Particle = MOPixel InstanceName = Particle SMG Mass = 0.008 RestThreshold = 500 LifeTime = 1500 Sharpness = 250 HitsMOs = 1 GetsHitByMOs = 0 Color = Color R = 0 G = 0 B = 0 Atom = Atom Material = Material CopyOf = Bullet Metal TrailColor = Color R = 155 G = 155 B = 155 TrailLength = 25 Shell = MOSParticle CopyOf = Casing FireVelocity = 80 ShellVelocity = 10 Separation = 5
AddAmmo = Round InstanceName = The Aweswome Round Tracer ParticleCount = 1 Particle = MOPixel InstanceName = Particle Gun Tracer RestThreshold = 500 LifeTime = 1500 HitsMOs = 1 GetsHitByMOs = 0 Color = Color R = 247 G = 247 B = 147 Atom = Atom Material = Material CopyOf = Bullet Metal TrailColor = Color R = 255 G = 255 B = 159 TrailLength = 45
AddAmmo = Magazine InstanceName = Magazine My Gun Mass = 1 // kg HitsMOs = 0 GetsHitByMOs = 0 SpriteFile = ContentFile FilePath = Base.rte/Devices/Pistols/MagPistol.bmp FrameCount = 1 SpriteOffset = Vector X = -3 Y = -3 EntryWound = AEmitter CopyOf = Dent Metal ExitWound = AEmitter CopyOf = Dent Metal AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 2 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 3 Depth = 1 DeepCheck = 1 JointStrength = 200 JointStiffness = 1 JointOffset = Vector X = 0 Y = -3 DrawAfterParent = 0 RoundCount = 50 RTTRatio = 0 RegularRound = Round CopyOf = Awesome Round SMG TracerRound = None
AddDevice = HDFirearm PresetName = Achtung AddToGroup = Weapons Mass = 1 HitsMOs = 0 GetsHitByMOs = 1 SpriteFile = ContentFile FilePath = Base.rte/Devices/SMGs/SMG.bmp FrameCount = 2 SpriteOffset = Vector X = -7 Y = -4 // EntryWound = AEmitter // CopyOf = Dent Metal // ExitWound = AEmitter // CopyOf = Dent Metal GoldValue = 20 AtomGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 0 DeepGroup = AtomGroup AutoGenerate = 1 Material = Material CopyOf = Military Stuff Resolution = 4 Depth = 10 DeepCheck = 0 JointStrength = 999999 JointStiffness = 999999 JointOffset = Vector X = -3 Y = 3 DrawAfterParent = 0 StanceOffset = Vector X = 6 Y = 5 SharpStanceOffset = Vector X = 7 Y = -2 SupportOffset = Vector X = 5 Y = 4 SharpLength = 250 Magazine = Magazine CopyOf = Magazine My Gun ParentOffset = Vector X = 3 Y = 1 Flash = Attachable CopyOf = Muzzle Flash SMG FireSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1601.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1602.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1603.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1604.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1605.wav AddSample = ContentFile FilePath = Base.rte/Devices/SMGs/M1606.wav EmptySound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/EmptyClick3.wav ReloadStartSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/ReloadStart.wav ReloadEndSound = Sound AddSample = ContentFile FilePath = Base.rte/Devices/ReloadEnd.wav RateOfFire = 800 ReloadTime = 1000 FullAuto = 1 FireIgnoresThis = 1 ShakeRange = 12 SharpShakeRange = 3 NoSupportFactor = 3 ParticleSpreadRange = 3 ShellSpreadRange = 8 ShellAngVelRange = 2 MuzzleOffset = Vector X = 10 Y = 0 EjectionOffset = Vector X = 1 Y = -1 AddGib = Gib GibParticle = MOPixel CopyOf = Spark Yellow 1 Count = 6 Spread = 2.25 MaxVelocity = 20 MinVelocity = 8 AddGib = Gib GibParticle = MOPixel CopyOf = Spark Yellow 2 Count = 5 Spread = 2.25 MaxVelocity = 20 MinVelocity = 8 AddGib = Gib GibParticle = MOPixel CopyOf = Drop Oil Count = 4 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Rust Micro A Count = 6 Spread = 2.25 MaxVelocity = 15 MinVelocity = 5 AddGib = Gib GibParticle = MOSParticle CopyOf = Gib Metal Grey Micro A Count = 4 Spread = 2.25 MaxVelocity = 15 MinVelocity = 5 AddGib = Gib GibParticle = MOSRotating CopyOf = Gib Device Small K Count = 1 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 AddGib = Gib GibParticle = MOSRotating CopyOf = Gib Device Small I Count = 1 Spread = 2.25 MaxVelocity = 10 MinVelocity = 1 GibWoundLimit = 999999
this is my entire code for the gun. all the errors start at the Resolution for the AEmitter. i changed the Depth to 1, but since the errors start before that i dont think thats the problem. (it still happens) (ignore ScriptPath, its not like that in the actual code)
Attachments:
File comment: and this is the mod itself.
Mod.rte.rar [2.29 KiB]
Downloaded 203 times
|
Sun Sep 04, 2011 10:58 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: About MOPixels
Never ever ever ever ever ever ever ever ever ever use spaces instead of tabs again. Ever.
|
Mon Sep 05, 2011 2:49 am |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Gotcha! wrote: Never ever ever ever ever ever ever ever ever ever use spaces instead of tabs again. Ever. i got everthing fixed now it just gives me an error for the scriptfile line.
Attachments:
File comment: i have head ache...
Mod.rar [2.05 KiB]
Downloaded 196 times
|
Mon Sep 05, 2011 3:04 am |
|
|
Azukki
Joined: Sat Nov 03, 2007 9:44 pm Posts: 1916 Location: Flint Hills
|
Re: About MOPixels
Try taking away one tab from the script line.
|
Mon Sep 05, 2011 3:23 am |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Azukki wrote: Try taking away one tab from the script line. still doesn't work...will you please try fixing it yourself and educate me on what you did.
Attachments:
Mod.rar [2.05 KiB]
Downloaded 203 times
|
Mon Sep 05, 2011 3:34 am |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: About MOPixels
It's ScriptPath, not ScriptFile.
|
Mon Sep 05, 2011 3:40 am |
|
|
Martin2195
Joined: Tue Dec 21, 2010 3:45 am Posts: 14
|
Re: About MOPixels
Gotcha! wrote: It's ScriptPath, not ScriptFile. oh damn
|
Mon Sep 05, 2011 4:16 am |
|
|
|