• Hey, guest user. Hope you're enjoying GameParadise! Have you considered registering for an account? Come join us and add your take to the daily discourse.
How to add Video Playback to PT for Cutscenes!

How to add Video Playback to PT for Cutscenes!
A Tutorial for Pizza Tower.

669d3b1d3daae.jpg


soooooo sigma ????????????????

Heya! Ever wanted to make cutscene's in Pizza Tower, but don't know how to code it "i n t r o s t y l e"? Well, i'll tell you how you can implement Video Playback into Pizza Tower to make the work less hard!

Couple of things to mention tho:

- Do you really expect me to use code blocks after spending an hour typing this tutorial out in Notepad++?
- You will NEED to make your cutscene a .MP4 video file.
- I have not tested it in UTMT(CE), i only know it works via Gamemaker (I WILL NEVER TELL YOU HOW TO GET A PT DECOMP!1!!11)

- It only works when going into a new room

- It's not a cutscene thing to use in bosses

- It can make the video's quality decrease in-game, since it will probably be scaled down

- You will need to place the video in the same folder as the data.win if you're using UTMT(CE), and in the "Datafiles" folder if you're using Gamemaker.

Let's start!

This guide only needs 2 things: a new object and a new room. Let's start with the room first!

ROOMS:

This system works with appart rooms for the cutscene. They will NEED to be 960 x 540, or else the cutscene will be zoomed in, all because the video is too big in terms of width and height.

You will need to put a solid box at the top of the room (not one that makes the player stuck, but where the player can move in), so that the player will not go out of bounds and the game will have a technical foul.

Also, but a big, but VERY, F'IN, BIIIIIIIIG solid under the room (just at the bottom, colliding with the room's bottom) to ENSURE that the player doesn't make the game have a technical foul.

Further, you will NEED to place the new object in the room. We will work on this next...

Extra: You can make a graphic and put it somewhere in the room to show the player it needs to press your desired key to progress from the cutscene!

OBJECT:

Let's name the object "obj_videoplayback". It fits well with what we are doing!

The object will need a create and normal draw code. I'll just give you the code and explain along the way!

CREATE:

video_enable_loop(false)

videostatus = video_get_status()

if (//what conditions you want to have to make the video play)

{

video_open("//your video")

}

1. The first line disables or enables video looping (for cutscenes i recommend "false").

2. "videostatus" will be important for later.

3. "video_open()" opens the video file, but nothing else. No drawing or sound will be used. We will add this later!

DRAW:

var _videoData = video_draw()

var _videostate = _videoData[0]

if (_videostate == 0)

{

videostatus = video_status_playing

draw_surface_stretched(_videoData[1], 0, 0, 960, 540)

}

if (videostatus != video_status_playing)

{

room_goto(//room you want the player to go to after the cutscene)

}

1. _videoData will be used to draw the video.

2. _videoState will be used to control the state of the video. Similar to the player's "states enum" system, but different.

3. Remember "videostatus"? Now we will set a state to the video to make it play.

4. "draw_surface_stretched()" is used to draw the video, and stretch it to the width and height of the room.

5. The player needs to leave the cutscene room eventually, so if it's not playing anymore, the player will be brought to a room of your choice.

BUT... what do we have here?

It looks like our player is out of bounds, and you maybe can't see anything! How do we fix this catastrophe?!?!!

Fear not! We will make it so we can skip the cutscene with a click of a key. Head back to "obj_videoplayback"'s draw code...

We need to add the following to the bottom:

if (keyboard_check_pressed(ord("//key you want the player to press")) && room == //your cutscene room)

{

video_close()

room_goto(//room you want the player to go to after the cutscene)

obj_player.x = //x coördinate the player must be at

obj_player.y = //y coördinate the player must be at

}

That's a mouthfull huh? I'll still break it down for you, coder style!

1. If the player presses a certain key of the keyboard and the room is the room tied to the cutscene you want to play, the code that follows will be executed.

2. First, the video will be closed. This will prevent drawing and audio playback of the video being executed.

3. Haven't we already set the room we want the player to go to after the cutscene? Well, i don't know why i did it again, but just go with it.

4. We will need o set the player's coördinates ourselves, since setting "obj_player.targetDoor" will still put the player out of bounds if set via this object.

Great! Now place the object in the cutscene's room, and test it! But... How do we get in there?

Simple! Just place door A, B, C, D or E in the cutscene room's box on top, and make your "obj_hallway" or door in your desired room have "targetRoom" to be set to the name of your cutscene room, and "targetDoor" set to the door you placed in the cutscene room.

I maybe have forgotten some things, or some things may not be se clear. But hey, i'm there if you have a question or error! Also, feel free to share improvements of the system in the comments!

Bye...
Author
admin
Views
250
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from admin

Back
Top