|
| 17 Sep 2011 07:40 PM |
I'm going to try and make a script that when activated (by contact) it would negate another script. Here is an exaple; A projectile that when it hits a tank, the projectile's script negates the tanks script for moving and firing for a certain amount of tim, therefore crippling the tank.
Any suggestions on how to make a script that can do that? |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 07:45 PM |
A Touched function connected to the rocket. An if statement to find out if what's hit is a tank. A line that removes/disables the moving script in the tank. Ends. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 07:48 PM |
| Thank you very much i really apreciate your help :) |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 07:51 PM |
| No problem, we're here to help. |
|
|
| Report Abuse |
|
|
Lyeph
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 28 |
|
|
| 17 Sep 2011 07:51 PM |
| You can always disable the person's tool, thus, making it immobile and unable to shoot. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 07:52 PM |
| Sorry another question. What do you mean by an if statement and how would you script one? Sorry I'm not really the best scrpter in the world and im trying to learn and get better at it :) |
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 17 Sep 2011 07:55 PM |
| Your going to need to modify the tank firing script so it detects the damage. For damage, you could use a value object. |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 07:59 PM |
http://wiki.roblox.com/index.php/Conditional_statements
An if statement does as it's name implies, it basically asks 'if something then'.
An example, I'll make a statement with my name.
Name = "jjjakey"
if Name == "Notjjjakey" then Print("This can't happen, because jjjakey is not equal to Notjjjakey") end |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 08:00 PM |
| Now that Im thinkingabout it more it seems like its going to be several scripts that are all conected by one script. Like a Linked Script System? That sound catchy xD |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 08:00 PM |
== 'Is equal to' ~= 'Not equal to' > 'Is greater than' < 'Is less than' >= 'Is greater than or equal to' <= 'Is less than or equal to'
This is everything you can use in an if statement. |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 08:03 PM |
| jjjakey is there a wiki link for touch funtions? |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 08:07 PM |
http://wiki.roblox.com/index.php/Touched_(Event) http://news.roblox.com/index.php/Event http://wiki.roblox.com/index.php/Absolute_beginner's_guide_to_scripting
These are the best pages I could find.
First one is only a small bit of information, but has an example. Second is for events in a whole. Last is the Absolute Beginner's guide, which has a Touched example, and an if statement example. |
|
|
| Report Abuse |
|
|
Lyeph
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 28 |
|
|
| 17 Sep 2011 08:07 PM |
function whatever1(whatever2)
something.Touched:connect(whatever1)
something.Touched:connect(function(whatever1)
end) |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2011 08:13 PM |
| Im gonna be honest and say this is to far above my head and Im gonna have to get some help making this but thank you guys for the information you have given me. |
|
|
| Report Abuse |
|
|
jjjakey
|
  |
| Joined: 15 Sep 2008 |
| Total Posts: 13014 |
|
|
| 17 Sep 2011 08:16 PM |
Actually, this is quite easy.
I suggest making a standard Touched function on your own, then add an if statement to it.
More you do it, easier it becomes. |
|
|
| Report Abuse |
|
|
Lyeph
|
  |
| Joined: 16 Sep 2011 |
| Total Posts: 28 |
|
|
| 17 Sep 2011 08:21 PM |
I've actually started using the connect line first in my scripts, lol. Example:
part = game.Workspace.Part partp = part.Position script.Parent.Touched:connect(function(person) if person.Parent:IsA("Character") then person.Parent.Torso.Position = partp + Vector3.new(0, 2, 0) end end) |
|
|
| Report Abuse |
|
|