Camera Target
This script allows you to set the camera to follow a particular character on the map using script calls. By default, the camera follows the player.
Download
Script: download here
Installation
Place this script below Materials and above Main
Usage
To set the camera’s target, make a script call in an event or a move route
set_camera_target(char_id)
If char_id is negative, then it is the corresponding member of the party. For example, -1 is the leader of the party, -2 is the second member, -3 is the third member.
If char_id is 0, then it is the current event that is executing the call. Note that this doesn’t work if the move route is controlling the player.
If char_id is 1 or higher, then it is the specified event. For example, char_id 5 refers to event 5 on the current map.
“Place this script below Materials and above Main”
In what? What does that mean?
Hi I’m having some trouble with the script
Whenever I playtest the game this pops up as an error:
Script ‘Game_Interpreter’ line 1411: NameError occurred.
uninitialized constant Game_Interpreter::Focus
Before you ask, yes I put it between materials and main process, please help soon
Nevermind I figured it out
I downloaded the script, but I got this error:
Script 'Camera_Target' line 68: NameError occured.
undefined method `create_game_objects' for class `Module'
How can I fix this?
Have you placed the script below Materials and above Main?
Great work Tsukihime! 😀 Thank you!
Hi!
I’m having a bit of trouble with this script, perhaps you could point out what I am doing wrong?
I want the camera to focus on the party leader, but a bit “off” on the y-axis. To do this, I edited this bit:
def center_y
(Graphics.height / 32 – 1) / 2.0
end
So now it reads “32 + 11” instead of “32 – 1”. This is exactly where I want the camera to be, and it works fine if I set the script call ID to 0 or any other event’s ID, but! If I set the script call ID to -1 (party leader), the y axis changes have no effect, and the camera remains perfectly centered.
I also noticed that if I add the following bit as a stand-alone script below Materials and above Main, the change does apply, but on every map:
class Game_Player < Game_Character
def center_y
(Graphics.height / 32 + 11) / 2.0
end
end
Sorry for the lengthy post and thank you in advance!
PS: Had this issue in a clean project with no other scripts installed.
I looked at the script and noticed that there is no logic for actually grabbing the follower if you provide a negative number smaller than -1. Maybe I was just saying I will do it and wrote it down in the documentation but never actually implemented it. Or it got taken out accidentally.
Anyways get a new copy and see if it works now.
Thank you for taking a look! Unfortunately, nothing seems to have changed =(
UPD: Actually, the Y offset does work if I set the script call ID to -2, but doesn’t if I set it to -1. Any ideas why?
Okay, I actually got it to work the way I need it to. The problem was line 154 (return unless $game_system.camera_target == self). I disabled it, modified lines 160 to 163 ($game_map.scroll_***) to fine-tune the offset a bit, and voila!
Since I only need the offset on specific maps, I also added “return unless $game_map.map_id == ***” to return the scrolling mechanic to normal on other maps.
I’m sure there’s a more elegant solution, but that’s the best I can do at the moment.
Hey nice script!
Can you add an option that instead of the camera going directly to the X event, it could move smoothly to it?
Probably not. Maybe you can see if someone has a smooth camera movement script.
Does the link for this script still work? Are there any mirrors? It seems to be the only one of it's kind I can find.
Thanks for pointing this out. I have updated the links with an alternative for now.
Hello. I just noticed that this script bugs whenever the command "Event Position" is used. It makes the camera focus somewhere in the screen (I sincerely don't know why it choses the point it choses).
I've had to stop using the script because of that, since I use some Event Position commands now and then (I hope this is the correct name of the command because my RPG Maker is in Portuguese. If it helps, "Posicionar Evento" command).
Any idea why this is happening?
Thanks.
What is the problem? How are you using that command? Are you sure the camera isn't just moving to the new position because the event the camera is centered on is now in that position?
Nope. Using "Event Position" on any event in the map just make the sceen goes black (That I think it's because it focused on a dark area in that map). I haven't even used the camera functionallity yet, it just bugs.
I have been using other script (Galv's) for camera control and I didn't have this problem anymore, if you want to check differences maybe you'll be able to deduce something.
That's unfortunetly all I know: If an event was teleported with Event Position, all went to hell.
It looks like what's happening is that whenever you move an event, the camera will automatically move to that position. There wasn't any logic to check whether the event you are moving was actually the camera's target.
The issue has been addressed.
Thanks for the great script.
It really helped me out making a cut scene.
This is my first game and first time using RPG maker.
the game is just for private use, if i ever decide to sell it i will be sure to inform you.
Thank you very much.
Disabled link
Access to this link has been disabled. Please ask the owner of the shared link to send a new link to access the file or the folder.
Download link doesn't work. 🙁
I've updated the link.
The link has been updated.
Did I seriously just realize that this can follow followers as well, or did I forget…
I added that recently when I was writing the tutorial. I also wanted to add vehicles but wasn't sure of the best way to do so since there can be custom vehicles and I want to be able to support those easily as well.