[sloved]How to keep effects going for some seconds?

Firstly, I want to mention that English is my second language, so maybe there are some sentences which makes you confused, sorry.

I have been learning Panda3D these days.However,I’ve ran into a problem.

I want to make some speical effects that can last for some seconds and there is my code:

def ventose(self):

    global potato_HP

    if potato_HP[0] == 1 and potato_HP[1] == 0:
    if random() > .30:
        self.filters.setCartoonInk(separation = 0.8)

However, it doesn’t work, the CartoonInk effect will never been shown in my game. What I really want is to hold CartoonInk effect for about 3 seconds, while sleep() will make the whole process stop.

As a beginner, I don’t know how to do them properly.
Please give me some directions, thank you.

the first direction I feel to give to you is to enclose all your python code into the

your code here

bbcode tags (or select the code text then click to the code button when editing posts)
Regarding your issue then try to explain better what you want your code have to do because looks a bit unclear.

sorry about that, I’ve changed my post.

when it’s about timing. make sure to read the manual pages about tasks , invervals and sequences. in your case a doMethodLater task would be a good choice. a sequence would also work.

now is clear Vincent - you can use a sequence for that:

Sequence(Func(self.filters.setCartoonInk,.8), Wait(3), Func(self.filters.delCartoonInk)).start()

I’ve solved my problem with doMethodLater(), thx