14

» WarCraft 3 / ЦВЕТ - как из игры получить точные значения playercolor в RGB кодировке ?

покраска строки цветом игрока

Vanilla

Код
function ColorPlayerClassic takes string s, integer i returns string
if 1==0 then
elseif i==1 then
return Color00PlayerRedClassic(s)
elseif i==2 then
return Color01PlayerBlueClassic(s)
elseif i==3 then
return Color02PlayerCyanClassic(s)
elseif i==4 then
return Color03PlayerPurpleClassic(s)
elseif i==5 then
return Color04PlayerYellowClassic(s)
elseif i==6 then
return Color05PlayerOrangeClassic(s)
elseif i==7 then
return Color06PlayerGreenClassic(s)
elseif i==8 then
return Color07PlayerPinkClassic(s)
elseif i==9 then
return Color08PlayerLightGrayClassic(s)
elseif i==10 then
return Color09PlayerLightBlueClassic(s)
elseif i==11 then
return Color10PlayerAquaClassic(s)
elseif i==12 then
return Color11PlayerBrownClassic(s)
endif
return null
endfunction

Reforged

Код
function ColorPlayerReforged takes string s, integer i returns string
if 1==0 then
elseif i==1 then
return Color00PlayerRedReforged(s)
elseif i==2 then
return Color01PlayerBlueReforged(s)
elseif i==3 then
return Color02PlayerCyanReforged(s)
elseif i==4 then
return Color03PlayerPurpleReforged(s)
elseif i==5 then
return Color04PlayerYellowReforged(s)
elseif i==6 then
return Color05PlayerOrangeReforged(s)
elseif i==7 then
return Color06PlayerGreenReforged(s)
elseif i==8 then
return Color07PlayerPinkReforged(s)
elseif i==9 then
return Color08PlayerLightGrayReforged(s)
elseif i==10 then
return Color09PlayerLightBlueReforged(s)
elseif i==11 then
return Color10PlayerAquaReforged(s)
elseif i==12 then
return Color11PlayerBrownReforged(s)
elseif i==13 then
return Color12PlayerMaroonReforged(s)
elseif i==14 then
return Color13PlayerNavyReforged(s)
elseif i==15 then
return Color14PlayerTurquoiseReforged(s)
elseif i==16 then
return Color15PlayerVioletReforged(s)
elseif i==17 then
return Color16PlayerWheatReforged(s)
elseif i==18 then
return Color17PlayerPeachReforged(s)
elseif i==19 then
return Color18PlayerMintReforged(s)
elseif i==20 then
return Color19PlayerLavenderReforged(s)
elseif i==21 then
return Color20PlayerCoalReforged(s)
elseif i==22 then
return Color21PlayerSnowReforged(s)
elseif i==23 then
return Color22PlayerEmeraldReforged(s)
elseif i==24 then
return Color23PlayerPeanutReforged(s)
endif
return null
endfunction
14

» WarCraft 3 / ЦВЕТ - как из игры получить точные значения playercolor в RGB кодировке ?

покраска строки цветом игрока
function ColorPlayer takes string s, integer i returns string
if 1==0 then
elseif i==1 then
return ColorPlayerRed(s)
elseif i==2 then
return ColorPlayerBlue(s)
elseif i==3 then
return ColorPlayerCyan(s)
elseif i==4 then
return ColorPlayerPurple(s)
elseif i==5 then
return ColorPlayerYellow(s)
elseif i==6 then
return ColorPlayerOrange(s)
elseif i==7 then
return ColorPlayerGreen(s)
elseif i==8 then
return ColorPlayerPink(s)
elseif i==9 then
return ColorPlayerLightGray(s)
elseif i==10 then
return ColorPlayerLightBlue(s)
elseif i==11 then
return ColorPlayerAqua(s)
elseif i==12 then
return ColorPlayerBrown(s)
endif
return null
endfunction
14

» WarCraft 3 / Радужный текст

чтобы не текло - нужно заменить это
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
на это
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		call DestroyTrigger(Dancer_t)
		set Dancer_t=null			
		set Dancer_Act0=null
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
14

» WarCraft 3 / как изменить время внутри таймерного периодического триггера?

короче
второе решение на таймере примерно такое - через непериодический но с перезапуском и возможностью запаузить:
сам код не напишешь - никто не напишет
function Main takes nothing returns nothing
	local timer t = CreateTimer()
	call DestroyTimer(GetExpiredTimer())
//Actions
if pause==0 then
	call TimerStart(t, time, false, function Main)
endif
	set t = null
endfunction
function time_main takes nothing returns nothing
set time=2
endfunction
function pause_main takes nothing returns nothing
set pause=1
endfunction
НО
это решение оплимитно
поэтому нормальное решение только одно и оно в шапке
либо садить этот таймер на отдельный оплимито-обходный триггер и всем говорить, что это решение на таймере
14

» WarCraft 3 / Внеочередная ошибка при запуске карты

бекапы и версии ты конечно же не делал, а пилил 2 года пересохраняя один и тот же файл?
14

» WarCraft 3 / Одновременный краш у всех игроков

карта то какая?
а то ты не туда пишешь так то
пиши близам в сапорт калифорнию, что у них платный продукт критует
14

» WarCraft 3 / Как сделать звук который будет слышен в поле зрения игрока? World Editor

LastUchiha: О господи, библиотеки и структуры, а полегче никак нельзя? Не обязательно что-бы мудрёно как то было.
по меркам варика это не такой большой код, всего 200 строк
это тебе не 2000 строк только для одной поддержки синхронизации
по сути у тебя выбора то нету, можешь сам написать
в принципе это не сложно делается:
если отследить применение абилки тригером - такое возможно?
то просто в цикл загоняешь
снимаешь координаты ГЕРОЕВ или ЮНИТОВ + StopSound() + StartSound() для тех, кто проходит по условиям
это на 20 строк пишется
LastUchiha: что-бы он воспроизвелся для всех тех у кого в радиусе обзора применяющий игрок
а если ты хочешь, чтобы учитывалось не по положению юнитов, а именно по текущим координатам камеры игрока - то добро пожаловать в дебри синхронизации по 2000 строк, либо вкатывайся в JN или reforged
14

» WarCraft 3 / как изменить время внутри таймерного периодического триггера?

PT153: Чтобы удалить ивенты у триггера, нужно триггер удалить.
а если мы используем DisableTrigger(t) + TriggerRemoveAction(t) + DestroyTrigger(t) - то будет правильно и без утечек?
или можно просто DestroyTrigger(t)?
PT153: Обычный таймер и есть альтернатива
то есть делать единоразовый непериодический таймер и каждые 0.1 сек его отлавливать как истёкший, чтобы заного его запустить на следующие 0.1 сек?
либо делать периодический таймер, но в случае паузы вручную отлавливать натиканное время и потом это время докармливать другому периодическому таймеру чтобы он продолжил тикать с этого же места?
14

» WarCraft 3 / как изменить время внутри таймерного периодического триггера?

PT153: таймер ты можешь всегда перезапустить с нужным временем
EugeAl: а как же нативки PauseTimer(t) И ResumeTimer(t) ? По крайней мере первая работает точно, испытывал

PT153:а триггер только пересоздать.
получается, из простых решений - ответ только тот что указан в шапке темы
это нужно было для радужного текста, в принципе он уже релизнут итак на этом решении

PT153: Причём я думаю, что отключение триггера не останавливает ивент-таймер, он дальше тикает
Extremator: периодический триггер в отличии от таймера будет молотить всю игру, независимо от того включен ли триггер. Тебя это устраивает?
даже если DisableTrigger() + TriggerRemoveAction() ?
а какая есть альтернатива то?
14

» WarCraft 3 / Радужный текст

  1. написать -name слово - навести мышку на синего
  2. написать -go - и над крестьянином и в F11 ник будет меняться, для мультибоарда должен тоже работать
функция и писалась как раз для подобных операций
код мода на имя 2го игрока
globals
	integer PLAYERS=12
	unit array u

	trigger RainbowText_Trg1=CreateTrigger()
	trigger RainbowText_Trg2=CreateTrigger()
	trigger RainbowText_Trg3=CreateTrigger()
	string RainbowText_s=""
	integer RainbowText_shift=0
	integer RainbowText_mode=7
	integer RainbowText_d=0
	integer RainbowText_i=0
	string RainbowText_abc=""
	string RainbowText_ss=""

	trigger Dancer_t=CreateTrigger()
	triggeraction Dancer_Act0 = null
	string Dancer_text="0123456789"
	texttag Dancer_textTag=CreateTextTag()
	string Dancer_direction="Left"
	integer Dancer_i=0
	real Dancer_speed=0.20
	integer Dancer_mode=7
	integer Dancer_ON=0
endglobals

//host--pi

function FirstSymbolLength takes string s returns integer
	local integer i=1
	local integer j=1
	local string array Alphabet
	set Alphabet[1]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234 56789!\"#$%&'()*+:;<=>?@,-./[\\]^_`{|}~" //en-1 //len 95
	set Alphabet[2]="АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩабвгдеёжзийклмнопрстуфхцчшщЪЫЬЭЮЯъыьэюя" //ru-2 // len 66
	set Alphabet[3]="№" //ru-3
	if StringLength(s)>0 then
		loop
			exitwhen j>3
			set i=1
			loop
				exitwhen i>StringLength(Alphabet[j])/j
				//call BJDebugMsg(SubString(s,0,j)+" - "+SubString(Alphabet[j],(i-1)*j,i*j)+" i - "+I2S(i)+" j - "+I2S(j)+" s - "+s)
				if SubString(s,0,j)==SubString(Alphabet[j],(i-1)*j,i*j) then
					return j
				endif
				set i=i+1
			endloop
			set j=j+1
		endloop
		return 3
	else
		return 0
	endif
endfunction

function ColorWhite takes string s returns string // 255,255,255
	return "|c"+"ff"+"FFFFFF"+s+"|r"
endfunction
function ColorBlack takes string s returns string // 0,0,0
	return "|c"+"ff"+"000000"+s+"|r"
endfunction

function ColorRed takes string s returns string // 255,0,0
	return "|c"+"ff"+"FF0000"+s+"|r"
endfunction
function ColorOrange takes string s returns string // 255,128,0
	return "|c"+"ff"+"FF8000"+s+"|r"
endfunction
function ColorYellow takes string s returns string // 255,255,0
	return "|c"+"ff"+"FFFF00"+s+"|r"
endfunction
function ColorYellowGreen takes string s returns string // 128,255,0
	return "|c"+"ff"+"80FF00"+s+"|r"
endfunction
function ColorGreen takes string s returns string // 0,255,0
	return "|c"+"ff"+"00FF00"+s+"|r"
endfunction
function ColorGreenCyan takes string s returns string // 0,255,128
	return "|c"+"ff"+"00FF80"+s+"|r"
endfunction
function ColorCyan takes string s returns string // 0,255,255
	return "|c"+"ff"+"00FFFF"+s+"|r"
endfunction
function ColorCyanBlue takes string s returns string // 0,128,255
	return "|c"+"ff"+"0080FF"+s+"|r"
endfunction
function ColorBlue takes string s returns string // 0,0,255
	return "|c"+"ff"+"0000FF"+s+"|r"
endfunction
function ColorBlueViolet takes string s returns string // 128,0,255
	return "|c"+"ff"+"8000FF"+s+"|r"
endfunction
function ColorViolet takes string s returns string // 255,0,255
	return "|c"+"ff"+"FF00FF"+s+"|r"
endfunction
function ColorVioletRed takes string s returns string // 255,0,128
	return "|c"+"ff"+"FF0080"+s+"|r"
endfunction

function RainbowText_Act3 takes nothing returns boolean
	set RainbowText_ss=RainbowText_ss+RainbowText_abc
	return false
endfunction
function RainbowText_Act2 takes nothing returns boolean
	set RainbowText_d=FirstSymbolLength(SubString(RainbowText_s,RainbowText_i,RainbowText_i+3))
	return false
endfunction
function RainbowText_Act1 takes nothing returns boolean
	local integer i=0
	local integer j=1
	local integer decode=0
	local integer color=0
	local string abc=""
	set RainbowText_ss=""
	if StringLength(RainbowText_s)>0 then
		loop
			exitwhen i+1>StringLength(RainbowText_s)
			set RainbowText_i=i
			call TriggerEvaluate(RainbowText_Trg2)
			set decode=RainbowText_d
			set abc=SubString(RainbowText_s,i,i+1*decode)
			set color=ModuloInteger(j+RainbowText_shift,RainbowText_mode)
			if 1==0 then
			elseif RainbowText_mode==2 then
				if color==1 then
					set abc=ColorWhite(abc)
				elseif color==0 then
					set abc=ColorBlack(abc)
				endif
			elseif RainbowText_mode==7 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorGreen(abc)
				elseif color==5 then
					set abc=ColorCyan(abc)
				elseif color==6 then
					set abc=ColorBlue(abc)
				elseif color==0 then
					set abc=ColorViolet(abc)
				endif
			elseif RainbowText_mode==12 then
				if 1==0 then
				elseif color==1 then
					set abc=ColorRed(abc)
				elseif color==2 then
					set abc=ColorOrange(abc)
				elseif color==3 then
					set abc=ColorYellow(abc)
				elseif color==4 then
					set abc=ColorYellowGreen(abc)
				elseif color==5 then
					set abc=ColorGreen(abc)
				elseif color==6 then
					set abc=ColorGreenCyan(abc)
				elseif color==7 then
					set abc=ColorCyan(abc)
				elseif color==8 then
					set abc=ColorCyanBlue(abc)
				elseif color==9 then
					set abc=ColorBlue(abc)
				elseif color==10 then
					set abc=ColorBlueViolet(abc)
				elseif color==11 then
					set abc=ColorViolet(abc)
				elseif color==0 then
					set abc=ColorVioletRed(abc)
				endif
			endif
			set RainbowText_abc=abc
			call TriggerEvaluate(RainbowText_Trg3)
			if StringLength(RainbowText_ss)>4000 then
				call BJDebugMsg("Rainbow Length 4000")
				set RainbowText_ss=""
				return false
			endif
			set i=i+1*decode
			set j=j+1
		endloop
		return false
	else
		call BJDebugMsg("Rainbow Length 0")
		set RainbowText_ss=""
		return false
	endif
	return false
endfunction
function RainbowText_Init takes nothing returns nothing
	call TriggerAddCondition(RainbowText_Trg1, Condition(function RainbowText_Act1))
	call TriggerAddCondition(RainbowText_Trg2, Condition(function RainbowText_Act2))
	call TriggerAddCondition(RainbowText_Trg3, Condition(function RainbowText_Act3))
endfunction
function RainbowText takes string s, integer shift, integer mode returns string
	set RainbowText_s=s
	set RainbowText_shift=shift
	set RainbowText_mode=mode
	call TriggerEvaluate(RainbowText_Trg1)
	return RainbowText_ss
endfunction

function Dancer_Main takes nothing returns nothing
	local string ss=RainbowText(Dancer_text,Dancer_i,Dancer_mode)
	call SetTextTagText(Dancer_textTag,ss,TextTagSize2Height(15))
	//call SetTextTagPos(Dancer_textTag,GetCameraTargetPositionX(),GetCameraTargetPositionY(),0)
	call SetTextTagPos(Dancer_textTag,-800,-50,0)
	call BJDebugMsg(ss)
	if Dancer_direction=="Left" then
		set Dancer_i=Dancer_i+1
	else
		set Dancer_i=Dancer_i-1
	endif
	if Dancer_i==1000000 or Dancer_i==-1000000 then
		set Dancer_i=0
	endif
call SetPlayerName(Player(1),ss)
endfunction

function Dancer_init takes nothing returns nothing
	call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
	set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
	call DisableTrigger(Dancer_t)
	//call EnableTrigger(Dancer_t)
	call SetTextTagVisibility(Dancer_textTag,false)
	//call SetTextTagVisibility(Dancer_textTag,true)

endfunction

function Start_msg takes nothing returns nothing
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg(" ")
	call BJDebugMsg("Map Rainbow Text")
	call BJDebugMsg("Command examples:")
	call BJDebugMsg("-help or -h = this info")
	call BJDebugMsg("-test = test long string")
	call BJDebugMsg("-test AAA = test AAA string")
	call BJDebugMsg("-go = go disco dance")
	call BJDebugMsg("-t TEXT = change disco text")
	call BJDebugMsg("-r = right direction")
	call BJDebugMsg("-l = left direction")
	call BJDebugMsg("-s 0.5 = speed")
	call BJDebugMsg("-m 12 = color mode [2, 7, 12]")
	call BJDebugMsg("-name text = 2nd player name")
endfunction

function Start takes nothing returns nothing
	local string ss=GetEventPlayerChatString()
	local string s=StringCase(ss,false)
	if 1==0 then
	elseif s=="-test" then
		set s="WWWWWWWWWWWWWWWяяяяяяяяяяяяяя❤❤❤❤❤❤❤❤❤❤"
		call BJDebugMsg(RainbowText(s,0,2))
		call BJDebugMsg(RainbowText(s,0,7))
		call BJDebugMsg(RainbowText(s,0,12))
	elseif SubString(s,0,6)=="-test " then
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,2))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,7))
		call BJDebugMsg(RainbowText(SubString(ss,6,999),0,12))
	elseif s=="-go" then
		if Dancer_ON==0 then
			set Dancer_ON=1
			call EnableTrigger(Dancer_t)
			//set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
			call SetTextTagVisibility(Dancer_textTag,true)
		elseif Dancer_ON==1 then
			set Dancer_ON=0
			call DisableTrigger(Dancer_t)
			//call TriggerRemoveAction(Dancer_t, Dancer_Act0)
			call SetTextTagVisibility(Dancer_textTag,false)
		endif
	elseif SubString(s,0,3)=="-t " then
		set Dancer_text=SubString(ss,3,999)
	elseif s=="-right" or s=="-r" then
		set Dancer_direction="Right"
	elseif s=="-left" or s=="-l" then
		set Dancer_direction="Left"
	elseif SubString(s,0,3)=="-s " then
if S2R(SubString(s,3,999))>0 and S2R(SubString(s,3,999))<101 then
		set Dancer_speed=S2R(SubString(s,3,999))
		call DisableTrigger(Dancer_t)
		call TriggerRemoveAction(Dancer_t, Dancer_Act0)
		set Dancer_t=CreateTrigger()
		call TriggerRegisterTimerEvent(Dancer_t,Dancer_speed,true)
		set Dancer_Act0=TriggerAddAction(Dancer_t,function Dancer_Main)
endif
	elseif SubString(s,0,3)=="-m " then
		set Dancer_mode=S2I(SubString(s,3,999))
	elseif s=="-help" or s=="-h" then
		call Start_msg()

	elseif SubString(s,0,6)=="-name " then
	set s=RainbowText(SubString(s,6,999),0,7)
	call SetPlayerName(Player(1),s)
	call BJDebugMsg("player 2 name "+s)
	endif
endfunction

function Ch_init takes nothing returns nothing
	local trigger t=CreateTrigger()
	local integer i=1
	loop
		exitwhen i>PLAYERS
		call TriggerRegisterPlayerChatEvent(t,Player(i-1),"-",false)
		set i=i+1
	endloop
	call TriggerAddAction(t,function Start)
endfunction

function Start_init takes nothing returns nothing
	call Ch_init()
	call Start_msg()
	call RainbowText_Init()
	call Dancer_init()
endfunction

function CreateAllUnits takes nothing returns nothing
	set u[1] = CreateUnit(Player(0), 'Hblm', -800, -50, 3.977)
	set u[2] = CreateUnit(Player(1), 'hpea', -400, -50, 3.977)
endfunction
function InitCustomPlayerSlots takes nothing returns nothing
	// Player 0
	call SetPlayerStartLocation( Player(0), 0 )
	call SetPlayerColor( Player(0), ConvertPlayerColor(0) )
	call SetPlayerRacePreference( Player(0), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(0), false )
	call SetPlayerController( Player(0), MAP_CONTROL_USER )
	// Player 1
	call SetPlayerStartLocation( Player(1), 1 )
	call SetPlayerColor( Player(1), ConvertPlayerColor(1) )
	call SetPlayerRacePreference( Player(1), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(1), false )
	call SetPlayerController( Player(1), MAP_CONTROL_COMPUTER )
	// Player 11
	call SetPlayerStartLocation( Player(11), 2 )
	call ForcePlayerStartLocation( Player(11), 2 )
	call SetPlayerColor( Player(11), ConvertPlayerColor(11) )
	call SetPlayerRacePreference( Player(11), RACE_PREF_NIGHTELF )
	call SetPlayerRaceSelectable( Player(11), false )
	call SetPlayerController( Player(11), MAP_CONTROL_COMPUTER )
endfunction
function InitCustomTeams takes nothing returns nothing
	call SetPlayerTeam( Player(0), 0 )
	call SetPlayerTeam( Player(1), 0 )
	call SetPlayerAllianceStateAllyBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateAllyBJ( Player(1), Player(0), true )
	call SetPlayerAllianceStateVisionBJ( Player(0), Player(1), true )
	call SetPlayerAllianceStateVisionBJ( Player(1), Player(0), true )
	call SetPlayerTeam( Player(11), 1 )
endfunction
function InitAllyPriorities takes nothing returns nothing
	call SetStartLocPrioCount( 0, 1 )
	call SetStartLocPrio( 0, 0, 1, MAP_LOC_PRIO_HIGH )
	call SetStartLocPrioCount( 1, 1 )
	call SetStartLocPrio( 1, 0, 0, MAP_LOC_PRIO_HIGH )
endfunction

function main takes nothing returns nothing
	call Start_init()
	call SetCameraBounds(-3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), -3328.0 + GetCameraMargin(CAMERA_MARGIN_LEFT), 3072.0 - GetCameraMargin(CAMERA_MARGIN_TOP), 3328.0 - GetCameraMargin(CAMERA_MARGIN_RIGHT), -3584.0 + GetCameraMargin(CAMERA_MARGIN_BOTTOM) )
	call SetDayNightModels( "Environment\\DNC\\DNCLordaeron\\DNCLordaeronTerrain\\DNCLordaeronTerrain.mdl", "Environment\\DNC\\DNCLordaeron\\DNCLordaeronUnit\\DNCLordaeronUnit.mdl")
	call NewSoundEnvironment("Default")
	call SetAmbientDaySound("LordaeronSummerDay")
	call SetAmbientNightSound("LordaeronSummerNight")
	call SetMapMusic("Music", true, 0)
	call CreateAllUnits()
	call InitBlizzard()
endfunction
function config takes nothing returns nothing
	call SetMapName( "TRIGSTR_001" )
	call SetMapDescription( "TRIGSTR_003" )
	call SetPlayers( 3 )
	call SetTeams( 3 )
	call SetGamePlacement( MAP_PLACEMENT_TEAMS_TOGETHER )
	call DefineStartLocation( 0, -800.0, -50.0 )
	call DefineStartLocation( 1, -800.0, -50.0 )
	call DefineStartLocation( 2, -800.0, -50.0 )
	call InitCustomPlayerSlots(  )
	call InitCustomTeams(  )
	call InitAllyPriorities(  )
endfunction
endfunction
Загруженные файлы
14

» WarCraft 3 / Функция определения длины символа

обновление
в -s команду добавлен вывод введённого символа, а не только его длины
Загруженные файлы
14

» WarCraft 3 / как изменить время внутри таймерного периодического триггера?

Поясни, а чем тебе не подходит обычный таймер?
во-первых периодический таймер нельзя запаузить, а потом включить работать дальше (без костылей)
во-вторых изменение времени в нём же не будет отличаться по сути от тригера? т.е. в таймере тоже надо заново его объявлять если надо сменить периодичность таймера, да?
14

» WarCraft 3 / как изменить время внутри таймерного периодического триггера?

TimerStart()
для периодики он не годится, т.к. пауза тупо не работает:
ResumeTimer​
Has no effect if passed timer is running. If passed timer is paused or has expired, launches it for TimerGetRemaining, and after this time is elapsed, launches it again for TimerGetTimeout. After that passed timer is stopped even if it is periodic.

По этой же причине я сам отказался от использования такого триггера, чтобы не морочить себе голову.
альтернатив то по сути нету
самописные ещё более заморочеголовые чем нативки
14

» WarCraft 3 / ЦВЕТ - как из игры получить точные значения playercolor в RGB кодировке ?

цветовые функции:
первая определяет код цвета по игровой константе
вторая красит строку

Vanilla

Код
function GetColorClassic takes player p returns string
	local playercolor color = GetPlayerColor(p)
	if color==PLAYER_COLOR_RED then
		return "FF0303" //1
	elseif color==PLAYER_COLOR_BLUE then
		return "0042FF" //2
	elseif color==PLAYER_COLOR_CYAN then
		return "1CE6B9" //3
	elseif color==PLAYER_COLOR_PURPLE then
		return "540081" //4
	elseif color==PLAYER_COLOR_YELLOW then
		return "FFFC01" //5
	elseif color==PLAYER_COLOR_ORANGE then
		return "FEBA0E" //6
	elseif color==PLAYER_COLOR_GREEN then
		return "20C000" //7
	elseif color==PLAYER_COLOR_PINK then
		return "E55BB0" //8
	elseif color==PLAYER_COLOR_LIGHT_GRAY then
		return "959697" //9
	elseif color==PLAYER_COLOR_LIGHT_BLUE then
		return "7EBFF1" //10
	elseif color==PLAYER_COLOR_AQUA then
		return "106246" //11
	elseif color==PLAYER_COLOR_BROWN then
		return "4E2A04" //12
	endif
	return ""
endfunction
function Color00PlayerRedClassic takes string s returns string //1 - 255,3,3
	return "|c"+"ff"+"FF0303"+s+"|r"
endfunction
function Color01PlayerBlueClassic takes string s returns string //2 - 0,66,255
	return "|c"+"ff"+"0042FF"+s+"|r"
endfunction
function Color02PlayerCyanClassic takes string s returns string //3 - 28,230,185
	return "|c"+"ff"+"1CE6B9"+s+"|r"
endfunction
function Color03PlayerPurpleClassic takes string s returns string //4 - 84,0,129
	return "|c"+"ff"+"540081"+s+"|r"
endfunction
function Color04PlayerYellowClassic takes string s returns string //5 - 255,252,1
	return "|c"+"ff"+"FFFC01"+s+"|r"
endfunction
function Color05PlayerOrangeClassic takes string s returns string //6 - 254,138,14
	return "|c"+"ff"+"FEBA0E"+s+"|r"
endfunction
function Color06PlayerGreenClassic takes string s returns string //7 - 32,192,0
	return "|c"+"ff"+"20C000"+s+"|r"
endfunction
function Color07PlayerPinkClassic takes string s returns string //8 - 229,91,176
	return "|c"+"ff"+"E55BB0"+s+"|r"
endfunction
function Color08PlayerLightGrayClassic takes string s returns string //9 - 149,150,151
	return "|c"+"ff"+"959697"+s+"|r"
endfunction
function Color09PlayerLightBlueClassic takes string s returns string //10 - 126,191,241
	return "|c"+"ff"+"7EBFF1"+s+"|r"
endfunction
function Color10PlayerAquaClassic takes string s returns string //11 - 16,98,70
	return "|c"+"ff"+"106246"+s+"|r"
endfunction
function Color11PlayerBrownClassic takes string s returns string //12 - 78,42,4
	return "|c"+"ff"+"4E2A04"+s+"|r"
endfunction

Reforged

Код
function GetColorReforged takes player p returns string
	local playercolor color = GetPlayerColor(p)
	if color==PLAYER_COLOR_RED then
		return "F80402" //1
	elseif color==PLAYER_COLOR_BLUE then
		return "0041F8" //2
	elseif color==PLAYER_COLOR_CYAN then
		return "1AE4B5" //3
	elseif color==PLAYER_COLOR_PURPLE then
		return "52007D" //4
	elseif color==PLAYER_COLOR_YELLOW then
		return "F8F900" //5
	elseif color==PLAYER_COLOR_ORANGE then
		return "F8880D" //6
	elseif color==PLAYER_COLOR_GREEN then
		return "20BD00" //7
	elseif color==PLAYER_COLOR_PINK then
		return "DD5AAA" //8
	elseif color==PLAYER_COLOR_LIGHT_GRAY then
		return "909492" //9
	elseif color==PLAYER_COLOR_LIGHT_BLUE then
		return "7ABDEA" //10
	elseif color==PLAYER_COLOR_AQUA then
		return "106145" //11
	elseif color==PLAYER_COLOR_BROWN then
		return "4D2A05" //12
	elseif color==PLAYER_COLOR_MAROON then
		return "980000" //13
	elseif color==PLAYER_COLOR_NAVY then
		return "0000BD" //14
	elseif color==PLAYER_COLOR_TURQUOISE then
		return "00E8F8" //15
	elseif color==PLAYER_COLOR_VIOLET then
		return "B800F8" //16
	elseif color==PLAYER_COLOR_WHEAT then
		return "E5CA82" //17
	elseif color==PLAYER_COLOR_PEACH then
		return "F0A288" //18
	elseif color==PLAYER_COLOR_MINT then
		return "BAFC7D" //19
	elseif color==PLAYER_COLOR_LAVENDER then
		return "D5B6E5" //20
	elseif color==PLAYER_COLOR_COAL then
		return "4D4E52" //21
	elseif color==PLAYER_COLOR_SNOW then
		return "E5EDF8" //22
	elseif color==PLAYER_COLOR_EMERALD then
		return "00761D" //23
	elseif color==PLAYER_COLOR_PEANUT then
		return "A06E32" //24
	endif
	return ""
endfunction
function Color00PlayerRedReforged takes string s returns string //1 - 248,4,2
	return "|c"+"ff"+"F80402"+s+"|r"
endfunction
function Color01PlayerBlueReforged takes string s returns string //2 - 0,65,248
	return "|c"+"ff"+"0041F8"+s+"|r"
endfunction
function Color02PlayerCyanReforged takes string s returns string //3 - 26,228,181
	return "|c"+"ff"+"1AE4B5"+s+"|r"
endfunction
function Color03PlayerPurpleReforged takes string s returns string //4 - 82,0,125
	return "|c"+"ff"+"52007D"+s+"|r"
endfunction
function Color04PlayerYellowReforged takes string s returns string //5 - 248,249,0
	return "|c"+"ff"+"F8F900"+s+"|r"
endfunction
function Color05PlayerOrangeReforged takes string s returns string //6 - 248,136,13
	return "|c"+"ff"+"F8880D"+s+"|r"
endfunction
function Color06PlayerGreenReforged takes string s returns string //7 - 32,189,0
	return "|c"+"ff"+"20BD00"+s+"|r"
endfunction
function Color07PlayerPinkReforged takes string s returns string //8 - 221,90,170
	return "|c"+"ff"+"DD5AAA"+s+"|r"
endfunction
function Color08PlayerLightGrayReforged takes string s returns string //9 - 144,148,146
	return "|c"+"ff"+"909492"+s+"|r"
endfunction
function Color09PlayerLightBlueReforged takes string s returns string //10 - 122,189,234
	return "|c"+"ff"+"7ABDEA"+s+"|r"
endfunction
function Color10PlayerAquaReforged takes string s returns string //11 - 16,97,69
	return "|c"+"ff"+"106145"+s+"|r"
endfunction
function Color11PlayerBrownReforged takes string s returns string //12 - 77,42,5
	return "|c"+"ff"+"4D2A05"+s+"|r"
endfunction
function Color12PlayerMaroonReforged takes string s returns string //13 - 152,0,0
	return "|c"+"ff"+"980000"+s+"|r"
endfunction
function Color13PlayerNavyReforged takes string s returns string //14 - 0,0,189
	return "|c"+"ff"+"0000BD"+s+"|r"
endfunction
function Color14PlayerTurquoiseReforged takes string s returns string //15 - 0,232,248
	return "|c"+"ff"+"00E8F8"+s+"|r"
endfunction
function Color15PlayerVioletReforged takes string s returns string //16 - 184,0,248
	return "|c"+"ff"+"B800F8"+s+"|r"
endfunction
function Color16PlayerWheatReforged takes string s returns string //17 - 229,202,130
	return "|c"+"ff"+"E5CA82"+s+"|r"
endfunction
function Color17PlayerPeachReforged takes string s returns string //18 - 240,162,136
	return "|c"+"ff"+"F0A288"+s+"|r"
endfunction
function Color18PlayerMintReforged takes string s returns string //19 - 186,252,125
	return "|c"+"ff"+"BAFC7D"+s+"|r"
endfunction
function Color19PlayerLavenderReforged takes string s returns string //20 - 213,182,229
	return "|c"+"ff"+"D5B6E5"+s+"|r"
endfunction
function Color20PlayerCoalReforged takes string s returns string //21 - 77,78,82
	return "|c"+"ff"+"4D4E52"+s+"|r"
endfunction
function Color21PlayerSnowReforged takes string s returns string //22 - 229,237,248
	return "|c"+"ff"+"E5EDF8"+s+"|r"
endfunction
function Color22PlayerEmeraldReforged takes string s returns string //23 - 0,118,29
	return "|c"+"ff"+"00761D"+s+"|r"
endfunction
function Color23PlayerPeanutReforged takes string s returns string //24 - 160,110,50
	return "|c"+"ff"+"A06E32"+s+"|r"
endfunction
Загруженные файлы