|
| 04 Apr 2013 12:05 PM |
Hi, I need help with an RPG game I am working on. I have a sword that has a debounce so that you don't get bonus points for attacking the dead NPC's, but it counts the debounce when you attack other NPC's (so in order to get pts you have to wait the debounce time). Is there a way I could have a debounce effect just for that 1 NPC? Thanks!
-- cardgamechampion/AlternativeAcc |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 04 Apr 2013 12:09 PM |
Check or the thing is dead ?
For example
script.Parent.Touched:connect(function(toucher) if toucher.Parent:findFirstChild("Humanoid") then if toucher.Parent.Humanoid.Health == 0 then toucher.Parent:Destroy() end end end)
That will destroy the NPC after he is death.
|
|
|
| Report Abuse |
|
|
|
| 04 Apr 2013 12:13 PM |
| Thank you for that obvious solution that never came to mind for me for no reason lol. I guess I didn't do this because I wanted them to see that the NPC's health is 0 before it goes away :P. This is a great idea until I figure out how to make the debounce work for the specific NPC though, thanks! |
|
|
| Report Abuse |
|
|
velibor
|
  |
| Joined: 24 Nov 2009 |
| Total Posts: 1003 |
|
|
| 04 Apr 2013 12:15 PM |
You can also do this :
- Put a bool value in each NPC called 'GivesPoints' - Check the boolean and determine or you should give points to the Player.
|
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 04 Apr 2013 12:17 PM |
if you want the sword to NOT hit the NPC's try:
hit = [the part which the sword hitted]
if hit.Parent:findFirstChild("Humanoid") and game.Players:findFirstChild(hit.Parent.Name) then [change health] end
just like that :) |
|
|
| Report Abuse |
|
|
|
| 04 Apr 2013 12:22 PM |
@veilbor
That will work fine
@sycips
No I want the NPC's to die, wait a few seconds, then regen, but I want the sword to not gain pts while the NPC is dead. I have it so that if the NPC is dead and you attack them with the sword, then you get pts. I will change that to if the NPC is dead and the GivesPoints Value is true then it will then it changes to false. This will be great.
Thank you so much Veilbor, you solved it XD! |
|
|
| Report Abuse |
|
|