shadow21234

Villager
Member
Joined
Jun 19, 2022
Messages
16
Reaction score
1
First Language
indonesia
Primarily Uses
RMMZ
hello there, i have a question i'd like to ask. right now, i'm making a skill using common event. it's basically like this:


cqRLy1CAT8.png
gdnXJndwPE.pngso what i' trying to do is i'm trying to make a skill using common event. the skill is which you can already see on the picture, will have a timer button on the common event. what i'm trying to make it do is:

when the player press the skill (which in this case is invisibilty skill), it will automatically drain 100 MP and quickly drop player's opacity to 150 then timer start (which i set up to 34 for testing purpose) and when it reaches zero, player's opacity will be back to 255 making them be seen to the enemy.

but when i test it, the only thing happen is player's opacity drop to 150 with with mp got drain by 100 and the timer starts, but when the timer reaches zero, it doesn't turn the player's opacity back to 255.
 

ATT_Turan

Forewarner of the Black Wind
Veteran
Joined
Jul 2, 2014
Messages
6,947
Reaction score
4,789
First Language
English
Primarily Uses
RMMV
Everything in an event happens at once unless you put in commands to change it.

So, following the logic of your event,
Line 2 -> Start timer for 34 seconds
Line 5 (which could be milliseconds later) -> Is the timer 0? That will always be no because you just set it to 34

You need to use a second, parallel event that's turned on by a switch in your first common event.

For this purpose, you don't even have to use the game timer. You can just have the parallel common event turn the player invisible, use 34 seconds worth of Wait command, then turn the player visible and switch off its switch.

Or you can use the timer if you really want to. Have your first event make the player invisible, set the timer and turn on a switch. The parallel common event is activated by that switch and checks for the timer to be 0 - if it is, turn the player visible and turn off the switch.

If you go the second route it will work because the parallel event is looking at the timer and then repeating itself, allowing time to lapse. Make sure to add a wait command of at least a second at the bottom, you never want parallel events to be running at their full speed of once per frame unless you know what you're doing.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
37,612
Reaction score
10,334
First Language
German
Primarily Uses
RMMV
the key is that the start of the timer and the check for timer end need to be in two different events.
and it doesn't matter if you use the main game timer, your own waits or a timerscript for this.

additionally, an item or skill can only call one common event, not both.
so you have to call the start event, and that has to enable the check event (usually a parallel process activated by switch). and the check event waits for the timer and handles the end of the timer.
 

shadow21234

Villager
Member
Joined
Jun 19, 2022
Messages
16
Reaction score
1
First Language
indonesia
Primarily Uses
RMMZ
Everything in an event happens at once unless you put in commands to change it.

So, following the logic of your event,
Line 2 -> Start timer for 34 seconds
Line 5 (which could be milliseconds later) -> Is the timer 0? That will always be no because you just set it to 34

You need to use a second, parallel event that's turned on by a switch in your first common event.

For this purpose, you don't even have to use the game timer. You can just have the parallel common event turn the player invisible, use 34 seconds worth of Wait command, then turn the player visible and switch off its switch.

Or you can use the timer if you really want to. Have your first event make the player invisible, set the timer and turn on a switch. The parallel common event is activated by that switch and checks for the timer to be 0 - if it is, turn the player visible and turn off the switch.

If you go the second route it will work because the parallel event is looking at the timer and then repeating itself, allowing time to lapse. Make sure to add a wait command of at least a second at the bottom, you never want parallel events to be running at their full speed of once per frame unless you know what you're doing.
So, what you mean is that i need two common event? One for activating it and the other using parallel event to deactivate it?
 

Latest Threads

Latest Profile Posts

Now that I have linklists on large trees and cars, is there any theme that would interest you?
Debugging multiplayer issues... I'm having fun, right?
yay_streaming.jpg

For just starting streaming on the 10th... Definitely not the worst. :LZScheeze:

Granted I need 333.34 hours a month on average to achieve money. So I don't really expect that, but it sure has helped my game dev go much faster.
Proud on how this map turned out.

FnmhDLIXgAAOvIC
I just finally fixed a huge problem that wouldn’t let my game load and would crash it.. I thought that I was gonna have to trash the project and start over lol

Forum statistics

Threads
128,330
Messages
1,193,670
Members
168,817
Latest member
Clust3rPepis
Top