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



Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
 Parting bullets that meet back at a specific point? 
Author Message
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post 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:
Image


Mon Jul 20, 2009 12:40 am
Profile
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post 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
I've been trying to do something similar to this with my Tele Wielder's positioning. The only way I can think of doing it involves using differential equations >_<.

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.


Mon Jul 20, 2009 12:45 am
Profile
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Parting bullets that meet back at a specific point?
Damn. :-(

I wanted to make a gun like the Enforcer from Red Faction.


Mon Jul 20, 2009 12:53 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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?


Mon Jul 20, 2009 12:53 am
Profile WWW
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: 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.


Mon Jul 20, 2009 1:35 am
Profile WWW
User avatar

Joined: Mon Oct 06, 2008 2:04 am
Posts: 1559
Reply with quote
Post 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?


Mon Jul 20, 2009 1:38 am
Profile
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post 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.


Mon Jul 20, 2009 1:44 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: Parting bullets that meet back at a specific point?
That was more directed at Lua-inclined modders.


Mon Jul 20, 2009 2:24 am
Profile WWW
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post 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.


Mon Jul 20, 2009 2:27 am
Profile
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Parting bullets that meet back at a specific point?
Done.
Image
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.


Last edited by piipu on Mon Jul 20, 2009 7:45 pm, edited 1 time in total.



Mon Jul 20, 2009 10:08 am
Profile
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post Re: Parting bullets that meet back at a specific point?
I ♥♥♥♥ love you. :D

*EDIT*

Fuuuuuck me.
It keeps self-multiplying.


Mon Jul 20, 2009 3:23 pm
Profile
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post 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.


Mon Jul 20, 2009 7:30 pm
Profile WWW
User avatar

Joined: Sun May 11, 2008 12:50 pm
Posts: 899
Reply with quote
Post 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.


Mon Jul 20, 2009 7:44 pm
Profile WWW
User avatar

Joined: Mon Jun 30, 2008 9:13 pm
Posts: 499
Location: Finland
Reply with quote
Post Re: Parting bullets that meet back at a specific point?
Self-multiplying wut? I noticed no such thing.


Mon Jul 20, 2009 7:44 pm
Profile
User avatar

Joined: Sat Jun 16, 2007 2:31 am
Posts: 2982
Location: Texas
Reply with quote
Post 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.


Mon Jul 20, 2009 7:51 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 26 posts ]  Go to page 1, 2  Next

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