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