Difference between revisions of "An Event in Time"
Line 80: | Line 80: | ||
This will pause the current action list until the specified value meets the same target value as the secondary linked value. The reason this method is dynamic is because both values can be manipulated which means that the secondary value could be repurposed for multiple situations. | This will pause the current action list until the specified value meets the same target value as the secondary linked value. The reason this method is dynamic is because both values can be manipulated which means that the secondary value could be repurposed for multiple situations. | ||
+ | <hr> | ||
+ | {| class="ts" | ||
+ | |- | ||
+ | | ''Quick note: There are multiple operators you can use for querying values, which allows a lot of freedom when it comes to querying values.'' | ||
+ | |- | ||
+ | | ''= equals.'' | ||
+ | |- | ||
+ | | ''!= does not equal.'' | ||
+ | |- | ||
+ | | ''<= less than or equal to.'' | ||
+ | |- | ||
+ | | ''< less than.'' | ||
+ | |- | ||
+ | | ''>= greater than or equal to.'' | ||
+ | |- | ||
+ | | ''> greater than.'' | ||
+ | |} | ||
<hr> | <hr> | ||
=== Wait until Character Stops Speaking === | === Wait until Character Stops Speaking === |
Revision as of 20:41, 1 August 2022
On this page you will find a bunch of tips & tricks related to events, loops, & timing methods that you can use to control exactly when specific events &/or state changes (via values/conditions) should occur in your game projects.
Anyway, let's crack on...
Pause (static)
The simplest method for controlling time is to use the pause action part. The pause action part will prevent any action parts created after it from executing until the pause has finished.
Quick note: The pause action part allows you to specify the time in milliseconds, seconds, or minutes; however I highly recommend that you use milliseconds because it allows you to input precise time values. |
Anyway, here's an example of the pause action part being used with some other action parts...
1. if condition "cond_example" is true 2. pause for 500 milliseconds 3. change condition "cond_example" to false 4. end if
Pause (dynamic)
The same action part above can also be used to create dynamic pauses, which can be really useful for making your game projects feel more alive & less like a broken record stuck in a never-ending loop.
To setup dynamic pauses you will need to create a value that you can link to the pause action part. The integer number belonging to values can be modified at any time via action parts or script; however we will only be covering action parts for now to keep things as simple as possible.
Anyway, let's just assume you have created a value somewhere inside of the Visionaire Studio editor & have called it "v_time". Right, let's see an example of what a dynamic pause would look like inside of an action block...
1. set random value "v_time" between 1000 and 5000 2. pause for "v_time" milliseconds 3. play animation "anim_example" and wait 4. jump to action part #1
Animation Frame Events
Did you know that you can edit animation frames via & assign sounds & actions to each individual animation frame? This is actually a really great method for precision timing based events as they are tied to animation frames instead of the frames per second (fps) that your game is running on each players device. It's much more accurate than using the pause action part.
Wait Actions
Some action parts have an additional option called wait, which enabled will tell the engine to pause the action list until the action or animation has finished. These wait options are optional & can also be very useful for controlling the timing of when certain events should occur.
Play Animation and wait
This will start an animation & pause the action list that you execute this action in until the animation finishes, however you do need to be careful not to use this option on animations that are set to infinite loop as the action list will be paused indefinitely due to the animation never ending.
Wait until Animation is Finished
Same as above, but this action part is meant to be used on an already playing animation. & again be careful not to use this option on animations that are set to infinite loop as the action list will be paused indefinitely due to the animation never ending.
Wait until Sound is Finished
This action part will pause the action list that you execute this action in until the linked sound stops playing, however just like play animation and wait you need to be careful that you don't link to a sound that is looping as the action list will be infinitely due to the sound never ending.
Wait until Condition was Changed
This will pause the current action list until the condition is changed from whatever it currently is or until it's changed to the specified boolean state.
Quick note: There are 3 options available. |
1. Changed: wait until condition is changed to the opposite of its current state. |
2. True: wait until condition is changed to true. |
3. False: wait until condition is changed to false. |
Wait until Value was Changed (static)
This will pause the current action list until the specified value target is met.
Wait until Value was Changed (dynamic)
This will pause the current action list until the specified value meets the same target value as the secondary linked value. The reason this method is dynamic is because both values can be manipulated which means that the secondary value could be repurposed for multiple situations.
Quick note: There are multiple operators you can use for querying values, which allows a lot of freedom when it comes to querying values. |
= equals. |
!= does not equal. |
<= less than or equal to. |
< less than. |
>= greater than or equal to. |
> greater than. |
Wait until Character Stops Speaking
Pauses the current action list until the specified character stops talking; or just continue executing the action parts if the character wasn't talking to begin with.
Wait until Character Stops
Pauses the current action list until the specified character stops walking; or just continue executing the action parts if the character wasn't walking to begin with.
Send Character to Position/Object and Wait
This is actually 2 different action parts. One will let you send the character to a specified position in the current scene & the other will let you tell the character to walk to the position defined in the specified object. Both have wait options & will pause the action list until the character reaches the position.
Quick note: The destination position isn't what the engine is listening out for, it's actually listening out for when the character stops walking so you may want to use these 2 action parts inside of cutscene wrappers to prevent the player from being able to interrupt the destination position/object by left clicking elsewhere in the scene. |
Call/Quit Action and Wait
This action part allows you to call another existing action block. You can optionally tell the current action list to wait until the other action block you call finishes iterating through all the action parts/scripts listed inside of it - I don't know if you can chain this action through multiple action blocks, but maybe one of you want to try it out & let me (AFRLme) know?
Loops
This section is going to get a bit complicated as we are going to start delving into the scripting side of things, as well as some conventional & unconvential methods via action parts & animations.
Jump to Action Part
The jump to action part action part is one of the methods that you can use for creating loops inside of the Visionaire Studio editor without having to resort to scripting. There are 2 ways that you can use the jump to x action part, which are...
Absolute
This is the option you would probably be using most of the time & it's the simplest method as you simply tell the engine to jump to x action part inside of the current action block. For example #1 would be the first action part in the list aka the top of the list.
Here's a quick example of what the action block might look like...
1. if condition "cond_example" is false 2. pause for 500 milliseconds 3. jump to action part #1 (jump back to first action part) 4. end if 5. display text "hello world" (if condition "cond_example" is true then this would be executed instead)
Relative
Relative positioning is a bit more complicated as it involves jumping x amount of steps forwards or backwards & is more of a situation based.
Here's a little action block example of what it might look like in use...
1. pause for 500 milliseconds 2. if condition "cond_example" is true 3. jump 4 action parts forwards (0) 4. else (1) 5. jump to action part #1 (2) 6. end if (3) 7. display text "hello world" (4)
Contents
- 1 Pause (static)
- 2 Pause (dynamic)
- 3 Animation Frame Events
- 4 Wait Actions
- 4.1 Play Animation and wait
- 4.2 Wait until Animation is Finished
- 4.3 Wait until Sound is Finished
- 4.4 Wait until Condition was Changed
- 4.5 Wait until Value was Changed (static)
- 4.6 Wait until Value was Changed (dynamic)
- 4.7 Wait until Character Stops Speaking
- 4.8 Wait until Character Stops
- 4.9 Send Character to Position/Object and Wait
- 4.10 Call/Quit Action and Wait
- 5 Loops