FOnline Development > Share Your Work

What's my plan! (critter view)

(1/1)

adumbperson:
Hey readers,

https://bpaste.net/show/ba375d0be4f4
bpaste is no more a good place for lifetime expiry...


--- Code: ---// AI debug helper
// by someone for someone who will enjoy it.
// License: do what the fuck you want with it.
// ____________________________________________
//
// HowToUse: (really? :/) "yeah! :D"
// ____________________________________________
//
// #include "_ai_debug_helper.fos"
//
// Log( npc.Id + " reason:" + plane_reason_str( reason ) + " plane:" + ai_type_str( plane.Type ) );
// ____________________________________________
//
// hint: Knowledges combination.
// ____________________________________________
//
// With care & love.

#ifndef __DEFINES__
#include "_defines.fos"
#endif

string ai_type_str( int ptype )
{
    switch(ptype)
    {
        case AI_PLANE_MISC:
            return "AI_PLANE_MISC";
        case AI_PLANE_ATTACK:
            return "AI_PLANE_ATTACK";
        case AI_PLANE_WALK:
            return "AI_PLANE_WALK";
        case AI_PLANE_PICK:
            return "AI_PLANE_PICK";
        case AI_PLANE_PATROL:
            return "AI_PLANE_PATROL";
        case AI_PLANE_COURIER:
            return "AI_PLANE_COURIER";
        default:
            break;
    }
    return "AI_UNSPEC";
}

string plane_reason_str( int preason )
{
    // Planes default priority
    switch(preason)
    {
        case REASON_GO_HOME:
            return "REASON_GO_HOME";
        case REASON_FOUND_IN_ENEMY_STACK:
            return "REASON_FOUND_IN_ENEMY_STACK";
        case REASON_FROM_DIALOG:
            return "REASON_FROM_DIALOG";
        case REASON_FROM_SCRIPT:
            return "REASON_FROM_SCRIPT";
        case REASON_RUN_AWAY:
            return "REASON_RUN_AWAY";
        case REASON_SUCCESS:
            return "REASON_SUCCESS";
        case REASON_HEX_TOO_FAR:
            return "REASON_HEX_TOO_FAR";
        case REASON_HEX_BUSY:
            return "REASON_HEX_BUSY";
        case REASON_HEX_BUSY_RING:
            return "REASON_HEX_BUSY_RING";
        case REASON_DEADLOCK:
            return "REASON_DEADLOCK";
        case REASON_TRACE_FAIL:
            return "REASON_TRACE_FAIL";
        case REASON_POSITION_NOT_FOUND:
            return "REASON_POSITION_NOT_FOUND";
        case REASON_FIND_PATH_ERROR:
            return "REASON_FIND_PATH_ERROR";
        case REASON_CANT_WALK:
            return "REASON_CANT_WALK";
        case REASON_TARGET_DISAPPEARED:
            return "REASON_TARGET_DISAPPEARED";
        case REASON_USE_ITEM_NOT_FOUND:
            return "REASON_USE_ITEM_NOT_FOUND";
        case REASON_GAG_CRITTER:
            return "REASON_GAG_CRITTER";
        case REASON_GAG_ITEM:
            return "REASON_GAG_ITEM";
        case REASON_NO_UNARMED:
            return "REASON_NO_UNARMED";
        case REASON_ATTACK_TARGET:
            return "REASON_ATTACK_TARGET";
        case REASON_ATTACK_WEAPON:
            return "REASON_ATTACK_WEAPON";
        case REASON_ATTACK_DISTANTION:
            return "REASON_ATTACK_DISTANTION";
        case REASON_ATTACK_USE_AIM:
            return "REASON_ATTACK_USE_AIM";
        default:
            break;
    }
    return "REASON_UNSPEC";
}


--- End code ---

A lil script I had done to understand critter's plan...

May this be useful for ya.

Wipe:
Why use string@ for pure log helper? string f(int) and return "UNKNOWN<"+pthing+">" as fallback, and you don't risk null exceptions in case of unknown values :)

adumbperson:
Thanks for your reply, UB are real (not that I had missed it but you are right) ;D

Sorry for that late reply... had to flee an hell (in game) and I got bored from booting up my windows to dev my FOnline... :D

Now seems like I got enough desir to try making something. or not...

And no idea if I will play...

Time will tell.

Navigation

[0] Message Index

Go to full version