generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Making a flak cannon, need a system for a timer

Previous Thread :: Next Thread 
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 10:37 AM
I need some sort of math that will make the flak that shoots out of the cannon explode depending on the distance

the projecticle (the flak) is shooting out at the cannon's CFrame.lookVector * 600 , so i need an equation that will make it explode automatically when it comes relatively close, but keep in mind it is a TIMER, not when it detects the target close to it...
if you would like me to elaborate on something, feel free to ask
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 10:46 AM
To make more sense on the speed of the projectile, this is my line of code for the BodyVelocity inserted in it:
local bv = Instance.new("BodyVelocity",ball)
bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bv.Velocity = script.Parent.CFrame.lookVector * 600
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2016 10:55 AM
I'm confused as to what you want exactly.
Speed/Distance = time
The 'timer' would depend on how far you would like your projectile to attempt to travel before exploding.
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 10:57 AM
Let's say a random amount between 1-35 studs
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 10:59 AM
God, I am so bad at explaining stuff. Sorry.
I'll have a REAL explanation in a few minutes.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
01 Sep 2016 11:02 AM
Derp
Distance/Speed = Time
Time = Distance/Speed

Velocity is speed * direction
In your case
the lookVector is direction and the 600 is the speed

D = math.random(1,35)
T = D/600
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:03 AM
Let's say there's the target is 500 studs from the cannon. The cannon shoots, the timer activates. The timer detects, when the cannon shoots, how much time it would take for the flak to explode when it gets into a random distance amount between to integers, in this case 1-35 studs. But keep in mind, it wouldn't explode when it gets from 1-35 studs from it, when it gets shot it does an equation to see how long it would TAKE for it to get from 1-35 studs of it, and explode when the timer reaches 0. But I'm not good at math, so I can't figure out an equation for that.

The projectile shoots at 600 speed with a BodyVelocity.
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:05 AM
I need it to explode in coordination with the flak cannon's position, so if I place it really close, the timer is shorter. Farther, the timer is longer.
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
01 Sep 2016 11:08 AM
What he gave you would work with a minor modification.

T = (distanceFromTarget - math.random(1, 35)) / 600
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:13 AM
WORKS! thank you so much
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:34 AM
######################################################################################
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:35 AM
############################################################################################
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
01 Sep 2016 11:36 AM
I'm so done with this new filter. Not even going to try to post it. Can figure it out myself.
Report Abuse
badfitz60 is not online. badfitz60
Joined: 03 Sep 2010
Total Posts: 1283
01 Sep 2016 11:39 AM
put it into binary


All these questions have driven me into existential angst and I find myself beginning to question myself and my motives
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image