# Solved setDuration()

Comments in 'Plugin Development' started by Andrey Nazarchuk, Sep 29, 2015.

1. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
Hello,
I am confused about how setDuration() in Effect works, I often see setDuration(200 * 200), but what are there two numbers in there for, and why are they multiplied? The pocketmine docs say setDuration(ticks) but it is very confusing, please explain.
2. Offline

### Gamecrafter

Joined:
Nov 20, 2014
Posts:
978
Plugins:
9
What's 200 x 200? Answer that and you'll find out. 20 ticks = 1 second
3. Offline

### MCPEPIGNotable Member

Joined:
Jun 22, 2014
Posts:
349
Minecraft User:
You don't need 200 x 200, just put how much ticks. BTW 20 ticks = One second
4. Offline

### Legoboy0215Notable Member

Joined:
Nov 1, 2014
Posts:
1,724
Minecraft User:
20 TICKS === 1 seconds
200 * 200 is a typo? So 20 seconds of effects is 20 * 20.
5. Offline

### Gamecrafter

Joined:
Nov 20, 2014
Posts:
978
Plugins:
9
People do it for convenience. I'd rather put 4 than 2 * 2.
Nothing about those two digits are typos. You're just lazy because you can't solve 200 * 200, can't you, so you made it 20 * 20.
6. Offline

### MCPEPIGNotable Member

Joined:
Jun 22, 2014
Posts:
349
Minecraft User:
Same.
7. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
I'm still confused...
8. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
ahh ok I get it... so I put 20 * (however many seconds I want?)
9. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
Why are you so....
Its ok to have php solve things for you, that's what its for....
10. Offline

### Gamecrafter

Joined:
Nov 20, 2014
Posts:
978
Plugins:
9
As you can see, I wasn't talking to you, I was talking to @Legoboy0215. Stay out of it.
11. Offline

### Hotshot_9930Notable MemberPlugin Developer

Joined:
May 26, 2014
Posts:
665
Plugins:
2
Minecraft User:
No. you can put anything, really.
But the count is in ticks and 20 ticks = 1 second.
so for example, if you wanted the effect to last for 5 seconds, the duration would be "100" because 20 x 5 = 100.
12. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
Exactly, thank you.
13. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
No I cant, I can delete it but it still may be useful to people with the same question.
14. Offline

### PEMapModderNotable MemberPlugin Developer

Joined:
Oct 9, 2013
Posts:
7,294
Plugins:
11
Minecraft User:
That has nothing to do with laziness. You know how much 200×200 is without barely thinking. The point is, it is unreasonable to use 200 as the base as 200 does not stand for any reasonable values.
15. Offline

### Andrey NazarchukActive Member

Joined:
Dec 30, 2013
Posts:
332
Minecraft User:
True, but I understand now that multiplying by 20 makes it so you don't have to convert seconds to ticks by yourself.