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
 

Two dis-functional scripts If zombie is in game...

Previous Thread :: Next Thread 
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
19 Mar 2012 11:12 AM
First of all, I want.. If zombie is in game.Workspace then Zombie.Humanoid.Name = Zombie (So that it is not called Humanoid ... Zombies kill humanoids... two zombies would kill eachother)

---
Skb = Workspace:GetChilderen("Zombie")
Zombie = Skb:GetChilderen("Humanoid")

if Skb then
Zombie.Name = "Zombie"
end
---
Please fix?





Seccond of all, I want: If zombie is in game.Workspace then game.Workspace.Door is closed and game.Workspace.Door.Script does not function ---(there is only 1 door)

---
if not workspace:FindFirstChild("Skelebombers") then
workspace.Frame.Door.Script.Enabled = false
workspace.Frame.Door.CanCollide = true
else
workspace.Frame.Door.Script.Enabled = true
end --('Script' makes the door cancolide false for 3 seconds)
---


Thanks!


~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
19 Mar 2012 11:14 AM
Oops... in the second script, substitute ("Skelebombers") for ("Zombie")

~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
19 Mar 2012 11:23 AM
Bump

~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
19 Mar 2012 11:43 AM
[ Content Deleted ]
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
19 Mar 2012 03:51 PM
Bumpz

~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
19 Mar 2012 04:08 PM
Burmp

~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
03 May 2012 02:20 PM
The bit you want is in the Script inside the Zombie.

In the function findNearestTorso, tell it NOT to consider another Zombie as a target:
(Sorry that there are already caps in this one, but I will put more (and stars))



function findNearestTorso(pos) -- declare pos -- find Player & who else not to find. list = game.Workspace:children() -- a global temp var. local torso = nil local dist = 1000 --- HERE THE DISTANCE IS SET (initialized) TO "FAR AWAY!" local temp = nil local human = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) and (temp2.Name ~= script.Parent.Name) and (temp2.Name ~= "A.I.")then -- *** HERE IS THE STATEMENT THAT YOU WANT TO MOD. IT SAYS, "cONSIDER THIS AS A TARGET IF A MODEL; NOT ITSELF; NOT THE SAME .NAME AS IT; and NOT .NAMED "A.I."

The last condition is so u can tell it NOT to go after other stuff as well.

Take this line and replace the corresponding line in your Zombie FindFunction.


temp = temp2:findFirstChild("Torso") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then -- HERE THE POSITION OF SOME RANDOM, POSSIBLE (Temporary) TARGET IS COMPARED TO THE LAST DISTANCE MEASURED (below) torso = temp dist = (temp.Position - pos).magnitude --- HERE THE DISTANCE IS CALCULATED BETWEEN THE POSSIBLE TARGET AND IT. end -- closer? end -- human? end -- Model? Not us. end -- All DIST = dist -- only a player sets DIST, not a ball -- that'a a problem 'lil bit. --- HERE THAT DISTANCE IS SAVED FOR FUTURE USE IN A DIFFERENT VARIABLE CALLED, DIST. YOU COULD DO THAT........ return torso -- OR U COULD DO IT THIS WAY.........end

GL,
Brian
Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
03 May 2012 02:23 PM
if (temp2.className == "Model") and (temp2 ~= script.Parent) and (temp2.Name ~= script.Parent.Name) and (temp2.Name ~= "A.I.")then -- *** HERE IS THE STATEMENT THAT YOU WANT TO MOD. IT SAYS, "cONSIDER THIS AS A TARGET IF A MODEL; NOT ITSELF; NOT THE SAME .NAME AS IT; and NOT .NAMED "A.I."

The last condition is so u can tell it NOT to go after other stuff as well.

Take this line and replace the corresponding line in your Zombie FindFunction.

Report Abuse
BJCarpenter is online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
03 May 2012 02:32 PM
Srry,

Didn't see the second part, but I don't quite understand it anyway....

Also, change the wait() at the bottom of your Zombie script from, like, wait(.1) to wait (1).

Less lag; he doesn't have to check for a new target every tenth of a second.....

Brian
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