I need help understanding this script

● ARCHIVED · READ-ONLY
Started by ZackNH 7 posts View original ↗
  1. I'm new to the forum, so I'm not sure if this is the right place to post this.

    I've been trying to put stealth into an RPG Maker VX Ace game using this script by Jet10985, but I'm having trouble with it. For some odd reason, events won't detect anything directly in their line of sight. If I'm standing off to the side, it's fine, but if I'm dead-on right in it's face, nothing.

    I know very little about scripting, so I don't have the faintest idea as to why this is happening.

    This is the script:
    [embedded media]

    I set up a test area with as few variables as possible to show what I'm talking about.

    Event that is viewing
    q4pqJDf.png

    screenshots
    Hgwm304.png qTT3wjF.pngV3pnutj.png RlWuPqz.png 19Pbz9d.png

    EDIT:
    Further testing has revealed that having a wall behind you, even when in vision, SOMETIMES hides you.

    More strange stealth
    dUG4ND3.png
    RH0p38u.png
    ScCDYb0.png
    7OeuFo1.png
    zXBWm8F.png
    XAUIgw2.png
    okzjkpV.png
  2. I've moved this thread to RGSSx Script Support. Thank you.

  3. Where do you setup the height numbers for Region IDs and Terrain Tags?
    That is most probably where you made your mistake, because without that setup the script does not know which tiles should block sight and which not.
  4. Andar said:
    Where do you setup the height numbers for Region IDs and Terrain Tags?
    That is most probably where you made your mistake, because without that setup the script does not know which tiles should block sight and which not.

    I have no regions or terrain tags set. I haven't modified anything at all. Terrains and Regions are 0 by default, so there shouldn't be any reason why I can't be seen in front of it, but can be to the side.

    Spoiler
    XBkVkoW.png

    Even when I do set Terrain Tags, they don't change anything.
    When I try to use the scripts set_terrain_height(terrain_id, number) or set_region_height(region_id, number), I always get this:
    Spoiler
    mZcIufJ.png
    This happened when I put in: set_terrain_height(1, 1)
    vm9WYft.png
    o9on2ED.png
    Setting a Terrain Tag without the script call does nothing.
    The same with Regions
    Spoiler
    RWZtr4z.png
    6YRQzKa.png
    lLa3vnP.png
    B0SRwNU.png
  5. The terrain script call error happens because of a copy/paste line forgotten how it is in the script.
    Line 453 is this:
    Code:
    def set_region_height(ter, height)
    But it should be this instead:
    Code:
    def set_terrain_height(ter, height)
    So change that and it should work.

    The second error with the region script call also happens because of a typo in the script.
    Line 482 looks like this originally:
    Code:
    $game_map.set_right_height(reg, height)
    But it should be this:
    Code:
    $game_map.set_region_height(reg, height)

    Change these lines and the crashes won't happen anymore.
  6. Sixth said:
    The terrain script call error happens because of a copy/paste line forgotten how it is in the script.
    Line 453 is this:
    Code:
    def set_region_height(ter, height)
    But it should be this instead:
    Code:
    def set_terrain_height(ter, height)
    So change that and it should work.

    The second error with the region script call also happens because of a typo in the script.
    Line 482 looks like this originally:
    Code:
    $game_map.set_right_height(reg, height)
    But it should be this:
    Code:
    $game_map.set_region_height(reg, height)

    Change these lines and the crashes won't happen anymore.

    Awesome, that fixed the crashes, and the terrain tags seem to be working normally. Thanks.

    However, I still can't be seen when standing directly in front the event. Perhaps there's another error in the script?
  7. I'm sorry if bumps aren't allowed, but my main problem wasn't fixed.

    I still can't be seen when standing in front of the event, even with no terrain tags or regions, and I don't understand why standing against a wall will sometimes make it so you can't be seen at all.