Skip to content
User Avatar
#3776
Auto-translated
Hello, I have a couple of questions about your script: there cannot be a creature named "Priest" on the battlefield, just like there cannot be "Osillian" (if this is a variable that stores the correct name, then it's fine, but if you forgot the quotes, read on). All creatures have a composite script name in the form "coordinates+ID+number," and this name is stored in the first argument of the hook. In your case, this is the "unit" variable. But "Priest" and "Osillian" are not on the battlefield. Write a hook for the turn of the defending hero, and inside it, add a check: ```lua for n, creature in GetDefenderCreatures() do local id = GetCreatureType(creature) if id == CREATURE_ARCHER then local targets = GetAttackerCreatures() chosen_target = targets[random(length(targets)+1] -- actions with the archer creature and the chosen_target end end ``` You need to rewrite the "random" function because the standard one doesn't work. You can take the randomizer from Echoes of the Void by RedHeavenHero, if he doesn't mind, or write it yourself.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________