Página 1 de 1

[SA] Medical Kit REMAKE v2.5

Enviado: 26 Jul 2020, 23:11
por Neon
Imagem
 Esse é um remake de um mod antigo do MKKJ no qual eu decidi recriar do zero podendo, adicionando configurações por .ini, compatibilidade com gamepads e adaptação ao modo de 2 jogadores e TCs. Esse mod adiciona um kit médico que pode ser carregado como arma (por padrão substitui o vibrador pequeno) e pode ser encontrado em frente a hospitais ou dentro de ambulâncias. Com ele em mãos, se agache e pressione TAB ou L1 para curar uma porcentagem de vida do seu personagem.
 
Imagem
Imagem
    Adições e mudanças:
  1. Novo modelo lowpoly baseado no GTA V, com alternativa de texturas semelhantes;
  2. Você pode trocar qual arma o kit substitui, inclusive trocar por uma adicionada sem substituir;
  3. Compatível com gamepads, incluindo vibração;
  4. Agora o segundo jogador também pode usar o kit;
  5. Agora é possível escolher a porcentagem de vida a ser curada, e caso a vida do personagem esteja acima dessa porcentagem não será possível usar o kit;
  6. Agora é possível escolher o tempo para curar o personagem;
  7. Agora você pode escolher onde os pickups de kit aparecem colocando as coordenadas dele em um arquivo .dat;
  8. Adaptação ao Hud do GTA V;
  9. Opção de substituir o pickup de vida original do jogo pelo pickup de arma ; (Removido pois continha bugs graves);
  10. Adicionado um cheat: digite MEDIKAID para ganhar um kit;
  11. Removida a opção de substituir o kit pela arma atual no mesmo slot ao entrar na ambulância, agora você só ganhará o kit caso o slot esteja livre.
Necessário CLEO+

DOWNLOAD NA MIXMODS

Agradecimentos ao Junior_Djjr por correções no código de pickups


Sources:
MedicalKit_REAbrir

Código: Selecionar tudo

// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
    LVAR_INT scplayer secplayer
    LVAR_INT iWeapId iWeapModel iTimeToHeal i hCar iCarPick iWeapSlot iWeapIdOut
    LVAR_FLOAT fLifeToHeal fCurHealth fMaxHealth
    GET_PLAYER_CHAR 0 scplayer
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponId" iWeapId
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponModel" iWeapModel
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Healing Mechanic" "TimeToHeal" iTimeToHeal
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Ambulance" "GetAmbulanKit" iCarPick
    READ_FLOAT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Healing Mechanic" "LifeToHeal" fLifeToHeal
    fLifeToHeal /= 100.0
    WHILE TRUE
        WAIT 0
        //Main Mechanic
        IF IS_CHAR_ON_FOOT scplayer
        AND IS_CURRENT_CHAR_WEAPON scplayer iWeapId
        AND IS_CHAR_DUCKING scplayer
        AND IS_PLAYER_CONTROL_ON 0
                
            PRINT_HELP_FOREVER AIDK_1
            IF IS_BUTTON_PRESSED PAD1 LEFTSHOULDER1
                IF IS_THIS_HELP_MESSAGE_BEING_DISPLAYED AIDK_1
                    CLEAR_HELP
                ENDIF
                GET_CHAR_HEALTH_PERCENT scplayer fCurHealth
                fCurHealth /= 100.0
                
                IF fCurHealth < fLifeToHeal
                    
                    REQUEST_ANIMATION BOMBER
                    WHILE NOT HAS_ANIMATION_LOADED BOMBER
                        WAIT 0
                    ENDWHILE
                    TASK_PLAY_ANIM_NON_INTERRUPTABLE scplayer BOM_plant BOMBER 4.0 0 0 0 0 iTimeToHeal
                    WAIT iTimeToHeal
                    GET_CHAR_MAX_HEALTH scplayer fMaxHealth
                    fLifeToHeal *= fMaxHealth
                    
                    i =# fLifeToHeal
                    SET_CHAR_HEALTH scplayer i
                    SHAKE_PAD PAD1 250 1000
                    ADD_AMMO_TO_CHAR scplayer iWeapId -1
                    GET_AMMO_IN_CHAR_WEAPON scplayer iWeapId i
                        IF i < 1
                            REMOVE_WEAPON_FROM_CHAR scplayer iWeapId
                        ENDIF
                    REMOVE_ANIMATION BOMBER
                ELSE
                    PRINT_NOW AIDK_2 2500 1
                ENDIF
            ENDIF
        ELSE
            IF IS_THIS_HELP_MESSAGE_BEING_DISPLAYED AIDK_1
                CLEAR_HELP
            ENDIF
        ENDIF
        
        //Cheat Code
        GOSUB cheat_code
        //Get Kit on carar
        IF iCarPick = TRUE
            IF IS_CHAR_IN_ANY_CAR scplayer
                STORE_CAR_CHAR_IS_IN_NO_SAVE scplayer hCar
                
                IF IS_EMERGENCY_SERVICES_VEHICLE hCar
                    GET_WEAPONTYPE_SLOT iWeapId iWeapSlot
                        iWeapSlot += 1
                    GET_CHAR_WEAPON_IN_SLOT scplayer iWeapSlot iWeapIdOut i i
                        
                    IF iWeapIdOut = iWeapId
                    OR iWeapIdOut = 0
                        REQUEST_MODEL iWeapModel
                        WHILE NOT HAS_MODEL_LOADED iWeapModel
                            WAIT 0
                        ENDWHILE
                        
                        GIVE_WEAPON_TO_CHAR scplayer iWeapId 1
                        MARK_MODEL_AS_NO_LONGER_NEEDED iWeapModel
                    ENDIF
                    WHILE IS_CHAR_IN_ANY_CAR scplayer
                        WAIT 0
                        GOSUB cheat_code
                    ENDWHILE
                ENDIF
            ENDIF
        ENDIF
    ENDWHILE
    cheat_code:
        IF TEST_CHEAT MEDIKAID
            REQUEST_MODEL iWeapModel
            WHILE NOT HAS_MODEL_LOADED iWeapModel
                WAIT 0
            ENDWHILE
            GIVE_WEAPON_TO_CHAR scplayer iWeapId 1
            PRINT_HELP CHEAT1
            IF IS_2PLAYER_GAME_GOING_ON
                GET_PLAYER_CHAR 1 secplayer
                GIVE_WEAPON_TO_CHAR secplayer iWeapId 1
            ENDIF
            MARK_MODEL_AS_NO_LONGER_NEEDED iWeapModel
        ENDIF
    RETURN
}
SCRIPT_END
MedicalKit_RE - CoopAbrir

Código: Selecionar tudo

// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
    LVAR_INT secplayer
    LVAR_INT iWeapId iWeapModel iTimeToHeal i hCar iCarPick iWeapSlot iWeapIdOut
    LVAR_FLOAT fLifeToHeal fCurHealth fMaxHealth
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponId" iWeapId
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponModel" iWeapModel
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Healing Mechanic" "TimeToHeal" iTimeToHeal
    READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Ambulance" "GetAmbulanKit" iCarPick
    READ_FLOAT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Healing Mechanic" "LifeToHeal" fLifeToHeal
    fLifeToHeal /= 100.0
    WHILE TRUE
        WAIT 0
        IF IS_2PLAYER_GAME_GOING_ON
            GET_PLAYER_CHAR 1 secplayer
            //Main Mechanic
            IF IS_CHAR_ON_FOOT secplayer
            AND IS_CURRENT_CHAR_WEAPON secplayer iWeapId
            AND IS_CHAR_DUCKING secplayer
            AND IS_PLAYER_CONTROL_ON 1
                    
                PRINT_HELP_FOREVER AIDK_1
                IF IS_BUTTON_PRESSED PAD2 LEFTSHOULDER1
                    IF IS_THIS_HELP_MESSAGE_BEING_DISPLAYED AIDK_1
                        CLEAR_HELP
                    ENDIF
                    GET_CHAR_HEALTH_PERCENT secplayer fCurHealth
                    fCurHealth /= 100.0
                    
                    IF fCurHealth < fLifeToHeal
                        
                        REQUEST_ANIMATION BOMBER
                        WHILE NOT HAS_ANIMATION_LOADED BOMBER
                            WAIT 0
                        ENDWHILE
                        TASK_PLAY_ANIM_NON_INTERRUPTABLE secplayer BOM_plant BOMBER 4.0 0 0 0 0 iTimeToHeal
                        WAIT iTimeToHeal
                        GET_CHAR_MAX_HEALTH secplayer fMaxHealth
                        fLifeToHeal *= fMaxHealth
                        
                        i =# fLifeToHeal
                        SET_CHAR_HEALTH secplayer i
                        SHAKE_PAD PAD2 250 1000
                        ADD_AMMO_TO_CHAR secplayer iWeapId -1
                        GET_AMMO_IN_CHAR_WEAPON secplayer iWeapId i
                            IF i < 1
                                REMOVE_WEAPON_FROM_CHAR secplayer iWeapId
                            ENDIF
                        REMOVE_ANIMATION BOMBER
                    ELSE
                        PRINT_NOW AIDK_2 2500 1
                    ENDIF
                ENDIF
            ELSE
                IF IS_THIS_HELP_MESSAGE_BEING_DISPLAYED AIDK_1
                    CLEAR_HELP
                ENDIF
            ENDIF
            //Get Kit on carar
            IF iCarPick = TRUE
                IF IS_CHAR_IN_ANY_CAR secplayer
                    STORE_CAR_CHAR_IS_IN_NO_SAVE secplayer hCar
                    
                    IF IS_EMERGENCY_SERVICES_VEHICLE hCar
                        GET_WEAPONTYPE_SLOT iWeapId iWeapSlot
                            iWeapSlot += 1
                        GET_CHAR_WEAPON_IN_SLOT secplayer iWeapSlot iWeapIdOut i i
                            
                        IF iWeapIdOut = iWeapId
                        OR iWeapIdOut = 0
                            REQUEST_MODEL iWeapModel
                            WHILE NOT HAS_MODEL_LOADED iWeapModel
                                WAIT 0
                            ENDWHILE
                            
                            GIVE_WEAPON_TO_CHAR secplayer iWeapId 1
                            MARK_MODEL_AS_NO_LONGER_NEEDED iWeapModel
                        ENDIF
                        WHILE IS_CHAR_IN_ANY_CAR secplayer
                            WAIT 0
                        ENDWHILE
                    ENDIF
                ENDIF
            ENDIF
        ENDIF
    ENDWHILE
}
SCRIPT_END
MedicalKit_RE - PickupsAbrir

Código: Selecionar tudo

// You need: https://forum.mixmods.com.br/f141-gta3script-cleo/t5206-como-criar-scripts-com-cleoplus
SCRIPT_START
{
    LVAR_INT idweap modweap // in
    LVAR_FLOAT x y z // in
    LVAR_INT scplayer i medpick pickfile mem_buffer nump
    GET_PLAYER_CHAR 0 scplayer
    IF NOT idweap = 0
        SET_SCRIPT_EVENT_SAVE_CONFIRMATION ON remove_pickup i
    ENDIF
    IF idweap = 0 // initialized by game
    
        READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponId" idweap
        READ_INT_FROM_INI_FILE "cleo\MedicalKit_RE.ini" "Weapon Settings" "WeaponModel" modweap
        
        IF DOES_FILE_EXIST "cleo/MediKitRE_Pickups.dat"
            OPEN_FILE "cleo/MediKitRE_Pickups.dat" 0x72 pickfile
            ALLOCATE_MEMORY 32 mem_buffer
            WHILE TRUE
                WRITE_MEMORY mem_buffer 32 0 0
                IF READ_STRING_FROM_FILE pickfile mem_buffer 32
                    SCAN_STRING $mem_buffer "%f %f %f" nump (x y z)
                    IF ( nump = 3 )
                        IF NOT IS_ANY_PICKUP_AT_COORDS x y z
                            STREAM_CUSTOM_SCRIPT "MediKit_RE - Pickups.cs" idweap modweap x y z
                        ENDIF
                    ENDIF
                ELSE
                    BREAK
                ENDIF
                
            ENDWHILE
            FREE_MEMORY mem_buffer
            CLOSE_FILE pickfile
        ENDIF
    ELSE
        WHILE TRUE
            WAIT 0
            IF LOCATE_CHAR_ANY_MEANS_3D scplayer x y z 100.0 100.0 100.0 FALSE
                
                IF GET_PICKUP_THIS_COORD x y z TRUE medpick
                    REMOVE_PICKUP medpick
                ENDIF
                CREATE_PICKUP_WITH_AMMO modweap 2 1 x y z medpick
                WHILE LOCATE_CHAR_ANY_MEANS_3D scplayer x y z 110.0 110.0 110.0 FALSE
                    WAIT 0
                ENDWHILE
                REMOVE_PICKUP medpick
            ENDIF
        ENDWHILE
    ENDIF
    remove_pickup:
    IF GET_PICKUP_THIS_COORD x y z TRUE medpick
        REMOVE_PICKUP medpick
    ENDIF
    RETURN_SCRIPT_EVENT
}
SCRIPT_END

Re: [SA] Medical Kit REMAKE v2.0

Enviado: 27 Jul 2020, 17:07
por Penguinumber9
Bem melhor que o antigo, vai ser um mod que nunca irei remover (A menos que surja algum Crash). O que estraga mods bons é não poder usar o controle com eles, ainda bem que você adaptou nesse mod, gostei.

Re: [SA] Medical Kit REMAKE v2.0

Enviado: 29 Jul 2020, 14:56
por Junior_Djjr
O ícone tava com bordas brancas e o pickup era vermelho enquanto o kit era branco (no verde, ambos eram verdes, o que parece ter sido um erro).
Eu botei opção de branco, vermelho e verde pra não ter erro.
https://www.mixmods.com.br/2020/07/medical-kit.html

Re: [SA] Medical Kit REMAKE v2.0

Enviado: 29 Jul 2020, 15:44
por Neon
Junior_Djjr escreveu:
29 Jul 2020, 14:56
(no verde, ambos eram verdes, o que parece ter sido um erro).
Foi proposital, no mod original o pickup de vida era vermelho e a arma branca, assim como na opção verde, mas na hora de fazer o do GTA V achei mais interessante usar os dois iguais pra pessoa ter o do GTA V nos dois casos
Por enquanto não tem problema, mas caso eu vá atualizar pra fazer aquela parada de substituir o coração pela arma eu faço um ícone branco com verde já que acho que vai ser importante diferenciar
Junior_Djjr escreveu:
29 Jul 2020, 14:56
O ícone tava com bordas brancas
Isso eu tentei seguir o teu tutorial de várias formas mas nenhuma funcionou aqui

Re: [SA] Medical Kit REMAKE v2.0

Enviado: 03 Ago 2020, 15:13
por Neon
Atualizado (v2.1):
  • Adicionada versão branca e verde pro ícone ;
  • Adicionada adaptação pro GTA V Hud ;
  • Adicionada opção no ini pra substituir o pickup de vida original do jogo pelo pickup de arma.

Re: [SA] Medical Kit REMAKE v2.1

Enviado: 04 Ago 2020, 01:02
por Neon
Atualizado (v2.2):
  • Corrigido erro grave na criação de pickups e melhorando funcionamento. Agradecimentos ao Junior_Djjr.

Re: [SA] Medical Kit REMAKE v2.2

Enviado: 16 Ago 2020, 15:59
por Neon
Atualizado (v2.3):
  • Removida a opção de substituir o pickup de vida original do jogo pelo de kit médico, pois causava bugs que podiam corromper o save da pessoa. O mod ainda substitui o modelo do pickup de vida por um modelo alternativo do kit.

Re: [SA] Medical Kit REMAKE v2.2

Enviado: 18 Ago 2020, 23:01
por HzanRsxa2959
Hey. I see that you were having problems with pickups.

I have managed a workaround:
https://drive.google.com/file/d/10qiDA9 ... sp=sharing
Mirror:  https://sharemods.com/trl9y5chf2wu/Medi ... d.zip.html

I had to edit you  MediKit_RE - Pickups.cs  file. I hope you don't mind.

I used a method with a custom script that I was going to release, called  AddNonSavingPickup . It works by create a temporary pickup, then recreating it every time its lifetime runs out. Meaning that pickups are not saved with the game.

I though I should test a mod, and I chose this one. It works pretty great, however there are a few concerns:
  1. Temporary pickups disappear whenever the game is saved. But since there is no way to check if the game was saved in CLEO (03D9 doesn't work according to my experience), I instead check whenever the menu was closed.
  2. If someone could provide me with the memory address that holds the regeneration time for pickups, I could add an option for default pickup  regeneration time.
If you have any concerns or anything else, I'd be happy to help.
I will release my custom script soon.

Re: [SA] Medical Kit REMAKE v2.2

Enviado: 19 Ago 2020, 16:29
por Neon
HzanRsxa2959 escreveu:
18 Ago 2020, 23:01
I used a method with a custom script that I was going to release, called  AddNonSavingPickup . It works by create a temporary pickup, then recreating it every time its lifetime runs out. Meaning that pickups are not saved with the game.
This is already on my script in a similar form; the pickup is only created if the player is near and automatically destroys itself if the player is far from it (that mechanic was made by Junior_Djjr). It also has an option to delete the pickups if you have saved near them. If this was about the heart pickups, I don't have any plans to add it any soon, but thanks for your consideration anyways

Re: [SA] Medical Kit REMAKE v2.3

Enviado: 19 Ago 2020, 17:55
por HzanRsxa2959
I understand. Thanks for the reply.
Junior knows his stuff:
f16-utilidades/t4914-cleo-addnonsavingpickup#p30934
Already found concerns with my script.

Dang, the pickup system is a messy part of the game. Oh well. Guess I will try to fix bugs that can be fixed in CLEO.

Re: [SA] Medical Kit REMAKE v2.4

Enviado: 05 Dez 2020, 00:17
por Neon
Atualizado (v2.4):
  • Agora o script utiliza mais dos recursos da CLEO+, o código no geral é o mesmo mas ficou mais polido e organizado
  • Agora o mod checa se o carro é uma ambulância ao invés de checar o id, isso fará com que no futuro ambulâncias adicionadas pelo model_special_features do FLA também te deêm um kit médico.
  • Agora os pickups não ficam mais presos no jogo e a opção de fazer eles não aparecerem no .ini foi removida (basta descomentar/remover as coordenadas no arquivo .dat pra eles não aparecerem)
  • Agora caso você coloque uma coordenada no .dat que já tenha um pickup, ele será removido. Isso é útil pois assim você pode trocar o id da arma livremente sem se preocupar com o pickup da arma antiga, e também substituir um pickup de coração ou outro tipo de pickup no mapa pelo de kit.

Re: [SA] Medical Kit REMAKE v2.4

Enviado: 05 Dez 2020, 00:52
por Neon
Atualizado (05/12 01:51):
  • Tinha esquecido de uma linha no código que quebrava o script de pickups, corrigido.

Re: [SA] Medical Kit REMAKE v2.4

Enviado: 21 Fev 2021, 13:51
por Neon
Atualizado 2.5:
  • Corrigido um erro no código que fazia não curar a porcentagem correta.