Scharfhobel Posted August 30, 2020 Share Posted August 30, 2020 (edited) Привет, помогите добавить в дефолтный конфиг текстовое поле с оставшимся здоровьем для противников. Задача: вывести число выстрелов необходимое для уничтожения цели. Добавил макрос shell_damage.py В блок текстовое поле с оставшимся здоровьем добавил: // Text field with the remaining health. // Текстовое поле с оставшимся здоровьем. "tankHp" : { "align" : "center", "alpha" : 100, "enabled" : true, "format" : "{{hp}} / {{py:math.sum({{py:math.div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} \ {{hp-max}}", "name" : "Tank HP", "shadow" : { "alpha" : 100, "angle" : 45, "blur" : 4, "color" : "0x000000", "distance" : 0, "enabled" : true, "strength" : 1 }, "textFormat" : { "bold" : true, "color" : "0xD9D9D9", "font" : "$FieldFont", "italic" : false, "size" : 11 }, "x" : 0, "y" : -20 }, В бою показывает и для противников и для союзников. Но хотелось бы чтоб показывало только для противников . Edited September 14, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 30, 2020 Share Posted August 30, 2020 Используй {{ally}} или flags либо не добавляй ссылку на поле к союзникам {{py:math.sum... -> {{py:sum... {{py:math.div... -> {{py:div... имхо: если добавлять в дефолт, то отключённым по умолч. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 30, 2020 Author Share Posted August 30, 2020 (edited) 27 минут назад, HEKPOMAHT сказал: Используй {{ally}} или flags либо не добавляй ссылку на поле к союзникам {{py:math.sum... -> {{py:sum... {{py:math.div... -> {{py:div... имхо: если добавлять в дефолт, то отключённым по умолч. Те, заменить {{py:math.sum({{py:math.div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} на {{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} Если можно вот готовый файл, поправьте в нем плиз. markersAliveNormal.xc Edited August 30, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 30, 2020 Share Posted August 30, 2020 "format" : "{{hp}} / {{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} \ {{hp-max}}", // было "{{hp}}" и ссылку на поле ${ "def.tankHp" } у союзников в 122 строке удали. // Настройки для союзников. "ally" : { ... // Блок текстовых полей (поддерживается расширенный формат, см. extra-field.txt). "textFields" : [ ${ "def.tankName" }, ${ "def.playerName" }, ${ "def.tankHp" }, // удалить 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 30, 2020 Author Share Posted August 30, 2020 (edited) 30.08.2020 в 13:28, HEKPOMAHT сказал: "format" : "{{hp}} / {{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} \ {{hp-max}}", // было "{{hp}}" и ссылку на поле ${ "def.tankHp" } у союзников в 122 строке удали. // Настройки для союзников. "ally" : { ... // Блок текстовых полей (поддерживается расширенный формат, см. extra-field.txt). "textFields" : [ ${ "def.tankName" }, ${ "def.playerName" }, ${ "def.tankHp" }, // удалить Всё поправил, но теперь у союзников в полоске хп пропал текст. Чистая полоска без надписи. У противников всё показывает. Edited August 31, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 30, 2020 Share Posted August 30, 2020 @Scharfhobel я тут особо не вникал - думал ты отдельно выстрелы делаешь :) Делай два отдельных текстовых поля для союзников и противников с разным форматом. для противников то что есть, для союзников без расчёта: "format" : "{{hp}} / {{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} \ {{hp-max}}", // tankHpEnemy "format" : "{{hp}} / {{hp-max}}", // tankHpAlly tankHpEnemy - для противников tankHpAlly - для союзников ссылку вернёшь с новым названием @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 30, 2020 Author Share Posted August 30, 2020 (edited) Добавил второе поле для противников. Добавил в 122 строку и в 551 , что это? определения для "textFields" : [ ${ "def.tankName" }, ${ "def.playerName" }, ${ "def.tankHpAlly" }, ${ "def.tankHpEnemy" }, ${ "def.rating" }, ${ "def.xmqpEvent" } ], но ругается на ошибку. JSONxLoaderException: Bad reference: ${"res_mods/configs/xvm\default\markersAliveNormal.xc": "def.tankHpAlly"} in "res_mods/configs/xvm\default\markersAliveNormal.xc:markers/enemy/alive/normal/textFields[1]" Object "./def" has no key "tankHpAlly" xvm.log markersAliveNormal.xc Edited August 30, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 30, 2020 Share Posted August 30, 2020 markersAliveNormal.xc 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 30, 2020 Author Share Posted August 30, 2020 37 минут назад, HEKPOMAHT сказал: markersAliveNormal.xc 20 kB · 0 скачиваний спс., то что нужно. 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 Привет всем, захотелось еще покрасить цифры в желтый цвет, если осталось здоровья на 1 шот. Не соображу где и что для этого нужно поправить в markersAliveNormal ? Ткните носом плиз. @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 31, 2020 Share Posted August 31, 2020 8 минут назад, Scharfhobel сказал: захотелось еще покрасить цифры в желтый цвет, если осталось здоровья на 1 шот. в зависимости что красить - целиком либо только шоты, типо такого: "textFormat": { "color": "{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d=1?#FFFF00|#FFFFFF}}" }, либо: "format" : "{{hp}} / <font color='{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d=1?#FFFF00|#FFFFFF}}'>{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}}</font> \ {{hp-max}}", 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 (edited) 27 минут назад, HEKPOMAHT сказал: в зависимости что красить - целиком либо только шоты, типо такого: "textFormat": { "color": "{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d=1?#FFFF00|#FFFFFF}}" }, либо: "format" : "{{hp}} / <font color='{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d=1?#FFFF00|#FFFFFF}}'>{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}}</font> \ {{hp-max}}", хотелось всю надпись целиком чтоб было 1500 / 1 \ 50 , пробую 1 вариант. добавил вот сюда: // Текстовое поле с оставшимся здоровьем и расчётом шота противники. "tankHpEnemy": { "$ref": { "path": "def.tankHpAlly" }, "format" : "{{hp}} / {{py:math.sum({{py:math.div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d}} \ {{hp-max}}", "textFormat": { "color": "{{py:sum({{py:div({{hp>0?{{hp}}|0}},{{py:shell_damage.shell_damage}})}},0.5)%d=1?#FFFF00|#FFFFFF}}" } }, // Text field with the name of the tank. Edited August 31, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 31, 2020 Share Posted August 31, 2020 15 минут назад, Scharfhobel сказал: хотелось всю надпись целиком чтоб было 1500 / 1 \ 50 , пробую 1 вариант. markersAliveNormal.xc 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 19 минут назад, HEKPOMAHT сказал: markersAliveNormal.xc 20 kB · 1 скачивание к сожалению у шотных цвет не меняется. @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 31, 2020 Share Posted August 31, 2020 @Scharfhobel скинь скрипт shell_damage.py - я проверю у себя. По идее должен меняться. @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 20 минут назад, HEKPOMAHT сказал: @Scharfhobel скинь скрипт shell_damage.py - я проверю у себя. По идее должен меняться. import BigWorld @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr.shell.kind == 'HIGH_EXPLOSIVE': return "%i" % (shotDescr.shell.damage[0] // 2) else: return "%i" % (shotDescr.shell.damage[0]) shell_damage.py @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 31, 2020 Share Posted August 31, 2020 43 минуты назад, Scharfhobel сказал: к сожалению у шотных цвет не меняется. markersAliveNormal.xc @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 (edited) 15 минут назад, HEKPOMAHT сказал: markersAliveNormal.xc 20 kB · 0 скачиваний , спасибо, теперь отлично видно шотных. <2 сработало, а =1 нет? странные дела Пы.Сы. а можно ли таким же образом перекрасить иконку типа танка и/или название танка? Edited August 31, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
HEKPOMAHT Posted August 31, 2020 Share Posted August 31, 2020 2 часа назад, Scharfhobel сказал: а можно ли таким же образом перекрасить иконку типа танка и/или название танка? картинки иконок экстра полями не редактируются. Название покрасил в шот-жёлтый. markersAliveNormal.xc 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Scharfhobel Posted August 31, 2020 Author Share Posted August 31, 2020 (edited) 1 час назад, HEKPOMAHT сказал: картинки иконок экстра полями не редактируются. Название покрасил в шот-жёлтый. markersAliveNormal.xc 21 kB · 1 скачивание Спасибо! С желтым именем танка гораздо заметней стало. Тут народ попросил скрины. Оказалось сравнение малось сбоит, дает желтый уже при кол-ве выстрелов 2. Edited August 31, 2020 by Scharfhobel @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.