|
| 06 Oct 2012 08:29 PM |
Ok, so, making this really nice idea of a game. I am trying to make it where if a certain weapon such as a bow or arrow hit the model, it takes the damage given my that weapon. As I was looking at a bow script from the ROBLOX Catalog, I saw it said: "local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then taghumanoid(humanoid) humanoid.Health = humanoid.Health - damage"
If put another section in the script where it describes the humanoid in a model like this, could I perhaps make it damage the model? |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2012 08:31 PM |
| All humanoids are in models, so yes. You could make a model that's not a character and put a humanoid in it. The only problem with this is that you have a little floaty bar over your model that I don't know how to get rid of (yet). |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2012 08:34 PM |
| I wish I could just display the health using a number value instead of a bar. Like for instance, 200, instead of =======. Get my point? Also, thank you for answering. I am testing it now. |
|
|
| Report Abuse |
|
|
mazer246
|
  |
| Joined: 13 Sep 2007 |
| Total Posts: 412 |
|
|
| 06 Oct 2012 08:41 PM |
| You can, use a billboard object and have the text display the current health of the humanoid. Also you can remove the health bar and name by setting the head of the model invisible. |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2012 08:43 PM |
| For some reason, when I put a Humanoid inside the brick and tested it in Play Solo Mode, it didn't work. It is simply a brick > Humanoid. Am I missing something? |
|
|
| Report Abuse |
|
|
mazer246
|
  |
| Joined: 13 Sep 2007 |
| Total Posts: 412 |
|
|
| 06 Oct 2012 08:49 PM |
| The humanoid has to be in a model with the brick. Also there has to be a brick named Head in the model as that is where the game puts the health and name above. |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2012 09:08 PM |
Ok, so, that all worked, thanks! Now, my next challenge is to set the model on fire and have it slowly disappear(transparency) and then when transparency is 1, the brick deletes itself from the workspace. I don't know how to set the fire up, but I think I would put a script inside the model like this: for i = 0, 1, -0.1 do if script.Parent.Humanoid.Health >= 0 then script.Parent.Head.Transparency = i end end if script.Parent.Head.Transparency = 1 then script.Parent:Destory() end |
|
|
| Report Abuse |
|
|
mazer246
|
  |
| Joined: 13 Sep 2007 |
| Total Posts: 412 |
|
|
| 06 Oct 2012 09:15 PM |
create the fire with fire = Instance.new("Fire") fire.Parent = where do you want teh fire? |
|
|
| Report Abuse |
|
|
|
| 06 Oct 2012 09:21 PM |
New script:
for i = 0, 1, 0.1 do if script.Parent.Humanoid.Health <= 0 then script.Parent.Head.Transparency = i end end
if script.Parent.Humanoid.Health <= 50 then script.Parent.Head.Fire.Enabled = true end
if script.Parent.Head.Transparency == 1 then script.Parent:Destroy() end
--But it still doesn't work |
|
|
| Report Abuse |
|
|
Stackings
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 157 |
|
|
| 15 Nov 2012 07:10 PM |
First of all, the method for removing objects is ":remove()", unless there's another method for that and I'm an idiot. Also, there's an Event for the death of a Humanoid. It's "Died()". So when the Humanoid dies you can use:
script.Parent.Humanoid:Died(function () for i=0, 1, .1 do script.Parent.Head.Transparency=i end script.Parent:remove() end)
which will make the Head slowly fade away when the Humanoid dies and will remove the entire model after the For loop since it won't run till the loop finishes. If you want to make the humanoid on fire, you'll have to use an if statement and Instance a fire into the head like this:
if script.Parent.Humanoid.Health <= script.Parent.Humanoid.MaxHealth/2 then local fire = Instance.new("Fire", script.Parent.Head) end
because the "Fire" object has to be Instanced into the brick, it's not a property OF the brick.
And, if you don't want the health to be displayed, you can just make another brick inside the model that's the Head and has its Transparency set on full 1, making the nametag not show up, but if you do this, remember to set the thing you want to change the name of the original brick in the script, also.
Good luck with your scripting :D |
|
|
| Report Abuse |
|
|
|
| 15 Nov 2012 07:51 PM |
@Stackings
Wow, you are quite late. :Destroy() is the newer way to remove something, and it is more efficient. |
|
|
| Report Abuse |
|
|
Stackings
|
  |
| Joined: 21 Mar 2010 |
| Total Posts: 157 |
|
| |
|
|
| 15 Nov 2012 09:45 PM |
Edit the bow to change a value
Put a value in the model
Add a "if script.Parent.Health.Value == 0 then
And then have the bow do - 1 to the value |
|
|
| Report Abuse |
|
|
864154
|
  |
| Joined: 05 May 2012 |
| Total Posts: 35 |
|
|
| 16 Nov 2012 10:46 PM |
| Remember..Some Models Come with Health, Some Don't the only way to do that is to make your own model! |
|
|
| Report Abuse |
|
|
Locky2013
|
  |
| Joined: 14 Feb 2012 |
| Total Posts: 2401 |
|
|
| 16 Nov 2012 11:29 PM |
| Ok mr. "Good Scripter", lol. |
|
|
| Report Abuse |
|
|
864154
|
  |
| Joined: 05 May 2012 |
| Total Posts: 35 |
|
|
| 28 Dec 2013 10:06 PM |
| Derp. I was a Noob back then. Now I make my Own Scripts/ Models without Health Bar/ and other things. :D |
|
|
| Report Abuse |
|
|