Difference between revisions of "An Event in Time"

From The Official Visionaire Studio: Adventure Game Engine Wiki
m
Line 40: Line 40:
 
[[File:Vs_anim_frame_actions.png|800px]]
 
[[File:Vs_anim_frame_actions.png|800px]]
  
 +
== 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.
 +
<hr>
 +
=== 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.
 +
<hr>
 +
=== 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.
 +
<hr>
 +
=== 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.
 +
<hr>
 +
=== 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.
 +
<hr>
 +
=== Send Character to Position/Object and Wait ===
 +
 +
This is actually 2 different action parts. One will lets 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 linked to the specified object. Both have wait options & will pause the action list until the character reaches the position.
 +
<hr>
 +
{| class="ts"
 +
|-
 +
| ''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.''
 +
|}
 +
<hr>
 +
=== Call/Quit Action and Wait ===
  
== Jump to Action Part ==
+
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 ==
 +
...
 +
 
 +
=== 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...
 
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 ===
+
==== 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.
 
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.
Line 58: Line 98:
  
 
<hr>
 
<hr>
=== Relative ===
+
==== Relative ====
  
 
Relative positioning is a bit more complicated as it involves jumping x amount of steps forwards or backwards & is more of a situational option to use.
 
Relative positioning is a bit more complicated as it involves jumping x amount of steps forwards or backwards & is more of a situational option to use.
Line 71: Line 111:
 
  end if
 
  end if
 
  display text "hello world" (''this action part should be where jump to 4 action parts forwards goes'')
 
  display text "hello world" (''this action part should be where jump to 4 action parts forwards goes'')
 
 
== 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 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.
 
<hr>
 
=== 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.
 
<hr>
 
 
{{toc}}
 
{{toc}}

Revision as of 20:28, 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...

if condition "cond_example" is true
pause for 500 milliseconds
change condition "cond_example" to false
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...

set random value "v_time" between 100 and 3000
pause for "v_time" milliseconds
-- additional action parts go here


Animation Frame Events

Did you know that you can edit animation frames via Anim editframev2.png & 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.

Vs anim frame actions.png

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 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 lets 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 linked to 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

...

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...

if condition "cond_example" is false (this is where the jump to action part will jump back to)
pause for 500 milliseconds
jump to action part #1
end if
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 situational option to use.

Here's a little action block example of what it might look like in use...

pause for 500 milliseconds
if condition "cond_example" is true
jump 4 action parts forwards
else
jump to action part #1 (jump back to first action part)
end if
display text "hello world" (this action part should be where jump to 4 action parts forwards goes)