|
| 03 Jan 2017 08:30 PM |
I'm making a wanted system similar to that found in GTA and I've hit a snag in the script logic.
When a player kills someone, their recent_kills increases. And when it reaches a certain point their wanted_level goes up. I've got the basics set up, but I need to make a timer that detects when the last time the player killed was. That's the problem.
I need to use the Changed event to also reset the timer...
But if a player kills 2 people in a row, the event will be called twice, and two separate timers will be going?
Idk I'm just confusing myself at this point. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2017 08:42 PM |
You can use tick to make this easier.
http://wiki.roblox.com/index.php?title=Global_namespace/Functions_specific_to_ROBLOX&redirect=no#tick
|
|
|
| Report Abuse |
|
|
Laedere
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 23601 |
|
|
| 03 Jan 2017 08:43 PM |
| ^ tick wouldn't make it easier at all |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2017 09:11 PM |
| Ahhhh, that might actually help, thank you. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2017 09:13 PM |
tick wouldn't make it easier at all [2]
#code DOCTYPE! html >html< >header< >body< >p< HTML is Hyper Text Markup Language >/p< >/body< >/header< >/html< |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2017 09:14 PM |
| How wouldn't it? Is there an easier way? |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Jan 2017 10:36 AM |
whenever they kill someone just do
kills = (kills + 1) wait(3) kills = (kills - 1) |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2017 10:46 AM |
Can't do that. Because I need it based on how LONG it's been since they've killed someone. If they kill someone I need to reset the timer on how long it's been.
And doing that would fire the Changed event again, so there would be two changed events going at once, then three, and so on. |
|
|
| Report Abuse |
|
|
|
| 04 Jan 2017 10:48 AM |
what I posted can do that
if they kill 2 people within 3 seconds of each other, kills will be 2 |
|
|
| Report Abuse |
|
|
pepestan
|
  |
| Joined: 05 Jul 2011 |
| Total Posts: 515 |
|
|
| 04 Jan 2017 10:56 AM |
One way:
Timer = 0
while wait(1) do Timer = Timer + 1 end
There's a timer lol Set Timer to 0 when player is killed.
~Thanks, Pepe |
|
|
| Report Abuse |
|
|