Aldeia RPG

Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.

Suporte ao desenvolvimento de jogos


2 participantes

    Item Random

    Nando Moura
    Nando Moura
    Novato
    Novato


    Mensagens : 20
    Créditos : 1

    Ficha do personagem
    Nível: 1
    Experiência:
    Item Random Left_bar_bleue0/0Item Random Empty_bar_bleue  (0/0)
    Vida:
    Item Random Left_bar_bleue30/30Item Random Empty_bar_bleue  (30/30)

    Item Random Empty Item Random

    Mensagem por Nando Moura Ter Mar 28, 2023 1:33 pm

    Client.

    Procure por:
    Código:
    Public Const ITEM_TYPE_SPELL As Byte = 8
    Embaixo 
    Código:
    Public Const ITEM_TYPE_STAT_PACOTE As Byte = 9
    No Lugar do 9 vc coloca o numero que corresponde no seu cliente.

    Em frmEditor_Item no cmbType's list adicionar na list   Pacote


    Server.

    Procure por:
    Código:
    Public Const ITEM_TYPE_SPELL As Byte = 8
    Embaixo:
    Código:
    Public Const ITEM_TYPE_STAT_PACOTE As Byte = 9
    Tem que ser na mesma ordem que no client.

    Depois vai na "modPlayer"
    Procure por:
    Código:
    Case ITEM_TYPE_SPELL
     
     ' stat requirements
     For i = 1 To Stats.Stat_Count - 1
     If GetPlayerRawStat(index, i) < Item(itemnum).Stat_Req(i) Then
                            PlayerMsg index, "You do not meet the stat requirements to use this item.", BrightRed
                            Exit Sub
                        End If
                    Next
                    
                    ' level requirement
                    If GetPlayerLevel(index) < Item(itemnum).LevelReq Then
                        PlayerMsg index, "You do not meet the level requirement to use this item.", BrightRed
                        Exit Sub
                    End If
                    
                    ' class requirement
                    If Item(itemnum).ClassReq > 0 Then
                        If Not GetPlayerClass(index) = Item(itemnum).ClassReq Then
                            PlayerMsg index, "You do not meet the class requirement to use this item.", BrightRed
                            Exit Sub
                        End If
                    End If
                    
                    ' access requirement
                    If Not GetPlayerAccess(index) >= Item(itemnum).AccessReq Then
                        PlayerMsg index, "You do not meet the access requirement to use this item.", BrightRed
                        Exit Sub
                    End If
                    
                    ' Get the spell num
                    n = Item(itemnum).Data1

                    If n > 0 Then

                        ' Make sure they are the right class
                        If Spell(n).ClassReq = GetPlayerClass(index) Or Spell(n).ClassReq = 0 Then
                            ' Make sure they are the right level
                            i = Spell(n).LevelReq

                            If i <= GetPlayerLevel(index) Then
                                i = FindOpenSpellSlot(index)

                                ' Make sure they have an open spell slot
                                If i > 0 Then

                                    ' Make sure they dont already have the spell
                                    If Not HasSpell(index, n) Then
                                        Call SetPlayerSpell(index, i, n)
                                        Call SendAnimation(GetPlayerMap(index),Item itemnum).Animation, 0, 0, TARGET_TYPE_PLAYER, index)
                                        Call TakeInvItem(index, itemnum, 0)
                                        Call PlayerMsg(index, "You feel the rush of knowledge fill your mind. You can now use " & Trim$(Spell(n).Name) & ".", BrightGreen)
                                    Else
                                        Call PlayerMsg(index, "You already have knowledge of this skill.", BrightRed)
                                    End If

                                Else
                                    Call PlayerMsg(index, "You cannot learn any more skills.", BrightRed)
                                End If

                            Else
                                Call PlayerMsg(index, "You must be level " & i & " to learn this skill.", BrightRed)
                            End If

                        Else
                            Call PlayerMsg(index, "This spell can only be learned by " & CheckGrammar(GetClassName(Spell(n).ClassReq)) & ".", BrightRed)
                        End If
                    End If
                    
                    ' send the sound
                    SendPlayerSound index, GetPlayerX(index), GetPlayerY(index), SoundEntity.seItem, itemnum

    antes do End select

    Código:
    '###Item premiado###
    Case ITEM_TYPE_STAT_PACOTE
    n = Random(1, 50) 'Vai procurar um item do 1 ao 50 e dar ao player,

    'Itens aleatorios
    If n = "1" Then 'Random 1
    Call GiveInvItem(Index, 1, 2) 'Aqui vc escolhe o item que quer dar, num 1 o id, num 2 a quantidade
    Call PlayerMsg(Index, "Você recebeu 100k de Ryou", BrightGreen) 'msg
    End If

    If n = "2" Then 'Random 2
    Call GiveInvItem(Index, 1, 500000)
    Call PlayerMsg(Index, "Você recebeu 500k de Ryou", BrightGreen)
    End If

    If n = "3" Then 'Random 3
    Call GiveInvItem(Index, 1, 1000000)
    Call PlayerMsg(Index, "Você recebeu 1m de Ryou", BrightGreen)
    End If

    If n = "4" Then 'Random 4
    Call GiveInvItem(Index, 62, 1)
    Call PlayerMsg(Index, "Você recebeu 1 Barra de ouro!", BrightGreen)
    End If
                
    If n = "5" Then 'Random 5
    Call GiveInvItem(Index, 26, 1)
    Call PlayerMsg(Index, "Você recebeu 1 Box Reset", BrightGreen)

    'Tentaiva falhada
    Else
    Call PlayerMsg(Index, "Você não teve sorte!", BrightRed)



                    'Função que remove o item
                    Call TakeInvItem(Index, Player(Index).Inv(invNum).Num, 1)
                    
                    'Animação ao usar o item, troque o numeto 42 pelo qual vc quiser usar.
                    SendAnimation GetPlayerMap(Index), 42, 0, 0, TARGET_TYPE_PLAYER, Index




    Creditos: Irin.
    Nexus Games.
    https://nexusgames2d.blogspot.com/


    Última edição por irintomaz em Ter Mar 28, 2023 1:40 pm, editado 1 vez(es)
    Kotol
    Kotol
    Moderador Local
    Moderador Local


    Mensagens : 74
    Créditos : 16

    Item Random Empty Re: Item Random

    Mensagem por Kotol Qua Mar 29, 2023 4:56 am

    Boa noite, então amigo, ótima idéia e sistema muito bom, no entanto tem um bug:

    1- Quando usado de mochila cheia, ele usa seu item mas não dá nada, somente o aviso "Mochila Cheia";

    Solução: 

    Após:

    Código:
    Case ITEM_TYPE_STAT_PACOTE


    Adicione isto: 

    Código:
    'Check if player have avaliable inventory slot
                    If FindOpenInvSlot(Index, ItemNum) = 0 Then
                        PlayerMsg Index, "Mochila cheia!", BrightRed
                        Exit Sub
                    End If

    E pronto, você não vai ter mais esse bug desse sistema.

    Valentine, Uchiha ~ e Nando Moura gostam desta mensagem


      Data/hora atual: Qua maio 08, 2024 7:27 pm