How To Disable Interaction Without Hiding the Cursor (h2)

From The Official Visionaire Studio: Adventure Game Engine Wiki
Revision as of 14:40, 18 April 2017 by AFRLme (talk) (Created page with "{| class="ts" style="width:100%" |- ! style="text-align:left" | Name !! style="text-align:left;width:10%" | By |- | Disable Interaction Without Hiding the Mouse Cursor (interf...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Name By
Disable Interaction Without Hiding the Mouse Cursor (interfaces, action parts, Lua) AFRLme


This tutorial shows you how to manually disable player interaction for events without using begin/end cutscene or show/hide cursor action parts. It also shows you how you could prevent the automatically triggered cutscene event whenever a display text / narration text action part is executed.


Tutorial

One of the first things I did was create a transparent image file the size of the default game resolution (1920x1080 in my case) & then I created a semi-transparent version of my default mouse cursor - you can create a custom cursor to indicate loading/inactive state if you prefer.

Quick note: You may also want to create a temporary image the same size of your game default resolution with a solid color as it makes it easier to draw the interface area when you can see exactly what you are working with.

After you've done sorting out those images, open up the interface section of the editor & create a new interface. Now open up the properties for the interface & assign the image with the transparent background you created to the background image section. Tick the show interface permanently option & set displacement to absolute. Now close the properties tab.


Diwhc 1.png

blah blah blah...

Diwhc 2.png

Quick note: In Visionaire Studio we can force which animation frames of an animation can be played by defining the initial & end frame using AnimationFirstFrame & AnimationLastFrame.

The little script above randomly generates a number between 1 & 20 & if the number is less than 13 then it will only play the idle part of the animation but if it equals 13 or more then it will play the idle part of the animation & then the blink part of the animation. This means that there is a 7 out of 20 chance that the character will blink at the end of the idle animations loop cycle.

Pretty straightforward, no?

Quick note: In Visionaire Studio we can force which animation frames of an animation can be played by defining the initial & end frame using AnimationFirstFrame & AnimationLastFrame.

Blink screen code.png


Tutorial #2: Double Blink

Same principal as Tutorial #1 except this time we will be adding some additional frames to the end of the animation, so that the character blinks twice, though technically I suppose you could also use a value, force the animation to play the blink frames only & increment or decrement the value until the value = 0 then force it back to the initial animation frame - actually now that I think about it, this would be a much better method as you can get a lot more creative with the amount of times the character consecutively blinks, but we'll delve into that at some other point in the future.

Right, so again, you need to begin by attaching enough blink animation frames to the end of each of your idle animations to allow your character to be able to blink twice in a row & then what you are going to do is edit the first frame & create an execute a script action part inside of the actions area for said animation frame. It should contain something along the lines of this...

blink = math.random(60)

if blink < 40 then
 ActiveAnimations["animation_name"].AnimationLastFrame = 16 -- no blink
elseif blink >= 40 and < 50 then
 ActiveAnimations["animation_name"].AnimationLastFrame = 21 -- single blink
else
 ActiveAnimations["animation_name"].AnimationLastFrame = 27 -- double blink
end

... again, the "animation_name" should be changed to the actual name of the animation you have added the little script to, & the AnimationLastFrame values should reflect the amount of frames you have used for idle, single blink & total. Remember to take into consideration that animation names are case sensitive.

Resources

Name Description
- N/A