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.

cameraTarget1

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.

You may also like...

38 Responses

  1. Ronnita says:

    Magnificent goods from you, man. I’ve understand your stuff previous to and you are just extremely excellent.
    I actually like what you’ve acquired here, certainly like
    what you’re stating and the way in which you say it.
    You make it entertaining and you still take care of to keep it smart.

    I cant wait to read much more from you. This is really a
    great website.

  2. Kenna says:

    You’re so cool! I don’t suppose I’ve read something like that before.

    So wonderful to find another person with a few original thoughts
    on this issue. Really.. thanks for starting this up. This
    website is one thing that is required on the web, someone with some originality!

  3. Adriann says:

    Nice blog here! Also your web site loads up fast!
    What web host are you using? Can I get your affiliate link to your host?
    I wish my website loaded up as fast as yours lol

  4. Shereese says:

    Way cool! Some very valid points! I appreciate you writing this write-up plus the rest of the
    site is also really good.

  5. Lucine says:

    Please let me know if you’re looking for a writer for your site.
    You have some really good posts and I believe I would be a good asset.

    If you ever want to take some of the load off, I’d absolutely love to write some material for your blog in exchange for a link back to mine.
    Please blast me an email if interested. Thanks!

  6. Chivonne says:

    Good answer back in return of this matter with genuine arguments and describing all regarding that.

  7. Jenesis says:

    Hi there, I discovered your blog by means of Google whilst searching for a
    comparable topic, your web site got here up, it looks good.

    I have bookmarked it in my google bookmarks.
    Hello there, simply turned into alert to your blog thru Google, and found
    that it’s truly informative. I am gonna be careful for brussels.
    I’ll be grateful in the event you proceed this
    in future. Many other people can be benefited out of your writing.
    Cheers!

  8. Sharea says:

    I do agree with all the concepts you have presented to your post.

    They are very convincing and can certainly work.

    Nonetheless, the posts are very short for
    newbies. May just you please prolong them a bit from
    subsequent time? Thank you for the post.

  9. Kendric says:

    Thanks , I’ve just been searching for information about this subject
    for ages and yours is the greatest I have found out till
    now. However, what about the conclusion? Are you positive about the
    source?

  10. Jillienne says:

    Hi my family member! I want to say that this
    post is amazing, nice written and come with almost all significant infos.
    I would like to look extra posts like this .

  11. Bevin says:

    you are in point of fact a good webmaster. The web site loading
    velocity is amazing. It sort of feels that
    you’re doing any distinctive trick. Also, The contents are masterwork.
    you’ve performed a great task in this subject!

  12. Severin says:

    Excellent, what a weblog it is! This web site provides valuable facts
    to us, keep it up.

  13. SB1 says:

    “Place this script below Materials and above Main”

    In what? What does that mean?

  14. Logan says:

    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

  15. Anime says:

    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?

  16. Nestat says:

    Great work Tsukihime! 😀 Thank you!

  17. Madlark says:

    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.

    • Hime says:

      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.

      • Madlark says:

        Thank you for taking a look! Unfortunately, nothing seems to have changed =(

        • Madlark says:

          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?

      • Madlark says:

        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.

  18. Larilol says:

    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?

  19. Mega says:

    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.

  20. Kamen Rider Legacy Project says:

    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.

    • Hime says:

      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?

      • Kamen Rider Legacy Project says:

        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.

        • Hime says:

          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.

  21. icebrain says:

    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.

  22. Anonymous says:

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

  23. Moo says:

    Did I seriously just realize that this can follow followers as well, or did I forget…

    • Hime says:

      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.

  1. February 22, 2014

    […] Script:  Camera Target […]

Leave a Reply to Hime Cancel reply

Your email address will not be published. Required fields are marked *