Pesquisa resultou em 1 ocorrência

por Stealth760
27 Jun 2018, 06:42
Fórum: Scripts & Códigos
Tópico: Health Indicator
Respostas: 1
Exibições: 492
Gênero:

Health Indicator

Esse mod adiciona um indicador de vida em números nos NPC's mirados pelo Player
health_indicator.zip
(1.37 KiB) Baixado 5 vezes
health_indicator.zip
(1.37 KiB) Baixado 5 vezes

Imagem

SpoilerAbrir
Source

Código: Selecionar tudo

/*-----Criado por Stealth760-----*/
SCRIPT_START
{
    LVAR_INT hChar
    LVAR_INT vida iFont icRed icGreen icBlue icAlpha iAlpha
    LVAR_FLOAT x y z fLargura fAltura

    GOSUB readini

///////////////////////////////////////////////////
    WHILE TRUE
        WAIT 0

        IF IS_PLAYER_PLAYING 0
            WHILE GET_CHAR_PLAYER_IS_TARGETING 0 hChar
                IF hChar > 0
                    GET_OFFSET_FROM_CHAR_IN_WORLD_COORDS hChar 0.0 0.0 1.0 (x y z)

                    IF CLEO_CALL Convert3DToScreen2D 0 (x y z)(x y fLargura fAltura)
                        USE_TEXT_COMMANDS 1
                        SET_TEXT_CENTRE TRUE
                        SET_TEXT_FONT iFont
                        SET_TEXT_SCALE fLargura fAltura
                        SET_TEXT_EDGE 1 icRed icGreen icBlue icAlpha

                        GET_CHAR_HEALTH hChar vida
                        IF vida > 70
                            SET_TEXT_COLOUR 0 255 0 iAlpha
                        ELSE
                            IF vida > 30
                                SET_TEXT_COLOUR 255 255 0 iAlpha
                            ELSE
                                SET_TEXT_COLOUR 255 0 0 iAlpha
                            ENDIF
                        ENDIF

                        DISPLAY_TEXT_WITH_NUMBER x y number vida
                        USE_TEXT_COMMANDS 0
                    ENDIF
                ENDIF
                WAIT 0
            ENDWHILE
        ENDIF
    ENDWHILE
///////////////////////////////////////////////////

readini:
    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Fonte" iFont
        iFont = 1
    ENDIF

    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Transparencia" iAlpha
        iAlpha = 255
    ENDIF

    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Contorno_RED" icRed
        icRed = 0
    ENDIF
    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Contorno_GREEN" icGreen
        icGreen = 0
    ENDIF
    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Contorno_BLUE" icBlue
        icBlue = 0
    ENDIF
    IF NOT READ_INT_FROM_INI_FILE "cleo\health_indicator.ini" "MAIN" "Contorno_ALPHA" icAlpha
        icAlpha = 128
    ENDIF
RETURN

}
SCRIPT_END

{
    LVAR_FLOAT x y z // In
    LVAR_FLOAT fScreenPosX fScreenPosY
    LVAR_FLOAT fHeight fWidth
    LVAR_FLOAT fBoundingBoxMaxZ
    LVAR_INT i pfOriginPos pfScreenPos pfHeight pfWidth

    Convert3DToScreen2D:
    GET_VAR_POINTER fHeight (pfHeight)
    GET_VAR_POINTER fWidth (pfWidth)
    GET_VAR_POINTER x (pfOriginPos)
    GET_VAR_POINTER fScreenPosX (pfScreenPos)
    //char __cdecl CSprite::CalcScreenCoors(RwV3d *in, RwV3d *out, float *w, float *h, char checkMaxVisible, char checkMinVisible)
    CALL_FUNCTION_RETURN 0x70CE30 6 6 (TRUE TRUE pfHeight pfWidth pfScreenPos pfOriginPos)(i)
    IF NOT i = FALSE
    AND fHeight > 10.0 // only draw if the returned size is not too small: not too far away

        // Convert/Tweak font size
        fWidth /= 100.0
        fHeight /= 50.0

        // Convert screen values to GTA ones
        CLEO_CALL GetXYSizeInScreenScaleByUserResolution 0 (fWidth fHeight)(fWidth fHeight)
        CLEO_CALL GetXYSizeInScreenScaleByUserResolution 0 (fScreenPosX fScreenPosY)(fScreenPosX fScreenPosY)

        RETURN_TRUE
        CLEO_RETURN 0 (fScreenPosX fScreenPosY fWidth fHeight)
    ENDIF
    RETURN_FALSE
    CLEO_RETURN 0 (0.0 0.0 0.0 0.0)
}

{
    LVAR_FLOAT fX fY //In
    LVAR_INT iResX iResY
    LVAR_FLOAT fResX fResY
    GetXYSizeInScreenScaleByUserResolution:
    READ_MEMORY 0xC17044 4 FALSE (iResX)
    READ_MEMORY 0xC17048 4 FALSE (iResY)
    fResX =# iResX
    fResY =# iResY
    fResX /= 640.0
    fX /= fResX
    fResY /= 448.0
    fY /= fResY
    CLEO_RETURN 0 fX fY
}

Voltar para “Health Indicator”