|
| 28 May 2012 06:50 PM |
How would I make it so when an arrow hits an AI it makes the AI follow the person who shot the arrow? Here is the script in the arrow in case you need info...
pellet = script.Parent damage = 1 local debounce = false
function onTouched(hit) if debounce == false then debounce = true if welded == false and hit.Parent:findFirstChild("Arrow") == nil then stick(hit) end humanoid = hit.Parent:findFirstChild("Enemy") if humanoid~=nil then tagHumanoid(humanoid) humanoid.Health = humanoid.Health - damage script.Parent:Destroy() wait(2) untagHumanoid(humanoid) else wait(2) connection:disconnect() end end debounce = false end
function tagHumanoid(humanoid) -- todo: make tag expire local tag = pellet:findFirstChild("creator") if tag ~= nil then local new_tag = tag:clone() new_tag.Parent = humanoid end end
function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end
connection = pellet.Touched:connect(onTouched)
wait(1) if welded then wait(1) end pellet.Parent = nil
Any clues? |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 06:53 PM |
No help.. WHy doesn't anyone help me? :| |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 06:54 PM |
I'll change Luas opening line a little by adding a question mark.
Hello world?
|
|
|
| Report Abuse |
|
|
| |
|
|
| 28 May 2012 06:56 PM |
| This is starting to upset me. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 May 2012 06:59 PM |
| Ninjasheep, scacman, ultralegomaster, woodstauk, SOMEONE! |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 06:59 PM |
:'( I cannot figure it out. No clue. D: |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 07:00 PM |
| *cries like a baby* I know I fail. :| |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 May 2012 07:11 PM |
| YOU HAVE TO BE KIDDING ME! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 28 May 2012 07:19 PM |
| :''''''''''''''''''''''''''''''( |
|
|
| Report Abuse |
|
|
| |
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 28 May 2012 07:27 PM |
| Well, I don't really have the life in me to physically change your script, but here's what you need to know. Most people would use :MoveTo(). That's what I would use. Check who shot the arrow, then make the AI follow the player using a loop and the :MoveTo() method. If you don't understand, look up some zombie scripts and they'll work. |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 07:29 PM |
| How would I check who shot the arrow? |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 28 May 2012 07:31 PM |
| Same way as leaderboards check who shot the bullet when a player dies. You put a value into the AI when the arrow hits it, then the AI follows the value. Value being the character's name. |
|
|
| Report Abuse |
|
|
Lucky13tm
|
  |
| Joined: 02 May 2010 |
| Total Posts: 436 |
|
| |
|
1Topcop
|
  |
| Joined: 09 Jun 2009 |
| Total Posts: 6635 |
|
|
| 28 May 2012 07:50 PM |
Before making something that advanced, start small scale. Part = Instance.new("Part",script) Hint = Instance.new("Hint",script) Part.Anchored = true Part.Touched:connect(function(h) h.Text = "The last one to touch the brick was "..tostring(game.Players:GetPlayerFromCharacter(h.Parent)) end) |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 07:51 PM |
| What's this "stick" function? |
|
|
| Report Abuse |
|
|
|
| 28 May 2012 07:58 PM |
| 1Top. I am not dumb. Before you go blabering that I know nothing how about scripting you make the script. :) |
|
|
| Report Abuse |
|
|