Data Realms Fan Forums http://45.55.195.193/ |
|
Parting bullets that meet back at a specific point? http://45.55.195.193/viewtopic.php?f=73&t=15931 |
Page 1 of 2 |
Author: | whitty [ Mon Jul 20, 2009 12:40 am ] |
Post subject: | Parting bullets that meet back at a specific point? |
How would you script it so that bullets(MOPixels) would all group at where you were aiming after they spread when shot? Pretty much like this: |
Author: | Kyred [ Mon Jul 20, 2009 12:45 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
whitty wrote: How would you script it so that bullets(MOPixels) would all group at where you were aiming after they spread when shot? Pretty much like this: image Though, I bet there is an easier way. I just can't think of one =/ *Edit* At least if you do it the way I was, using current X-pos instead of a timer. Still a pain in the butt though. |
Author: | whitty [ Mon Jul 20, 2009 12:53 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Damn. I wanted to make a gun like the Enforcer from Red Faction. |
Author: | CrazyMLC [ Mon Jul 20, 2009 12:53 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
a repelling force that repels only particles/bullets named "Parting Bullet" and then a sucking force where you want them to regroup that only sucks in particles/bullets named "Parting Bullet" So it pulls the bullets through the repelling force, but the repelling force keeps it at a certain distance making it part, right? |
Author: | TheLastBanana [ Mon Jul 20, 2009 1:35 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Okay, here's how it could work: Gun fires an invisible MO that casts a ray in its velocity direction. It gets the position of where the ray hits. It then spawns x number of bullets, and sending them all in a random direction (within a range based on the velocity of the original MO) with a set velocity. Then, in order to tell them what point needs to be hit, it sets the bullets' PresetNames to the two positions. For instance, the bullet's PresetName could be set to "1000,150" if the vector they were aiming for was (1000,150). The bullets then each have a script to extract the two vector coordinates from their PresetName, using Lua string functions. Then, they gravitate toward the point that was transferred to them when they were spawned. It could use the gravitation script from Orbit Lands, even. |
Author: | LowestFormOfWit [ Mon Jul 20, 2009 1:38 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
TheLastBanana wrote: Okay, here's how it could work: Gun fires an invisible MO that casts a ray in its velocity direction. It gets the position of where the ray hits. It then spawns x number of bullets, and sending them all in a random direction (within a range based on the velocity of the original MO) with a set velocity. Then, in order to tell them what point needs to be hit, it sets the bullets' PresetNames to the two positions. For instance, the bullet's PresetName could be set to "1000,150" if the vector they were aiming for was (1000,150). The bullets then each have a script to extract the two vector coordinates from their PresetName, using Lua string functions. Then, they gravitate toward the point that was transferred to them when they were spawned. It could use the gravitation script from Orbit Lands, even. If we get working code out of this, is anyone opposed to me using it and modifying it to -NOT- home back in? I could effectively make the scatter missiles I've been thinking about for the Behemoth with this, no? |
Author: | whitty [ Mon Jul 20, 2009 1:44 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
TheLastBanana wrote: Okay, here's how it could work: Gun fires an invisible MO that casts a ray in its velocity direction. It gets the position of where the ray hits. It then spawns x number of bullets, and sending them all in a random direction (within a range based on the velocity of the original MO) with a set velocity. Then, in order to tell them what point needs to be hit, it sets the bullets' PresetNames to the two positions. For instance, the bullet's PresetName could be set to "1000,150" if the vector they were aiming for was (1000,150). The bullets then each have a script to extract the two vector coordinates from their PresetName, using Lua string functions. Then, they gravitate toward the point that was transferred to them when they were spawned. It could use the gravitation script from Orbit Lands, even. I have no idea how to code anything you just said. I know what you're saying, I just have no idea how to do that. |
Author: | TheLastBanana [ Mon Jul 20, 2009 2:24 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
That was more directed at Lua-inclined modders. |
Author: | Mind [ Mon Jul 20, 2009 2:27 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
LowestFormOfWit wrote: TheLastBanana wrote: Okay, here's how it could work: Gun fires an invisible MO that casts a ray in its velocity direction. It gets the position of where the ray hits. It then spawns x number of bullets, and sending them all in a random direction (within a range based on the velocity of the original MO) with a set velocity. Then, in order to tell them what point needs to be hit, it sets the bullets' PresetNames to the two positions. For instance, the bullet's PresetName could be set to "1000,150" if the vector they were aiming for was (1000,150). The bullets then each have a script to extract the two vector coordinates from their PresetName, using Lua string functions. Then, they gravitate toward the point that was transferred to them when they were spawned. It could use the gravitation script from Orbit Lands, even. If we get working code out of this, is anyone opposed to me using it and modifying it to -NOT- home back in? I could effectively make the scatter missiles I've been thinking about for the Behemoth with this, no? I'm thinking you could really just use the drunken missle effect for that. |
Author: | piipu [ Mon Jul 20, 2009 10:08 am ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Done. And the code: Code: function Create(self) self.LTimer = Timer() self.targetpos = Vector(0,0) self.uselessvector = Vector(0,0) self.dirvector = Vector(self.Vel.X / self.Vel.Magnitude * 1000 , self.Vel.Y / self.Vel.Magnitude * 1000) SceneMan:CastObstacleRay(self.Pos , self.dirvector , self.uselessvector , self.targetpos , 0 , 0 , 1) for i = 1 , 7 , 1 do if i == 1 then self.particle = {CreateMOPixel("Particle SMG")} else table.insert(self.particle , CreateMOPixel("Particle SMG")) end self.particle[i].Pos = self.Pos self.particle[i].Vel = self.Vel MovableMan:AddParticle(self.particle[i]) end self.timetilldestination = (self.targetpos - self.Pos).Magnitude / self.Vel.Magnitude * TimerMan.DeltaTimeSecs * 3 end function Update(self) for i = 1 , 7 , 1 do self.particle[i].Vel = Vector(self.Vel.Magnitude * math.cos(self.Vel.AbsRadAngle + (i - 4) * (self.LTimer.ElapsedSimTimeS - self.timetilldestination / 2)) , -self.Vel.Magnitude * math.sin(self.Vel.AbsRadAngle + (i - 4) * (self.LTimer.ElapsedSimTimeS - self.timetilldestination / 2))) end end Edit: Now it hits right where it should. |
Author: | whitty [ Mon Jul 20, 2009 3:23 pm ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
I ♥♥♥♥ love you. *EDIT* Fuuuuuck me. It keeps self-multiplying. |
Author: | Areku [ Mon Jul 20, 2009 7:30 pm ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Uh... You all seem to be taking the most difficult approaches to it. My motto is "Why use Lua when .ini will do it?" So, taking the approach with the smaller amount of Lua possible: - Gun fires AEmitter; - AEmitter launches swarm of bullets in a semi-random direction and a single invisible particle in a straight line. - Code for the invisible particle (just a template) ///////////////////////////// function create(self) self.timer = Timer(); end function update(self) if self.timer:IsPastRealMS(*some number*) then for bullet in movableman.Particles do if bullet.PresetName == *Insert bullet swarm name here* then -- Gravitate bullets towards the invisible particle: use the homing rocket launcher's code. end end end end ////////////////////////////// And that's it, I guess. The distance at which the bullets would converge could be adjusted by changing the IsPastRealMS part. Seems simpler to implement than the other scripts. |
Author: | Roon3 [ Mon Jul 20, 2009 7:44 pm ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Areku wrote: -- Gravitate bullets towards the invisible particle: use the homing rocket launcher's code. That'd look pretty boring, using sharp diagonal lines and stuff. |
Author: | piipu [ Mon Jul 20, 2009 7:44 pm ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
Self-multiplying wut? I noticed no such thing. |
Author: | whitty [ Mon Jul 20, 2009 7:51 pm ] |
Post subject: | Re: Parting bullets that meet back at a specific point? |
I dunno what I did, but it shoots the round like normal, then it multiplies exponentially by like 4. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |