DotCastle BR™

[System] Select Difficulty Sys v2.0 Lion_shield
Olá Visitante!, seja bem-vindo ao fórum oficial DotCastle BR™️.

Nosso fórum é dedicado á criadores e editores de mapas para Warcraft III através do World Editor.

Aqui você encontrará spells, systems, tutoriais e muito mais ao alcance de um clique.

Conecte-se agora mesmo para acessar livremente o nosso conteúdo.

Nossos 35 usuários já postaram um total de 92 mensagens.


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

DotCastle BR™

[System] Select Difficulty Sys v2.0 Lion_shield
Olá Visitante!, seja bem-vindo ao fórum oficial DotCastle BR™️.

Nosso fórum é dedicado á criadores e editores de mapas para Warcraft III através do World Editor.

Aqui você encontrará spells, systems, tutoriais e muito mais ao alcance de um clique.

Conecte-se agora mesmo para acessar livremente o nosso conteúdo.

Nossos 35 usuários já postaram um total de 92 mensagens.
DotCastle BR™
Gostaria de reagir a esta mensagem? Crie uma conta em poucos cliques ou inicie sessão para continuar.
DotCastle BR™

Conecte-se e apresente-se para receber 25 pontos!
Nossos 35 usuários já postaram o total de 92 mensagens!
O DotCastle BR™ está ativo a 3969 dias.
Ei Convidado, você postou 0 de 92 mensagens!
Participe postando suas dúvidas. Compartilhe seus projetos. O DotCastle BR™ tem prazer em ajudar!
Não deixe de conferir as regras do fórum.

Você não está conectado. Conecte-se ou registre-se

[System] Select Difficulty Sys v2.0

3 participantes

Ir para baixo  Mensagem [Página 1 de 1]

1[System] Select Difficulty Sys v2.0 Empty [System] Select Difficulty Sys v2.0 Dom Jul 07, 2013 4:15 am

Hisoka

Hisoka
Administrador
Administrador

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.

Changelog:
v2.0 - Mais opções de customização adicionadas.

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).



Última edição por Gilgamesh em Seg Jul 08, 2013 12:54 pm, editado 1 vez(es)

https://dotcastlebr.forumeiros.com

2[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Dom Jul 07, 2013 9:29 am

Twisty

Twisty
Peasant, Level 1
Peasant, Level 1

Vlw por ter respondido minha pergunta do TK por aqui *-*

3[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Seg Jul 08, 2013 1:05 pm

Hisoka

Hisoka
Administrador
Administrador

Updated to v2.0
Twisty edition. Cool 

https://dotcastlebr.forumeiros.com

4[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Seg Jul 08, 2013 6:38 pm

Twisty

Twisty
Peasant, Level 1
Peasant, Level 1

Vlw cara fico perfeito <3 Very Happy

5[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Ter Jul 09, 2013 3:43 pm

Galles

Galles
Peasant, Level 1
Peasant, Level 1

nunca consegui mecher nesse tipo de sistema, meu negocio é GUI (trigger) mesmo.

6[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Ter Jul 09, 2013 8:11 pm

Hisoka

Hisoka
Administrador
Administrador

Houve um tempo, onde eu comecei a aprender GUI e vi que existia o Jass (comum).

Nunca pensei que chegaria a esse nível. Daí fui programando em GUI mesmo. Só que pra cada spell ou system que eu fazia em GUI eu convertia pra Custom Text e olhava como éra em Jass.

Hoje eu sei vJass avançado.

")

https://dotcastlebr.forumeiros.com

7[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Qui Jul 11, 2013 10:15 pm

Galles

Galles
Peasant, Level 1
Peasant, Level 1

como converto uma trigger gui para jass ?

8[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Sex Jul 12, 2013 7:51 pm

Hisoka

Hisoka
Administrador
Administrador

Clica na trigger que você quer converter, em seguida vai no menu Edit e clica na opção Convert to Custom Text.

Você ainda pode desfazer a operação. Caso não desfaça, a trigger não poderá mais ser convertida de volta para GUI.

https://dotcastlebr.forumeiros.com

9[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Sex Jul 12, 2013 7:55 pm

Galles

Galles
Peasant, Level 1
Peasant, Level 1

nossa, tenque pensar 2 vezes antes de fazer isso então..., MAIS QUAL A VANTAGEM DE EU CONVERTER ELA PRA JASS ?

10[System] Select Difficulty Sys v2.0 Empty Re: [System] Select Difficulty Sys v2.0 Sex Jul 12, 2013 8:10 pm

Hisoka

Hisoka
Administrador
Administrador

A vantagem é aprender como se faz em Jass. Se quiser aprender Jass, o melhor jeito é converter olhar e em seguida desfazer. Só para memorizar algumas funções em Jass, em seguida você dá uma olhada em um ou dois tutoriais de vJass pra melhorar o jass. ")

https://dotcastlebr.forumeiros.com

Conteúdo patrocinado



Ir para o topo  Mensagem [Página 1 de 1]

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