TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!




Participe do fórum, é rápido e fácil

TeaM KingS
[center]Ola Convidado, seja bem vindo ao TeaM KingS !

Nós temos tutoriais sobre o WarCraft World Editor: se você tiver alguma duvida pode perguntar que os moderadores ou membros experientes vão lhe ajudar.

Para melhor utilizar nossos recursos é extremamente recomendado que esteja logado em nosso fórum e que leia o nosso regulamento oficial.

Também temos fóruns sobre DotA AllstarS, com guias, estratégias, e muito mais!


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

[Duvida] Quantidade de Vidas no jogo

3 participantes

Ir para baixo

[Duvida] Quantidade de Vidas no jogo Empty [Duvida] Quantidade de Vidas no jogo

Mensagem por Twisty 2013-07-06, 18:19

Queria colocar esse sistema no meu mapa , que aparece na tela opcoes para escolher quantas vidas ter no jogo , EX : Comecei o jogo , dai aparece na tela Botoes para eu escolher quantas vidas terei , 1 ou 3 etc.. se eu escolhi 1 , e entao morri o jogo acabara.
Vlw!
Twisty
Twisty

Número de Posts : 99
Data de inscrição : 25/05/2013
Reputação : 3 Pontos : 21163

Warning Necropost
[Duvida] Quantidade de Vidas no jogo Left_bar_bleue0 / 1000 / 100[Duvida] Quantidade de Vidas no jogo Right_bar_bleue


Ir para o topo Ir para baixo

[Duvida] Quantidade de Vidas no jogo Empty Re: [Duvida] Quantidade de Vidas no jogo

Mensagem por Gilgamesh 2013-07-06, 21:32

Aí carinha. Vê se é o que você precisa...
Didicado a Twisty rsrs.


Descrição da Spell:
Ao iniciar á partida, será perguntado ao host a dificuldade do jogo. Dependendo da dificuldade selecionada, cada player terá uma certa quantidade de vidas.

Plataforma da Spell:
vJass

Requisitos:
JNGP (Jass New Generation Pack)

Setup (JESP):

Código:
module lifeSystemLives

    public static method DIALOG_MESSAGE takes nothing returns string
        return "Selecione a dificuldade abaixo:"
    endmethod

    public static method HARD_LIVES takes nothing returns integer
        return 1
    endmethod

    public static method MEDIUM_LIVES takes nothing returns integer
        return 3
    endmethod

    public static method EASY_LIVES takes nothing returns integer
        return 5
    endmethod

endmodule
Corpo do Script:

Código:
module stringColors
    public static string array PlayerName

    private static method onInit takes nothing returns nothing
        set PlayerName[0] = ("|CFFFF0303" + (GetPlayerName(Player(0)) + "|r"))
        set PlayerName[1] = ("|CFF0042FF" + (GetPlayerName(Player(1)) + "|r"))
        set PlayerName[2] = ("|CFF1BE6D8" + (GetPlayerName(Player(2)) + "|r"))
        set PlayerName[3] = ("|CFF540081" + (GetPlayerName(Player(3)) + "|r"))
        set PlayerName[4] = ("|CFFFFFF01" + (GetPlayerName(Player(4)) + "|r"))
        set PlayerName[5] = ("|CFFFE8A0E" + (GetPlayerName(Player(5)) + "|r"))
        set PlayerName[6] = ("|CFF20C000" + (GetPlayerName(Player(6)) + "|r"))
        set PlayerName[7] = ("|CFFE55BB0" + (GetPlayerName(Player(7)) + "|r"))
        set PlayerName[8] = ("|CFF959697" + (GetPlayerName(Player(8)) + "|r"))
        set PlayerName[9] = ("|CFF7EBFF1" + (GetPlayerName(Player(9)) + "|r"))
        set PlayerName[10] = ("|CFF106246" + (GetPlayerName(Player(10)) + "|r"))
        set PlayerName[11] = ("|CFF4E2A04" + (GetPlayerName(Player(11)) + "|r"))
        set PlayerName[12] = ("|CFF272727" + (GetPlayerName(Player(12)) + "|r"))
    endmethod

endmodule

module heroDies
    implement stringColors

    private static method exitGame takes nothing returns boolean
        local trigger t = GetTriggeringTrigger()
        local dialog d = GetClickedDialog()
        local player p = GetTriggerPlayer()
        local group g = CreateGroup()
        local unit f = null
        local integer i = 0
        call GroupEnumUnitsOfPlayer(g,p,null)
        loop
            call DisplayTimedTextToPlayer(Player(i),0.,0.,12.,"O jogador "+PlayerName[GetPlayerId(p)]+" esgotou todas as suas vidas.")
            call DisplayTimedTextToPlayer(Player(i),0.,0.,12.,"O mesmo só poderá jogar na próxima partida.")
            set i = i + 1
            exitwhen i == 12
        endloop
        loop
            set f = FirstOfGroup(g)
            call RemoveUnit(f)
            call GroupRemoveUnit(g,f)
            exitwhen f == null
        endloop
        call DestroyGroup(g)
        call DestroyTrigger(t)
        call DialogClear(d)
        call DialogDestroy(d)
        set g = null
        set p = null
        set d = null
        set t = null
        return false
    endmethod

    private static method registerExitGame takes dialog di returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        call TriggerRegisterDialogEvent(t,di)
        call TriggerAddCondition(t,Condition(function thistype.exitGame))
        set t = null
    endmethod

    private static method defeatPlayer takes player pl returns nothing
        local dialog d = DialogCreate()
        local button b = DialogAddButton(d,"[|cffffcc00X|r] Close",69)
        call DialogSetMessage(d,"You Lose! Try Again Later.")
        call DialogDisplay(pl,d,true)
        call registerExitGame(d)
        set b = null
        set d = null
    endmethod

    private static method removeLife takes nothing returns boolean
        local unit u = GetTriggerUnit()
        local player p = GetOwningPlayer(u)
        if IsUnitType(u,ConvertUnitType(0)) and GetPlayerController(p)==ConvertMapControl(0) then
            set lives[GetPlayerId(p)] = lives[GetPlayerId(p)] - 1
            call DisplayTimedTextToPlayer(p,0.,0.,5.,"Seu herói foi morto em confronto.")
            call DisplayTimedTextToPlayer(p,0.,0.,5.,"|c00ff3300Vidas Restantes:|r "+I2S(lives[GetPlayerId(p)]))
            if lives[GetPlayerId(p)] == 0 then
                call defeatPlayer(p)
            endif
        endif
        set p = null
        set u = null
        return false
    endmethod

    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        loop
            call TriggerRegisterPlayerUnitEvent(t,Player(i),ConvertPlayerUnitEvent(20),null)
            set i = i + 1
            exitwhen i == 12
        endloop
        call TriggerAddCondition(t,Condition(function thistype.removeLife))
        set t = null
    endmethod

endmodule

module buttonClick
    implement lifeSystemLives

    private static method registerDifficulty takes nothing returns boolean
        local player p = GetTriggerPlayer()
        local trigger t = GetTriggeringTrigger()
        local integer i = 0
        if GetClickedButton()==buttonLifes[0] then // Difícil
            loop
                call DisplayTimedTextToPlayer(Player(i),0.,0.,12.,"O modo difícil foi selecionado. Cada jogador possui |c00ff3300"+I2S(HARD_LIVES())+"|r vidas.")
                set lives[GetPlayerId(p)] = HARD_LIVES()
                set i = i + 1
                exitwhen i == 12
            endloop
        elseif GetClickedButton()==buttonLifes[1] then // Médio
            loop
                call DisplayTimedTextToPlayer(Player(i),0.,0.,12.,"O modo médio foi selecionado. Cada jogador possui |c00ff3300"+I2S(MEDIUM_LIVES())+"|r vidas.")
                set lives[GetPlayerId(p)] = MEDIUM_LIVES()
                set i = i + 1
                exitwhen i == 12
            endloop
        elseif GetClickedButton()==buttonLifes[2] then // Fácil
            loop
                call DisplayTimedTextToPlayer(Player(i),0.,0.,12.,"O modo fácil foi selecionado. Cada jogador possui |c00ff3300"+I2S(EASY_LIVES())+"|r vidas.")
                set lives[GetPlayerId(p)] = EASY_LIVES()
                set i = i + 1
                exitwhen i == 12
            endloop
        endif
        call DestroyTrigger(t)
        call DialogClear(dialogLifes)
        call DialogDestroy(dialogLifes)
        set dialogLifes = null
        set buttonLifes[0] = null
        set buttonLifes[1] = null
        set buttonLifes[2] = null
        set t = null
        set p = null
        return false
    endmethod

    private static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        call TriggerRegisterDialogEvent(t,dialogLifes)
        call TriggerAddCondition(t,Condition(function thistype.registerDifficulty))
        set t = null
    endmethod

endmodule

struct new extends array
    implement buttonClick
    implement heroDies

    private static integer array lives
    private static dialog dialogLifes = DialogCreate()
    private static button array buttonLifes

    private static method returnHost takes nothing returns player
        local player p = null
        local integer i = 0
        local integer l = 0
        loop
            set p = Player(i)
            if GetPlayerSlotState(p)==ConvertPlayerSlotState(1) and GetPlayerController(p)==ConvertMapControl(0) then
                set l = 11
            endif
            set i = i + 1
            set l = l + 1
            exitwhen l == 12
        endloop
        return p
    endmethod

    private static method displayDialog takes nothing returns nothing
        local timer t = GetExpiredTimer()
        set buttonLifes[0] = DialogAddButton(dialogLifes,"[|cffffcc00A|r] Difícil (1 Live)",65)
        set buttonLifes[1] = DialogAddButton(dialogLifes,"|c00ffffff[|rB|c00ffffff] Médio (3 Lives)|r",66)
        set buttonLifes[2] = DialogAddButton(dialogLifes,"|c00ffffff[|rC|c00ffffff] Fácil (5 Lives)|r",67)
        call DialogSetMessage(dialogLifes,DIALOG_MESSAGE())
        call DialogDisplay(returnHost(),dialogLifes,true)
        call DestroyTimer(t)
        set t = null
    endmethod

    private static method onInit takes nothing returns nothing
        local timer t = CreateTimer()
        call TimerStart(t,.1,false,function thistype.displayDialog)
        set t = null
    endmethod

endstruct
Download (Demo Map)
- Open Source: pode ser aberto com o World Editor.

JNGP (Link Externo)
 - Página de download da ferramenta
 - Instruções de uso e instalação na página de download (inglês).
Gilgamesh
Gilgamesh

Número de Posts : 313
Data de inscrição : 11/05/2013
Reputação : 69 Pontos : 23544

Warning Necropost
[Duvida] Quantidade de Vidas no jogo Left_bar_bleue0 / 1000 / 100[Duvida] Quantidade de Vidas no jogo Right_bar_bleue


http://www.DotCastleBR.forumeiros.com

Ir para o topo Ir para baixo

[Duvida] Quantidade de Vidas no jogo Empty Re: [Duvida] Quantidade de Vidas no jogo

Mensagem por Law.Terro 2013-07-06, 21:40

Se não me engano, Esse sistema é bem fácil de se fazer, você usa uma variável Interger e cada Unidade que seja Hero morra vai aumentando 1, dai o jogo acabar quando a Interger chegar a tal opção que foi escolhi, como por exemplo 20 kills. Essa parte que você mencionou é de Dialog Box, existem vários tutoriais por aqui, inclusive o meu aqui. Aproveite o máximo ^^. Qualquer dúvida por favor pergunte.
Law.Terro
Law.Terro

Número de Posts : 1243
Data de inscrição : 18/07/2011
Reputação : 107 Pontos : 30057

Warning Necropost
[Duvida] Quantidade de Vidas no jogo Left_bar_bleue0 / 1000 / 100[Duvida] Quantidade de Vidas no jogo Right_bar_bleue


http://againstattack.blogspot.com.br/

Ir para o topo Ir para baixo

[Duvida] Quantidade de Vidas no jogo Empty Re: [Duvida] Quantidade de Vidas no jogo

Mensagem por Conteúdo patrocinado


Conteúdo patrocinado


Ir para o topo Ir para baixo

Ir para o topo

- Tópicos semelhantes

 
Permissões neste sub-fórum
Não podes responder a tópicos