Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Okay, fine (I'm just too lazy to write everything out, and I'm having some issues with the script on the map myself). 2) Create a region and change the Priority to something suitable. **(I haven't tested this!)**, and you can also set the priority to -1 for other objects. The result is approximately this: - Hmm... something in the region, hey you helmet-heads, we have guests. - OK! Whatever, there's an enemy!
Кампания в разработке:
Название не придумал
Выполнено 5%
In reply to DarkLordax
User Avatar
Auto-translated
DarkLordax
Okay, fine (I'm just too lazy to write everything out, and I'm having some issues with the script on the map).

2) Create a region and change the Priority to something suitable (I haven't tested this!), and you can also set the priority to -1 for other objects.

The result is roughly this:
- Hmm... something in the region, hey you helmet-heads, we have guests.
- OK! Whatever, there's an enemy!
Is this priority a script or a function?
...И справедливость я несу
На острие меча.


Кампания "Искупление" - 15%



О кампании

"Искупление" - это мой амбициозный проект. Давняя мечта. С детства играя в героев, я восхищался персонажами и ландшафтами, сюжетом и стилем оригинальной трилогии, я мечтал привнести что-то свое в эту игру,  и наконец, более-менее освоив нелегкий труд картостроителя, взялся за воплощение мечты. Кампания расскажет о будущем выживших рыцарей Кровавой Стали, о пути, который они избрали, и о том, куда этот путь их приведет. К слову, мне нужен тестер-оценщик. Если хочешь принять участие в создании и есть определенный опыт, то - добро пожаловать!



User Avatar
Auto-translated
There should be a function called SetAIPlayerAttractor, but there is SetAIHeroAttractor (well, it's a script, I understand!).
One is for a specific hero, the other is just for the player.
Here's something else:

DoNotGiveTurnToPlayerAIIfNoTownsAndActiveHeroes
should be in the script file.
Кампания в разработке:
Название не придумал
Выполнено 5%
In reply to DarkLordax
User Avatar
Auto-translated
DarkLordax
So, what's wrong here!

function pobor1()
if GetObjectiveState("SQ1", 1) ==OBJECTIVE_UNKNOWN then
SetObjectiveState("SQ1", OBJECTIVE_ACTIVE, 1);
MessageBox("Maps/SingleMissions/C1W1/poborQ1.txt", "nothing");
if IsObjectExists("pobornik1") ==false then
if IsObjectExists("pobornik2") ==false then
if IsObjectExists("pobornik3") ==false then
SetObjectiveState("SQ1", OBJECTIVE_COMPLETED, 1);
SetObjectEnabled("dwellquest1", true);
SetObjectOwner("dwellquest1", 1);
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", nil)
end;
end;
end;
elseif GetObjectiveState("SQ1", 1) ==OBJECTIVE_ACTIVE then
if IsObjectExists("pobornik1") ==false then
if IsObjectExists("pobornik2") ==false then
if IsObjectExists("pobornik3") ==false then
MesageBox("Maps/SingleMissions/C1W1/poborEND.txt", "nothing");
SetObjectEnabled("dwellquest1", true);
SetObjectOwner("dwellquest", 1);
SetObjectiveState("SQ1", OBJECTIVE_COMPLETED, 1);
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", nil)
end;
end;
end;
end
end
Trigger(OBJECT_TOUCH_TRIGGER, "dwellquest1", "pobor1")

The almighty console writes ERROR attempt to call a nil value. But where is this nil value!

In short, everything works only if all three enemies (pobornik) are killed before taking the quest; then it will be completed! If you take the quest first, then some nil value pops up!

I wouldn't recommend ever using the word false! It's unlikely that the problem is in it, although who knows, but besides errors in the console, false and true haven't caused anything else for me.

Added 1 minute ago
Using these two words is fundamentally incorrect. There is nil, 0, 1, etc. It already depends on the script command.

Added 52 minutes ago
How can I give a hero Perfect Necromancy?
Карты для героев 5

"Плата за любовь"
"Путь некроманта"
"Темные грани"
"Рок Гримхейма"
In reply to AstralLein
Auto-translated
AstralLein
How can I give a hero the Perfect Necromancy skill?

1. Amulet of Mastery
2. In the editor, set the hero's PrimarySkillMastery to MASTERY_EXTRA_EXPERT.
Unfortunately, it won't work through GiveHeroSkill. (At least, it didn't work for me).
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
In reply to AstralLein
Auto-translated
AstralLein
I mean, give it as a reward for completing a quest, using a script.

As an alternative: give the player an Amulet, and if their Necromancy skill is below Expert, increase it using GiveHeroSkill.
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
In reply to AstralLein
User Avatar
Auto-translated
AstralLein
I wouldn't recommend ever using the word "false"! It's unlikely that the issue is related to it, although who knows, but besides the errors in the console, "false" and "true" haven't caused me any other problems.

Added 1 minute ago
Using these two words is fundamentally incorrect. There are "nil," 0, 1, etc. It depends on the scripting command.

Added 52 minutes ago
How can I give a hero the "Perfect Necromancy" skill?
I had a similar problem: MesageBox(One s)!
Кампания в разработке:
Название не придумал
Выполнено 5%
Auto-translated
There's a problem: here's the code:
function portal(hero)
if GetObjectOwner(hero) == 1 then
if GetObjectiveState("tom") == OBJECTIVE_UNKNOWN then
MessageBox(path.."tom1.txt")
end
if GetObjectiveState("tom") == OBJECTIVE_ACTIVE then
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")')
end
end
end

Trigger(OBJECT_TOUCH_TRIGGER, "portal","portal")

function Dragon(hero)
local week = ceil(GetDate(DAY) / 7)
sleep(3)
--
StartCombat(hero,nil,3,84, diff * week, 84, diff * week, 84, diff * week,nil,'BattleResult',nil,nil)
end
Everything works fine, but... (see the screenshot) What could be causing this? I just want the console to be clean and not display an error.
Attachments 1
1 file attached • Total size: 28.0 KB
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
In reply to AlekseyS
User Avatar
Auto-translated
AlekseyS
There is a problem: here is the code
function portal(hero)
if GetObjectOwner(hero) == 1 then
if GetObjectiveState("tom") == OBJECTIVE_UNKNOWN then
MessageBox(path.."tom1.txt")
end
if GetObjectiveState("tom") == OBJECTIVE_ACTIVE then
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")')
end
end
end

Trigger(OBJECT_TOUCH_TRIGGER, "portal","portal")

function Dragon(hero)
local week = ceil(GetDate(DAY) / 7)
sleep(3)
--
StartCombat(hero,nil,3,84, diff * week, 84, diff * week, 84, diff * week,nil,'BattleResult',nil,nil)
end
Everything works fine, but... (see screenshot)

What could be causing this? I just want the console to be clean and not display an error.

This is due to calling the callback with a parameter. By default, the scripting engine simply adds two parentheses (and parameters, in some cases) to the name and executes the resulting code. If you call the callback with custom parameters, the executable code will look like this:
'Dragon("'..hero..'")()'
that is, after calling the Dragon function, the result returned from it will be called, and since the function does not return anything, an error occurs when trying to call nil.

It can be fixed by adding two hyphens:
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")--')
then the executable code will look like this:
'Dragon("'..hero..'")--()'
that is, the extra parentheses will be commented out.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
Auto-translated
RedHeavenHero
This is due to the callback being called with a parameter. By default, the scripting engine simply adds two parentheses (and parameters, in some cases) to the name and executes the resulting code. If you call the callback with custom parameters, the code to be executed will be something like this:
'Dragon("'..hero..'")()'
that is, after calling the Dragon function, the result returned from it will be called, and since the function returns nothing, an error occurs when trying to call nil.

It can be fixed by adding two minus signs:
QuestionBox(path.."tom2.txt",'Dragon("'..hero..'")--')
then the code to be executed will look like this:
'Dragon("'..hero..'")--()'
that is, the extra parentheses will be commented out.

It helped, thank you.
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения

Statistics

Welcome our newest member: Emil