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 » Scripting Helpers
Home Search
 

Re: I SWEAR this problem HAS to be unexplainable...

Previous Thread :: Next Thread 
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
05 Nov 2011 11:23 PM
So I'm editing the Shadow Dancer gear's dash. You know, when you double press W and then click you dash towards the place you clicked. However, I decided to make an artificial explosion at the swords when you stop the dash. I have the explosion placed perfectly each time, but its script has dumb errors...

In the Workspace, there are 3 objects excluding my avatar, camera, and terrain. There is the main baseplate, an anchored bridge-like part extending from the base to a far distance called "Part," and a single unanchored brick called "UnanchoredPart" that's on the baseplate, but near the edge of it. The explosion is supposed to launch away objects that are too close, but for some reason it's detecting what's too close and what's too far EXTREMELY oddly. Here is the code for the explosion part:



function debrisboom(part)
if (script.Parent.Position - part.Position).magnitude < 50 then
print("MAGNITUDE TEST PASSED FOR " .. part.Name .. " WITH " .. (script.Parent.Position - part.Position).magnitude )
derp = Instance.new("Part")
derp.CFrame = CFrame.new(script.Parent.Position, part.Position)
if part.Anchored == false then
print("SUCCESSFULLY BOOMED " .. part.Name )
part:BreakJoints()
for q = 1,10 do
part.Velocity = derp.CFrame.lookVector * 75
end
end
end
end

g = game.Workspace:GetChildren()

for i = 1,#g do
if g[i].className == "Model" then
if g[i]:findFirstChild("Humanoid") ~= nil then
if g[i].Name ~= script.Name then
if g[i]:findFirstChild("Torso") ~= nil then
if (script.Parent.Position-g[i].Torso.Position).magnitude < 50 then
g[i].Humanoid.Health = 0
print("KILLED PERSON BY BOOMING")
end
end
end
else
h = g[i]:GetChildren()
for z = 1,#h do
if h[z].className == "Part" then
debrisboom(h[z])
print("MODEL PART BOOMING " .. h[z].Name)
end
end
end
elseif g[i].className == "Part" or g[i].className == "Seat" or g[i].className == "VehicleSeat" or g[i].className == "SkateboardPlatform" or g[i].className == "WedgePart" or g[i].className == "CornerWedgePart" or g[i].className == "TrussPart" then --Tons of different physical object types
debrisboom(g[i])
print("DIRECT PART BOOMING " .. g[i].Name)
end
end



Also, here are examples of the outputs (take note that "EnergyBoom" is the explosion part itself):

When the explosion is about over Part:
MAGNITUDE TEST PASSED FOR Base WITH 0.60000002384186
DIRECT PART BOOMING Base
DIRECT PART BOOMING Part
DIRECT PART BOOMING UnanchoredPart
MAGNITUDE TEST PASSED FOR EnergyBoom WITH 0
DIRECT PART BOOMING EnergyBoom

When the explosion is RIGHT next to UnanchoredPart:
MAGNITUDE TEST PASSED FOR Base WITH 0.60000002384186
DIRECT PART BOOMING Base
DIRECT PART BOOMING Part
DIRECT PART BOOMING UnanchoredPart
MAGNITUDE TEST PASSED FOR EnergyBoom WITH 0
DIRECT PART BOOMING EnergyBoom

When the explosion is about just over the base:
MAGNITUDE TEST PASSED FOR Base WITH 0.60000002384186
DIRECT PART BOOMING Base
DIRECT PART BOOMING Part
DIRECT PART BOOMING UnanchoredPart
MAGNITUDE TEST PASSED FOR EnergyBoom WITH 0
DIRECT PART BOOMING EnergyBoom

As you can see, ALL OF THE OUTPUTS ARE THE SAME.

WHY IS IT DETECTING BASE EVERY TIME EVEN WHEN I'M OFF THE BASEPLATE OR WAY TOWARDS ITS EDGE, AND WHY WON'T IT DETECT THE UNANCHORED PART OR THE ANCHORED BRIDGE-LIKE PART EVEN WHEN I'M RIGHT NEXT TO THE THING?

Again, this makes no bloody sense. If SOMEONE is able to explain this, they'll gain INSTANT respect.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
05 Nov 2011 11:25 PM
tl;dr
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
05 Nov 2011 11:25 PM
By the way, the script doesn't have any actual errors; it runs fine, it's just that its detection is being awkward.
Report Abuse
DXPower is not online. DXPower
Joined: 21 Oct 2008
Total Posts: 2866
05 Nov 2011 11:28 PM
Erm, to much pressure maybe? (On the explosion).
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
05 Nov 2011 11:30 PM
That doesn't make sense. >_<

It doesn't even successfully force objects away at all because it's not properly detecting them.
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
05 Nov 2011 11:31 PM
And I should say it doesn't make sense how it says the magnitude different between the explosion and the base is SAID to be the same each time no matter where the explosion is.
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
05 Nov 2011 11:43 PM
Bump...
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
06 Nov 2011 12:00 AM
BUMP...

Come on...

Can someone at least TRY?
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Nov 2011 12:07 AM
tl;dr

But I did see that it has something to do with invisible explosions, which I had made a REALLY long time ago, so the code is a bit innefficent but here you go :


function findParts(obj,vecto,diston)
for _,v in pairs(obj:GetChildren()) do
if v:IsA("BasePart") and (vecto-v.Position).magnitude<=diston then
v:BreakJoints()
v:BreakJoints()
flap(v,100,(vecto-v.Position))
end
else
findParts(v,vecto,diston)
end end

function createIE(vec,rad)
local rad=rad or 50;
local vec=vec or Vector3.new(0,0,0);
findParts(workspace,vecto,rad)
end

Then to use it :

createIE(position_of_explosion,radius_of_explosion);

--and in case you're wondering, IE==invisible explosion :P
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Nov 2011 12:08 AM
Sorry forgot a part


function flap(shaft,press,lv)
local direction = lv
local position=shaft.Position
position = position + direction
local error = position - shaft.Position
shaft.Velocity = press*error
end

function findParts(obj,vecto,diston)
for _,v in pairs(obj:GetChildren()) do
if v:IsA("BasePart") and (vecto-v.Position).magnitude<=diston then
v:BreakJoints()
v:BreakJoints()
flap(v,100,(vecto-v.Position))
end
else
findParts(v,vecto,diston)
end end

function createIE(vec,rad)
local rad=rad or 50;
local vec=vec or Vector3.new(0,0,0);
findParts(workspace,vecto,rad)
end


--once again, really old and innefficent but it works well, sorry.
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
06 Nov 2011 12:13 AM
...I GUESS I'll try it...
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
06 Nov 2011 12:36 AM
Your script had a couple of errors which I fixed out, and I had to edit it to suit my needs.

But NOW IT'S GIVING THE EXACT SAME FREAKING RESULTS.

The magnitude detection is MESSED UP.

Sometimes it flings blocks, sometimes it doesn't, and it doesn't care about distance.

Also, as what happened before but I didn't mention, when the blocks DO fling, they don't fling in the right direction.

I bet ROBLOX broke magnitude calculation or something...

ugh
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
06 Nov 2011 01:50 AM
I give up.

I'm just going to replace it with a touch-kill script.

Dumb ROBLOX engine.
Report Abuse
cooldude816 is not online. cooldude816
Joined: 03 Jan 2009
Total Posts: 27759
06 Nov 2011 01:51 AM
Lol
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Nov 2011 02:00 AM
>I bet ROBLOX broke magnitude calculation or something...


Um, I'm pretty sure they didn't mess up on doing (x^2+y^2+z^2)^0.5;

Let me see what changes you made to my code and I can find the problem.
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
06 Nov 2011 03:39 AM
Well, the magnitude calculation works on my other tools that use it, but for some reason it won't at all with the explosion. I looked side-by-side through the different scripts to make sure I wasn't making any errors, and I wasn't.

But again, I already replaced it with just a kill script; it's not worth it anymore.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Nov 2011 10:47 AM
Are you trying to make a custom explosion?
Report Abuse
arundel is not online. arundel
Joined: 21 Apr 2008
Total Posts: 5762
06 Nov 2011 11:23 AM
Try this, it's VERY old, but has the principle of magnitude detection and then moving the brick by adding a froce.

http://www.roblox.com/Artificial-Explosion-item?id=31725652
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Nov 2011 11:31 AM
^Didn't see it, but mine's probably better. Just finished it. It's extremely accurate :3
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Nov 2011 11:34 AM
Heck mine worked perfectly back when I had to use it. My guess is that you're testing it wrong and the changes you made are breaking everything. However if it's something outdated that broke, I'm sorry, it's extremely old.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Nov 2011 11:47 AM
SDuke, would it work with models, though? You'd need to use recursion, or a way to get all baseparts in a model, or in something.
Report Abuse
SDuke524 is not online. SDuke524
Joined: 29 Jul 2008
Total Posts: 6267
06 Nov 2011 02:35 PM
> function findParts(obj,vecto,diston)
for _,v in pairs(obj:GetChildren()) do
if v:IsA("BasePart") and (vecto-v.Position).magnitude<=diston then
v:BreakJoints()
flap(v,100,(vecto-v.Position))
end
else
findParts(v,vecto,diston)
end end

Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
06 Nov 2011 04:58 PM
^I saw :o
Report Abuse
penguin38 is not online. penguin38
Joined: 08 Nov 2008
Total Posts: 1231
07 Nov 2011 08:43 PM
You guys are still posting here? >_>
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
07 Nov 2011 08:54 PM
Don't want people to post, don't make a thread.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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