Получение урона сработает на молоток, стомп и баш. Если регистрация стана происходит по "факту", то можно добавлять неуязвимость, дерево или другой тип на который не сработает стан. Если в момент каста или атаки регистрируется, то микростан все равно будет и канальные каты будет сбивать
Давно тестил и сделал вывод что скорость атаки влияет на воспроизведение анимации.
Атак в секунду - полный цикл
Начало броска - время анимации от начала воспроизведения до нанесения урона
Обратный бросок - время анимации возврата в исходное положение
Ну и лаконичнее лучше сделать "свитчер". Булевская переменная в триггере на получение урона.
Если switchDamage == true
switchDamage = false
return
А перед нанесением урона ставить switchDamage = true
Нужна переменная на последний индекс "МАХ".
Юнит умирает
Если в отряде количество юнитов <= 0
Units[МАХ] = Units[индекс умершего]
МАХ = МАХ - 1
Когда добавляеш, увеличиваешь МАХ + 1 і Units ставь индекс МАХ
через 5 секунд у каждого будет по 3 тика, чего не может быть т.к. для трех тиков нужно 15 секунд
Не то условие добавил
Через цикл все з таймером
globals
constant integer MAX_PLAYER = 12
timer array TimerStartAction [MAX_PLAYER]
integer array AnyAction[MAX_PLAYER]
endglobals
function StartAction takes nothing returns nothing
local integer l = 0
loop
exitwhen l >= MAX_PLAYER
if TimerStartAction[l] == GetExpiredTimer() then
if AnyAction[l] == 1 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 1. Start this action by player #"+I2S(l+1))
elseif AnyAction[l] == 2 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 2. Start this action by player #"+I2S(l+1))
elseif AnyAction[l] == 3 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 3. Start this action by player #"+I2S(l+1))
set AnyAction[l] = 0
call PauseTimer(TimerStartAction[l])
endif
set AnyAction[l] = AnyAction[l] + 1
endif
set l = l + 1
endloop
endfunction
function EnterChatMessage takes nothing returns nothing
local integer pId = GetPlayerId(GetTriggerPlayer())
call TimerStart(TimerStartAction[pId], 5, true, function StartAction)
set AnyAction[pId] = 1
endfunction
//===========================================================================
function InitTrig_Loop takes nothing returns nothing
local integer i = 0
set gg_trg_Loop = CreateTrigger()
loop
exitwhen i >= MAX_PLAYER
call TriggerRegisterPlayerChatEvent( gg_trg_Loop, Player(i), "go", true )
set TimerStartAction[i] = CreateTimer()
set i = i + 1
endloop
call TriggerAddAction(gg_trg_Loop, function EnterChatMessage )
endfunction
Нужен триггер с названием Loop или создать свой триггер MAX_PLAYER - Просто константа, вJNGP Rebuildтак можно, ошибок не будет
Через call TriggerSleepAction(2) можно, но для сети не рекомендуется. Почитаешь какие последствия могут быть. Для одного игрока тебе будет идеальный вариант
Я там описал смысл передачи, думал условия уже построиш для своей задачи.
Три варианта
Через цикл всем по таймеру
globals
constant integer MAX_PLAYER = 12
timer array TimerStartAction [MAX_PLAYER]
integer array AnyAction[MAX_PLAYER]
endglobals
function StartAction takes nothing returns nothing
local integer l = 0
loop
exitwhen l >= MAX_PLAYER
if AnyAction[l] > 0 and AnyAction[l] < 4 then
if AnyAction[l] == 1 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 1. Start this action by player #"+I2S(l+1))
elseif AnyAction[l] == 2 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 2. Start this action by player #"+I2S(l+1))
elseif AnyAction[l] == 3 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 3. Start this action by player #"+I2S(l+1))
endif
set AnyAction[l] = AnyAction[l] + 1
else
set AnyAction[l] = 0
call PauseTimer(TimerStartAction[l])
endif
set l = l + 1
endloop
endfunction
function EnterChatMessage takes nothing returns nothing
local integer pId = GetPlayerId(GetTriggerPlayer())
call TimerStart(TimerStartAction[pId], 0.3, true, function StartAction)
set AnyAction[pId] = 1
endfunction
//===========================================================================
function InitTrig_Loop takes nothing returns nothing
local integer i = 0
set gg_trg_Loop = CreateTrigger()
loop
exitwhen i >= MAX_PLAYER
call TriggerRegisterPlayerChatEvent( gg_trg_Loop, Player(i), "go", true )
set TimerStartAction[i] = CreateTimer()
set i = i + 1
endloop
call TriggerAddAction(gg_trg_Loop, function EnterChatMessage )
endfunction
Через цикл один таймер
globals
constant integer MAX_PLAYER1 = 12
timer TimerStartAction1 = CreateTimer()
real array PlayerTimeExpiered[MAX_PLAYER1]
endglobals
function StartAction1 takes nothing returns nothing
local integer l = 0
loop
exitwhen l >= MAX_PLAYER1
if PlayerTimeExpiered[l] >= 0 and PlayerTimeExpiered[l] < 4 then
if PlayerTimeExpiered[l] == 1 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 1. Start this action by player #"+I2S(l+1))
elseif PlayerTimeExpiered[l] == 2 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 2. Start this action by player #"+I2S(l+1))
elseif PlayerTimeExpiered[l] == 3 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 3. Start this action by player #"+I2S(l+1))
endif
set PlayerTimeExpiered[l] = PlayerTimeExpiered[l] + 1 //1 = one tick of timer = 0.3 sec
endif
set l = l + 1
endloop
endfunction
function EnterChatMessage1 takes nothing returns nothing
set PlayerTimeExpiered[GetPlayerId(GetTriggerPlayer())] = 0
endfunction
//===========================================================================
function InitTrig_StaticTimer takes nothing returns nothing
local integer i = 0
set gg_trg_StaticTimer = CreateTrigger()
loop
exitwhen i >= MAX_PLAYER1
call TriggerRegisterPlayerChatEvent( gg_trg_StaticTimer, Player(i), "go", true )
set PlayerTimeExpiered[i] = -1
set i = i + 1
endloop
call TriggerAddAction(gg_trg_StaticTimer, function EnterChatMessage1 )
call TimerStart( TimerStartAction1, 0.3, true, function StartAction1)
endfunction
Через хеш
globals
constant integer MAX_PLAYER2 = 12
timer array TimerStartAction2[MAX_PLAYER2]
integer array ActionID[MAX_PLAYER2]
hashtable htb = InitHashtable()
endglobals
function StartAction2 takes nothing returns nothing
local integer l = 0
local integer pId = LoadInteger(htb, GetHandleId(GetExpiredTimer()), StringHash("StartAction2"))
if ActionID[pId] == 1 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 1. Start this action by player #"+I2S(l+1))
elseif ActionID[pId] == 2 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 2. Start this action by player #"+I2S(l+1))
elseif ActionID[pId] == 3 then
call DisplayTimedTextToPlayer(Player(l),0,0,20,"Start any action 3. Start this action by player #"+I2S(l+1))
call PauseTimer(GetExpiredTimer())
endif
set ActionID[pId] = ActionID[pId] + 1
endfunction
function EnterChatMessage2 takes nothing returns nothing
local integer pId = GetPlayerId(GetTriggerPlayer())
set ActionID[pId] = 1
call SaveInteger(htb, GetHandleId(TimerStartAction2[pId]), StringHash("StartAction2"), pId)
call TimerStart(TimerStartAction2[pId], 0.3, true, function StartAction2)
endfunction
//===========================================================================
function InitTrig_SaveHandle takes nothing returns nothing
local integer i = 0
set gg_trg_SaveHandle = CreateTrigger()
loop
exitwhen i >= MAX_PLAYER2
call TriggerRegisterPlayerChatEvent( gg_trg_SaveHandle, Player(i), "go", true )
set TimerStartAction2[i] = CreateTimer()
set i = i + 1
endloop
call TriggerAddAction(gg_trg_SaveHandle, function EnterChatMessage2 )
endfunction
globals
integer PLAYERS=12
integer array N
timer array Ti
timer array TIME
integer array GO
endglobals
function OnPeriodic takes nothing returns nothing
local integer i=1
loop
exitwhen i>PLAYERS
if GO[i]==1 then
call BJDebugMsg("timer i "+I2S(i)+"__GO[i] "+I2S(GO[i])+"__N [i] "+I2S(N[i])+"__Name "+GetPlayerName(Player(i-1)))
set GO[i] = 0
endif
set i = i + 1
endloop
endfunction
function Start takes nothing returns nothing
local string s=StringCase(GetEventPlayerChatString(),false)
local integer i=GetPlayerId(GetTriggerPlayer())+1
if s=="-g" then
set GO[i] = 1
endif
endfunction
function Start_init takes nothing returns nothing
local trigger t=CreateTrigger()
local integer i=1
loop
exitwhen i>PLAYERS
call TriggerRegisterPlayerChatEvent(t,Player(i-1),"-",false)
call TriggerAddAction(t, function Start)
set i=i+1
endloop
set TIME = CreateTimer()
call TimerStart(TIME, 0.3, true, function OnPeriodic)
endfunction
Смысл примерно таков для цыкла
Или каждому свой таймер
function Start_init takes nothing returns nothing
local trigger t=CreateTrigger()
local integer i=1
loop
exitwhen i>PLAYERS
call TriggerRegisterPlayerChatEvent(t,Player(i-1),"-",false)
call TriggerAddAction(t, function Start)
set TIME[i] = CreateTimer()
call TimerStart(TIME[i], 0.3, true, function OnPeriodic)
set i=i+1
endloop
endfunction
Можно один таймер для всех, а когда таймер истекает, то циклом проверять всех игроков и в зависимости переменной записаной на игрока выполнять действия
Или сохранять значение в хеш по id таймера
host_pi, Ну ты и душнила ))
Просто возьми друга, и протести создание юнита в центре камеры, с вероятностю в 98% десинхрона не будет(2% на то, что не понял тебя). Но не проверяй значение переменных, а именно функцию в целом.
anton1623, Еще можно при касте способности, записать в переменную точку сундука и кастера. Потом запустить периодический таймер в котором сверяешь дистанцию между точками и если больше установленой то паузишь таймер и прячешь сундук
LosKalmaros, Можно сделать блок камеры в центре области, а при нажатии влево(вправо) юниты будут смещатся в сторону за пределы камеры.
Прм: Если игрок нажал влево, тогда создается герой справа от камеры. Центрального героя плавно двигаеш влево и удаляешь, а созданого справа двигаеш в центр.
Наработок не встречал, но система довольно простая
» WarCraft 3 / Как отловить стан?
» WarCraft 3 / Текстовый редактор триггеров
» WarCraft 3 / Как триггерно увеличить максимальное здоровье юниту,изучившему с
Отредактирован Borodach
» WarCraft 3 / На что влияет скорость атаки?
Атак в секунду - полный цикл
Начало броска - время анимации от начала воспроизведения до нанесения урона
Обратный бросок - время анимации возврата в исходное положение
» WarCraft 3 / Как можно максимально сымитировать систему очков навыков героя?
Отредактирован Borodach
» WarCraft 3 / Триггеры на хп ниже определенного уровня
» WarCraft 3 / Ограничение "специальным" наёмникам
» WarCraft 3 / Удар щитом
» WarCraft 3 / Антиспелл
» WarCraft 3 / Некорректно срабатывает триггер
Если switchDamage == true
switchDamage = false
return
А перед нанесением урона ставить switchDamage = true
Отредактирован Borodach
» WarCraft 3 / Некорректно срабатывает триггер
» WarCraft 3 / Помогите с библиотеками
Юнит умирает
Если в отряде количество юнитов <= 0
Units[МАХ] = Units[индекс умершего]
МАХ = МАХ - 1
Когда добавляеш, увеличиваешь МАХ + 1 і Units ставь индекс МАХ
» WarCraft 3 / Обьеденить триггеры
» WarCraft 3 / Лаг при герое
» WarCraft 3 / Вылет из игры при постройке магазина
Отредактирован Borodach
» WarCraft 3 / как сделать 3 разных действия с одной периодичностью по таймеру?
MAX_PLAYER - Просто константа, в JNGP Rebuild так можно, ошибок не будет
Отредактирован Borodach
» WarCraft 3 / как сделать 3 разных действия с одной периодичностью по таймеру?
Три варианта
Отредактирован Borodach
» WarCraft 3 / как сделать 3 разных действия с одной периодичностью по таймеру?
» WarCraft 3 / как сделать 3 разных действия с одной периодичностью по таймеру?
Или сохранять значение в хеш по id таймера
» WarCraft 3 / как сделать 3 разных действия с одной периодичностью по таймеру?
» WarCraft 3 / как присвоить локальные значения игрока в глобальные переменные?
Просто возьми друга, и протести создание юнита в центре камеры, с вероятностю в 98% десинхрона не будет(2% на то, что не понял тебя). Но не проверяй значение переменных, а именно функцию в целом.
» WarCraft 3 / Уменьшение урона юнита при атаке
» WarCraft 3 / Как сделать чтобы статистика игрока сохранялась. Если можно
» WarCraft 3 / Призываемый сундук
» WarCraft 3 / Выбор героя
Прм: Если игрок нажал влево, тогда создается герой справа от камеры. Центрального героя плавно двигаеш влево и удаляешь, а созданого справа двигаеш в центр.
Наработок не встречал, но система довольно простая