设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 127|回复: 0

[转载发布] Guard AI Script 'SneakPL'

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    58883
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    68848

    灌水之王

    发表于 2026-8-1 14:06:41 | 显示全部楼层 |阅读模式
    Hi all,
             


    This script is made to:


            -give guards a simple AI,
            -give guards a line of sight,
            -enable them to follow you,
            -enable them to look for you
             


    In this script you can:


            -hide behind obstacles to avoid detection
            -hide inside objects to avoid detection (like the vase)
            -kill and carry guards (lowers speed)
            -attract guards attention by putting a corpse somewhere on their way


    Keys:


            W - hide (face the vase)
            S - go out of your hideout
            D - back stub the guard
            Q - pickup corpse
            A - drop corpse


    How to use:


            1. Download and unzip SneakPL archive,


            2. Copy all three scripts


    • SneakPL
    • PathFinder
    • Event_window

            3. Copy the guard wherever you like and set his move route.


            you are good to go


    A brief explanation:


            This is a script that lets the guards act much like those in metal gear solid. The have a certain line of sight but can't see through obstacles. The rule here is simple. The line of sight is a tree of tiles that is being checked depth first (starts in rootNode variable uses Node class) https://en.wikipedia.org/wiki/Tree_(data_structure). If one of those tiles contains an obstacle deeper nodes are not checked. In other words once behind an obstacle you can not be seen. Once detected the position of the player is clear to all guards and they will try to catch him. However you are able to flee them. When last guard looses you from the line of sight he will proceed to search for you. The algorithm takes your last seen location and direction and makes a mark 10 (appr_fields variable) fields  further in that direction. From that point the guard will choose another point within a radius of 5 (search_radius variable) and go there with hope to find you there. If not he will choose another point. This works good when there are rooms nearby. Looks quite natural. All guards will look for you for 15 seconds (alarm_time variable). After that they will go back to their starting position.


            The guards have four states


            A - attacks
            B - is being carried
            C - is searching 
            D - is dead


    Some info:


            I have made this script for my friend back in 2013. The game is long dead but maybe someone will find it useful. This was my first encounter with Ruby and first script for RPG Maker ever so please be gentle
    . Anyway if anyone finds this one interesting feel free to use it and don't forget to add me and the guys below in credits. The code has commentary in polish (log too). If anyone is interested in changing it let me know. I will translate it. 


            And for those brave and curious https://www.duolingo.com/course/pl/en/Learn-Polish-Online



    Requires:


            PathFinder by Karanum
            Event_Window by Yanfly


    Credits:


            All credits for path finding go to Karanum
            All credits for event window go to Yanfly
             

    View attachment SneakPL_6.3.zip

    View attachment SneakPL.txt


    本贴来自国际rpgmaker官方论坛作者:szajba处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/guard-ai-script-sneakpl.60849/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-8-17 23:18 , Processed in 0.139912 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表