Timers help
#1

So I got this problem with delivers, delivers basically have a van, and when a player enters it, it start filling up with materials and drugs. So, every second a have a timer execute and it sets the timer up by 1 (and so on till 60 seconds). What I want to do is this:
The deliver delivers 1000 materials and 100g of drugs.
I want to show the amount of materials and drugs in the van (they are not really there, just for the look, they can't leave the deliver place until it's full of materials and drugs [60 seconds], so yeah.).

Let me demonstrate:

example:
10/1000 materials

10/100 drugs

and a second after:

20/1000 materials

20/100 drugs.

Basically for it to hit 1000 materials and 100 drugs right when the time hits 60 seconds.
Thanks.
Reply
#2

You need to do 1000 / 10 = 100 iterations in 60 seconds; one iteration every 60 / 100 = 0.6 seconds = 600 milliseconds. Math. In the timer do a range-check or something and abort if the player leaves the area.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)