Skip to content

Posts from Scripts for beginners.

4.5 (2 ratings)
In reply to HeroOfDestiny
User Avatar
#291
Auto-translated
HeroOfDestiny, what is the console complaining about?
User Avatar
#292
Auto-translated
Function MakeHeroes not defined, line 13. That's how it is; I don't know what this means.
In reply to HeroOfDestiny
User Avatar
#293
Auto-translated
HeroOfDestiny
Function MakeHeroes not defined, line 13
That's what happened, I don't know what it is.
Share everything you have in the Lua file. Something else seems to be broken.
User Avatar
#294
Auto-translated
SetPlayerStartResources(1, 0, 0, 0, 0, 0, 0, 0);



function Bitwa()
StartCombat("Ottar", nil, 2, 29, 1000, 29, 1005, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva", "Bitwa");

function MakeHeroes()
DeployReserveHero("Itil", 127, 74, 0);
ChangeHeroStat("Itil", 0, 90000);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "geroy", "MakeHeroes")

As I understand, you are referring to this.
These are all the scripts that exist.
In reply to HeroOfDestiny
User Avatar
#295
Auto-translated
HeroOfDestiny
SetPlayerStartResources(1, 0, 0, 0, 0, 0, 0, 0);



function Bitwa()
StartCombat("Ottar", nil, 2, 29, 1000, 29, 1005, nil, nil, nil);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva", nil);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "bitva", "Bitwa");

function MakeHeroes()
DeployReserveHero("Itil", 127, 74, 0);
ChangeHeroStat("Itil", 0, 90000);
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "geroy", "MakeHeroes")

As I understand it, you're talking about this.
These are all the scripts that are available.
That's strange, everything works for me. Please send a screenshot of the error in the console.
In reply to Азгалор
User Avatar
#296
Auto-translated
Hello! I have a question. How can I make it so that when all the creatures of the final boss in the castle are killed, angels appear on his side? I know that this is done through combat scripts, but I don't know exactly how it's done and how to link them specifically to this hero.

Added after 10 minutes
function DefenderCreatureDeath(unit_name)
if GetDefenderCreatures()[0]==nil and stage==1 then
SummonCreature(DEFENDER, CREATURE_ANGELS, 250, 12, 2);

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to Азгалор
User Avatar
#297
Auto-translated
Azgalor
That’s strange; it works for me. Please send a screenshot of the error from the console.
Attachment 68497
Here's some kind of error.
I had to cut out some things to add it because the file size was too large
Attachments 1
1 file attached • Total size: 9.3 KB
User Avatar
#298
Auto-translated
BlueHeavenHero, try this:
spawn_angels = 0

function DefenderCreatureDeath()
      local boss_creatures = GetDefenderCreatures();
            if (length(boss_creatures) == 0) and stage == 1 then
                  if spawn_angels == 0 then
                              spawn_angels = 1
                              SummonCreature(DEFENDER, CREATURE_ANGEL, 250, 12, 2);
                        end
            end
end


Added 1 minute ago
HeroOfDestiny, did you add Ilfin to the reserve for the desired player?
User Avatar
#299
Auto-translated
Ah, I definitely didn't do that. But how? Can you give me a hint?
In reply to HeroOfDestiny
User Avatar
#300
Auto-translated
HeroOfDestiny
Aha, I definitely didn't do that.
But how? Can you give me a hint?
In Map Properties, go to the Players Properties section, select the player you want, and add a hero to the Reserve Heroes List using the Add button. Your scripted hero is Ilfina.
In reply to Азгалор
User Avatar
#301
Auto-translated
Azgalor
In Map Properties, go to the Players Properties section, select the player you need, and add a hero to the Reserve Heroes List using the Add button. Your scripted hero is Ilfina.
Thank you! Everything works for me now! You are the best!

Is it okay if I come here often? I'm a newbie when it comes to scripting in the editor, and I'll need help.
In reply to HeroOfDestiny
User Avatar
#302
Auto-translated
HeroOfDestiny
Thank you! Everything works for me now! You are the best!

Is it okay if I come here often? I'm a newbie when it comes to scripting in the editor, and I'll need help.
Feel free to ask, that's what this thread is for.
In reply to Азгалор
User Avatar
#303
Auto-translated
Azgalor
BlueHeavenHero, try this:
spawn_angels = 0

function DefenderCreatureDeath()
      local boss_creatures = GetDefenderCreatures();
            if (length(boss_creatures) == 0) and stage == 1 then
                  if spawn_angels == 0 then
                              spawn_angels = 1
                              SummonCreature(DEFENDER, CREATURE_ANGEL, 250, 12, 2);
                        end
            end
end


Added 1 minute ago
HeroOfDestiny, did you add Ilfin to the reserve for the desired player?
Thank you for your help! I'll try testing it later.

Added 2 hours 37 minutes ago
By the way... How do I attach a combat script to a town?
And another question - how do I make the knight-defender of the castle cast a prayer at the beginning?

Added 2 hours 14 minutes ago
Good day. How do I make a certain function run after a video plays?

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
#304
Auto-translated
BlueHeavenHero

By the way... How do you attach a combat script to a town?
And another question - how do you make it so that at the beginning, the knight-defender of the castle casts a prayer?
How do you make it so that after the video plays, some function is executed?
1. The same way as with a hero, but instead of Combat Script, go lower in the town's properties and use the script string.
2. I don't know if it will work with prayer, but try UnitCastGlobalSpell(GetDefenderHero(), SPELL_PRAYER). Don't forget to give the hero the Prayer skill.
3. StartDialogScene("link to the video", "function")
User Avatar
#305
Auto-translated
I have a question! How can I make a hero stay in a castle?

Statistics

Welcome our newest member: Emil