Large Sprite ☆ Display Fix

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Neon Black, Jan 12, 2014.

  1. Neon Black

    Neon Black The Classy Prostitute Member

    Messages:
    1,149
    Likes Received:
    368
    Location:
    Eastern US
    First Language:
    Sarcasm
    Large Sprite ☆ Display Fix
    Created by Neon Black

    What is it?

    So Ace has this slight issue with tilesets when using larger sprites which causes all star tiles to appear above the character, even if it makes more sense that the character appear above a star tile (ie. a tree).  What this script does is allow you to "tag" a particular terrain type to appear behind the player when the player is lower than the tile itself.  As long as the player's  Y value is higher than the tile with the terrain tag, the player will appear above the tile rather than below it.

    How can I use it?

    Place this script below "materials" and above "main" in the script editor.  The script works automatically for the player.  For the script to work with events, in the page with the large sprite, add a comment box and add the tag <large sprite> to the comment box.

    What does it work with?

    This script works with most anything.  Certain precautions were also taken to make this script work properly with multiple frame walk scripts and other similar scripts.  This script has no overwrites and 4 aliases, so it has better compatibility when placed below most other scripts.  This script does not work with certain Victor scripts that affect movement.

    How can I get the code?

    Version 1.3 (base script, 1.12.2014) is available from my pastebin account here.

    I would like to use this code.

    [​IMG]
    This work is licensed under a Creative Commons Attribution 4.0 International License.

    Author's Disclaimer:

    So I really don't use large sprites, but I was approached about creating this script.  So of course I did it.  There were several odd things about it before I finally perfected it, but I believe in this version it should work quite well for most needs.  Additionally since this script does not overwrite default actions, it means that star tiles can still be used how they normally work when needed.  As always it's best to see which similar script works well with what you want to do in your project, but this script I'm sure will serve most people's needs.
     
    Last edited by a moderator: Jan 24, 2014
    #1
    Nightblade50, Ally, Idril and 20 others like this.
  2. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,579
    Likes Received:
    14,274
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Tested this out hardcore and works so dayum fine~
     
    #2
    djDarkX likes this.
  3. djDarkX

    djDarkX Retro & Remastered Music Guru Veteran

    Messages:
    2,699
    Likes Received:
    1,887
    Location:
    Currently unsure...
    First Language:
    Music
    Primarily Uses:
    RMMV
    Oh man.  Since hearing about this from Archeia, I had wondered if I'd ever get my hands on this.  Dude, I love you.  Grabbing this and testing now.

    EDIT:

    Tested on my retro demo and it's PERFECT!  Where do I throw my money?
     
    Last edited by a moderator: Jan 12, 2014
    #3
  4. Neon Black

    Neon Black The Classy Prostitute Member

    Messages:
    1,149
    Likes Received:
    368
    Location:
    Eastern US
    First Language:
    Sarcasm
    You should see all the other fun things I have just sitting around waiting for release.
     
    #4
    djDarkX and Archeia like this.
  5. djDarkX

    djDarkX Retro & Remastered Music Guru Veteran

    Messages:
    2,699
    Likes Received:
    1,887
    Location:
    Currently unsure...
    First Language:
    Music
    Primarily Uses:
    RMMV
    Stop teasing me like dat meng.  Still, IF you decide to release them, you know the people who greatly appreciate your stuff will be grateful and even if you don't, no worries.  We still love you brah.
     
    #5
  6. Dark Lord

    Dark Lord Villager Member

    Messages:
    10
    Likes Received:
    1
    First Language:
    English
    Jeez,thanks for releasing this man....Real Cool and works on my system mighty fine.....Thanks!!!!...
     
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,707
    Likes Received:
    11,416
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    This can be used commercially? Awesome! I'll be checking it out over the weekend.

    So release them already and stop taunting us! So mean :(
     
    #7
  8. cabfe

    cabfe Cool Cat Veteran

    Messages:
    2,303
    Likes Received:
    2,382
    Location:
    France
    First Language:
    French
    Primarily Uses:
    RMVXA
     I guess not. Line 7 of the script says Non-commercial only...
     
    #8
  9. Shaz

    Shaz Veteran Veteran

    Messages:
    37,707
    Likes Received:
    11,416
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    #9
    djDarkX likes this.
  10. Andar

    Andar Veteran Veteran

    Messages:
    28,417
    Likes Received:
    6,483
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    #10
  11. Neon Black

    Neon Black The Classy Prostitute Member

    Messages:
    1,149
    Likes Received:
    368
    Location:
    Eastern US
    First Language:
    Sarcasm
    This may be used commercially. I'll update the header when I'm back by my laptop. The older version was non-commercial, I just forgot to change that.

    EDIT: And fixed if you guys want the updated header.
     
    Last edited by a moderator: Jan 13, 2014
    #11
    djDarkX and Shaz like this.
  12. djDarkX

    djDarkX Retro & Remastered Music Guru Veteran

    Messages:
    2,699
    Likes Received:
    1,887
    Location:
    Currently unsure...
    First Language:
    Music
    Primarily Uses:
    RMMV
    This got finally got pinned?  Should have been pinned the moment he decided to make the thread. :guffaw:
     
    #12
  13. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,579
    Likes Received:
    14,274
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    I pinned it last night a few minutes after XD
     
    #13
  14. Nosleinad

    Nosleinad Storyteller Veteran

    Messages:
    351
    Likes Received:
    28
    Location:
    Brazil
    First Language:
    Portuguese
    I must say its working perfectly, even with certain Victor scripts that affect movement.  BD

    Edit: I am using your script in conjunction with Fenix stair movements (see spoilers below). What happens is that i have to set a region for the stairs to work, and if i try to tag the terrain that has a region on it, the script wont work. Is it easy to make your script recognize terrain with set regions?

    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
    # Stairs Movement v 1.0
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
    #
    # FenixFyreX
    #
    # Final Fantasy VI had stairs that the player actually walked up. Their direction
    # became two way on these stairs, left or right. This script replicates that
    # feature.
    #
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#

    StairsRegionID = 10 # The region ID to use for designating staircases
    StairsOffset = 1 # The height of one tileset staircase plank (about 4px)
    CharAnimSpeed = 0.5 # The speed at which a sprite cycles through frames

    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
    # End of Config. Do not edit below.
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#

    class Game_Map
    def stairs?(x,y)
    region_id(x,y) == StairsRegionID
    end
    end

    class Game_CharacterBase

    # give other coders access to checking stairs status
    attr_reader :on_stairs
    alias on_stairs? on_stairs

    # check whether character is on stairs
    def check_stairs
    @on_stairs = stairs?(0)
    end

    # Checks if there are any sets of stairs in the given direction
    def stairs?(d)
    return case d
    when 0
    $game_map.stairs?(@x,@y)
    when 2
    $game_map.stairs?(@x-1,@y+1) || $game_map.stairs?(@x+1,@y+1)
    when 4
    $game_map.stairs?(@x-1,@y-1) || $game_map.stairs?(@x-1,@y+1)
    when 6
    $game_map.stairs?(@x+1,@y-1) || $game_map.stairs?(@x+1,@y+1)
    when 8
    $game_map.stairs?(@x-1,@y-1) || $game_map.stairs?(@x+1,@y-1)
    else
    false
    end
    end

    # Checks passability in the given direction for stairs
    def stairs_passable?(x, y, d)
    x2 = $game_map.round_x_with_direction(x, d)
    y2 = $game_map.round_y_with_direction(y, d)
    return false unless $game_map.valid?(x2, y2)
    return true if @through || debug_through?
    return false unless map_passable?(x, y, d)
    return false if collide_with_characters?(x2, y2)
    return true
    end

    # Moves the character in the given direction diagonally up or down stairs
    def move_diag_stairs(d, horz, vert, turn_ok)
    x,y = @x+horz,@y+vert
    horz = [4,6][[-1,1].index(horz)]
    vert = [8,2][[-1,1].index(vert)]
    @move_succeed = stairs_passable?(x,y,d)
    d = [4,6][[[4,8],[6,8],[4,2],[6,2]].index([horz,vert])%2]
    set_direction(d) if turn_ok
    if @move_succeed
    @x = $game_map.round_x_with_direction(@x, horz)
    @y = $game_map.round_y_with_direction(@y, vert)
    @real_x = $game_map.x_with_direction(@x, reverse_dir(horz))
    @real_y = $game_map.y_with_direction(@y, reverse_dir(vert))
    increase_steps
    end
    end

    # Returns the stair vector for the given direction
    def stair_vector(d)
    x,y = 0,0
    case d
    when 4,6
    x = [-1,1][[4,6].index(d)]
    y = $game_map.stairs?(@x+x,@y-1) ? -1 : 1
    when 2,8
    y = [-1,1][[8,2].index(d)]
    x = $game_map.stairs?(@x-1,@y+y) ? -1 : 1
    end
    [x,y]
    end

    # Checks whether or not the character is not getting on or off stairs
    def midstairs?
    @on_stairs && stairs?(reverse_dir(@direction))
    end

    # Alters original move method to put stairs into effect
    alias move_straight_no_stairs move_straight
    def move_straight(d, turn_ok = true)
    if on_stairs? && stairs?(d)
    move_diag_stairs(d, *stair_vector(d), turn_ok)
    else
    d = @direction if @on_stairs && [2,8].include?(d)
    move_straight_no_stairs(d, turn_ok)
    end
    check_stairs
    end

    # Shift the y coordinate of the character's sprite to compensate for stairs
    alias shift_y_for_stairs shift_y
    def shift_y(*a,&bl)
    shift_y_for_stairs(*a,&bl) + (midstairs? ? StairsOffset : 0)
    end

    # Update the sprite more to create pace-per-step effect on stairs
    alias update_anime_count_for_stairs update_anime_count
    def update_anime_count(*a,&bl)
    ac = @anime_count
    update_anime_count_for_stairs(*a,&bl)
    @anime_count += CharAnimSpeed if midstairs?
    end
    end

    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
    # End of Script
    #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=#
     
    Last edited by a moderator: Mar 5, 2014
    #14
  15. BeardBro

    BeardBro I think this line's mostly filler. Veteran

    Messages:
    211
    Likes Received:
    84
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMMV
    EDIT: Disregard my previous post; I confused region tags with terrain tags. I've been working on my project for two days straight (when I'm not at my real job), so my mind is a little weary.

    Anyways, fantastic script. It works perfectly when used with Pioneer Valley's resource packs.
     
    Last edited by a moderator: Mar 21, 2014
    #15
  16. Leonardo Myst

    Leonardo Myst Veteran Veteran

    Messages:
    39
    Likes Received:
    6
    Location:
    Louisiana
    First Language:
    English
    Forgive me for asking this... but... as I'm pretty much sticking with the High Fantasy packs but still using some resources from the RTP, I'm of course having the usual problem with overlays...

    I tried the zLevel script that came with the packs but for some reason it behaved entirely different than I expected. Instead of putting the sprites above the treetops or lamppost tops, it made them go transparent when they were up and to the right of the objects.

    So, I just found this thread and tried Neon Black's script... and... nothing seems to be happening. Still getting the same overlays I had before. What's the secret?

    Again, please forgive  me as this is my first time using any scripts. I did put the scripts under "Materials" down near the bottom. And I tried the two scripts both separate and together.

    Also... It took me so long to mess with scripts because the first script I heard that I should get was Victor's... but when I went to his site to download it, I ended up with malware because a download button popped up that apparently wasn't for his script but I couldn't cancel it.

    If someone can confirm that they can download the master script, then I'll go back and try again.
     
    #16
  17. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,579
    Likes Received:
    14,274
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    You need to set a terrain tag on the tilesets. Instructions has it '3')b
     
    Last edited by a moderator: Mar 24, 2014
    #17
  18. Leonardo Myst

    Leonardo Myst Veteran Veteran

    Messages:
    39
    Likes Received:
    6
    Location:
    Louisiana
    First Language:
    English
    Ah... you should see me assemble furniture...

    I don't normally read the instructions until after I run into a problem...

    Which.... I have done, admittedly...

    Edit:

    Ahhhhh...

    Today I learned about terrain tags. :)

    Thanks!

    Got it working!
     
    Last edited by a moderator: Mar 24, 2014
    #18
  19. Rinober

    Rinober Veteran Veteran

    Messages:
    43
    Likes Received:
    22
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Hi :)

    I'm using your script together with Pioneer Valley's graphics and it works quite well. Only one thing: Followers are still cut off in front of * fields. Works well with the main hero, but what about the second, third and fourth hero who follow my main character? Is there a solution to this problem?
     
    Last edited by a moderator: Mar 28, 2014
    #19
  20. crimcrim

    crimcrim :d Veteran

    Messages:
    904
    Likes Received:
    214
    First Language:
    English
    i seem to be having a problem when i am using multiples of the same tile. for example rows of seats in a stadium setting.
     

    when there's only one row, no problem. works excellently.

    when there's multiple rows, though, it doesn't work. the tile the player is standing on is the same as the one directly above him—is that causing the problem?
     
    #20

Share This Page