I need this for making cutscenes...
Or perhaps there is a better way to do it?
The thing is, I want to make a cutscene, where only the background of the room is visible - also the player character and
mouse cursor needs to be invisible. So I was thinking there might be a script, that could solve all these in one,
instead of having to run visible=false commands on all the elements one by one?
And another small question when we are talking cutscenes; is the best way to make cutscene fullscreen animations to create a fullscreen gif anim, or is there a better way?
Otherwise just stick to:
player.Transparency=100;
mouse.Visible=false;
An overlay seems like the best way. An overlay that gets the background image. But you still need to remove the mouse with mouse.Visible=false;
This only would be nice and easier if there are objects in the room, and you only need the background image. Otherwise just stick to:
player.Transparency=100;
mouse.Visible=false;
[/quote]
Thanks for replying!
Will an overlay also hide all GUIs and their functions? I mean, so the player will not be able to click on the invisible elements?
You can get AGS to do (at least some of) that automatically. "When player interface is disabled, GUIs should" on the general settings tab can be set to "Hide all their controls".
It's been a little bit since I actually dealt with the ordering of these things, but IIRC GUIs are always displayed on top of everything, including Overlays. Otherwise background speech (Character.SayBackground) would appear on top of your GUIs which would look rather silly. It wouldn't be that difficult to do:
// GlobalScript.asc
int CharacterTransparency[];
bool GUIVisible[];
bool ObjectVisible[];
bool mouseVisible;
bool hidden = false;
function game_start() {
CharacterTransparency = new int[Game.CharacterCount];
GUIVisible = new bool[Game.GUICount];
ObjectVisible = new bool[AGS_MAX_OBJECTS];
}
function UnHideEverything() {
if (!hidden) return;
int i = 0;
while ((i < Game.CharacterCount) && (i < Game.GUICount) && (i < AGS_MAX_OBJECTS)) {
if (i < Game.CharacterCount) character[i].Transparency = CharacterTransparency[i];
if (i < Game.GUICount) gui[i].Visible = GUIVisible[i];
if (i < Room.ObjectCount) object[i].Visible = ObjectVisible[i];
i++;
}
mouse.Visible = mouseVisible;
hidden = false;
}
function HideEverything() {
if (hidden) UnHideEverything(); // make sure we're not storing junk values!
int i = 0;
while ((i < Game.CharacterCount) && (i < Game.GUICount) && (i < AGS_MAX_OBJECTS)) {
if (i < Game.CharacterCount) {
CharacterTransparency[i] = character[i].Transparency;
character[i].Transparency = 100;
}
if (i < Game.GUICount) {
GUIVisible[i] = gui[i].Visible;
gui[i].Visible = false;
}
if (i < Room.ObjectCount) {
ObjectVisible = object[i].Visible;
object[i].Visible = false;
}
i++;
}
mouseVisible = mouse.Visible;
mouse.Visible = false;
hidden = true;
}
function on_event(EventType event, int data) {
if ((event == eEventLeaveRoom) && (hidden)) UnHideEverything();
}
The code is a bit lengthier than I might have implied, but that's just because we're storing the before state. To actually hide/unhide everything after adding these functions you would simply do:
HideEverything();
or:
UnHideEverything();
I have the nagging feeling that the solution here is going to be way easier than we may think after reading the title.
I get why the player and mouse should be invisible, what else exactly is supposed to disappear? GUIs turn off automatically, so there isn't much left.
Quote from: iamlowlikeyou on Sat 06/11/2010 15:07:02And another small question when we are talking cutscenes; is the best way to make cutscene fullscreen animations to create a fullscreen gif anim, or is there a better way?
This very much depends on what you want to show during the cutscene. Are there just some people walking around, talking maybe? In this case you don't need to animate the background at all.
Please be more specific, what's going to happen in the cutscene?
Quote from: Khris on Sat 06/11/2010 17:37:49
I have the nagging feeling that the solution here is going to be way easier than we may think after reading the title.
I get why the player and mouse should be invisible, what else exactly is supposed to disappear? GUIs turn off automatically, so there isn't much left.
Quote from: iamlowlikeyou on Sat 06/11/2010 15:07:02And another small question when we are talking cutscenes; is the best way to make cutscene fullscreen animations to create a fullscreen gif anim, or is there a better way?
This very much depends on what you want to show during the cutscene. Are there just some people walking around, talking maybe? In this case you don't need to animate the background at all.
Please be more specific, what's going to happen in the cutscene?
Oh right, sorry :)
I mean if I'm making a cutscene with fullscreen animation, like in Day of the tentacle, Sam n max, Monkey 3, etc, where all "gameplay elements" are hidden, and only the fullscreen animation runs.
What I'm wondering is, if you usually do this with a gif animation or rather some kind of rendered video?
And thanks for the replies, I'm understanding the hide functions a little better now.
Actually of those examples I'm pretty sure only CMI uses full-screen animation - the others have mainly static backgrounds with animated elements.
For true fullscreen animation it would be best to make a video and convert it to OGG Theora format - that will compress it to a much smaller size than if you use fullscreen size sprites, and the file will be compiled into the game's .exe/resource file. Also no need to hide objects etc. when playing videos.
If you set the cursor image for the wait cursor to 0 and change the GUI behavior setting to "Be hidden", having blocking code (as you'd have during a cutscene) automatically hides all the GUIs and the mouse.
I just looked at the intro of Sam'n'Max and pretty much all of it is animated sprites in front of a static background. Same for DotT.