Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Bravo1853
User Avatar
Auto-translated
Bravo1853
How do I make a town get destroyed when it's captured?
There are two options:
function raze_captured_town(oldowner, newowner, hero, town)
Trigger(OBJECT_CAPTURE_TRIGGER, town, nil)
RazeTown(town)
end

Trigger(OBJECT_CAPTURE_TRIGGER, 'script_town_name', 'raze_captured_town')
function raze_captured_town(oldowner, newowner, hero, town)
Trigger(OBJECT_CAPTURE_TRIGGER, town, nil)
MakeTownMovable(town)
sleep()
RemoveObject(town)
end

Trigger(OBJECT_CAPTURE_TRIGGER, 'script_town_name', 'raze_captured_town')
The first option leaves behind ruins, but it only works with Haven and Inferno towns. The second option simply removes the town, but it works for towns of all factions.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Auto-translated
How do I add the spells Devil's Chain and Hellfire Wave to a scenario so that they deal damage to the hero?
In reply to Bravo1853
User Avatar
Auto-translated
Bravo1853
How do I add the Devil's Chain and Hellfire Wave spells to a hero's spellbook in the scenario editor so that they deal damage?
In the editor, add them to the hero's spellbook through the properties tree.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
Auto-translated
RedHeavenHero
In the editor, add them to the hero's spellbook through the properties tree.
They aren't there.
User Avatar
Auto-translated
Yes. The spell is called SPELL_UBER_CHAIN_LIGHTNING or something similar, and it’s located near the wave spell in the list.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
Auto-translated
RedHeavenHero
Yes, there is. The chain is called SPELL_UBER_CHAIN_LIGHTNING or something like that, and the wave is located nearby in the list.
I did everything, and it works. I was looking in the wrong place at first. Thank you very much!
In reply to Bravo1853
Auto-translated
I apologize, but how can I force the AI to attack a specific hero, regardless of the danger? I want it to rush towards the player from the very first turn, even if the odds are completely against it, and even if the hero is in a castle.
Auto-translated
Is it possible to create a hero using scripts who doesn't belong to any faction (Neutral, essentially)? It's not necessary for him to be able to move, but if that's possible too, it would be even better.
In reply to Elikuz
User Avatar
Auto-translated
Elikuz
I apologize, how can I force the AI to attack a specific hero, regardless of the danger? So that it rushes towards the player from the very first turn, no matter how dangerous it is, even if the hero is in a castle.
I can suggest a script for the AI to become "interested" in a certain object. However, you will have to keep the hero in one place. Here is the script:
void SetAIPlayerAttractor( sObjectName, nPlayerID, nPriority ) The priority can range from -1 to 2.
Or, here is another script, which will make the hero simply jump to a point with the specified coordinates (during its turn, of course, and if it has move points).
void MoveHero( sHeroName, nX, nY, nFloorID = GROUND )
Когда ты задумываешься о том, что ты задумался, ты перестаёшь задумываться ;)
Хаос во всём тоже порядок...
Кампания Седьмое затмение. Грань Империи.
В стадии разработки 10%
In reply to Варсус
Auto-translated
Varsus
I can offer a script to make the AI more "interested" in a specific object. However, you'll need to keep the hero in one place. Here's the script:
void SetAIPlayerAttractor( sObjectName, nPlayerID, nPriority ) The priority can range from -1 to 2.

So, you have to keep it in one spot? What's the difference then from the second script?
In reply to Варсус
User Avatar
Auto-translated
Scripts, scripts, SCRIPTS! It’s a good thing that Starcraft doesn’t have scripts.
Делаю кампанию "Последний Феникс"
In reply to siro
User Avatar
Auto-translated
siro
Is it possible to create a hero using scripts that doesn't belong to any faction (Neutral, essentially)? It's not even necessary for him to be able to move, but if that's possible too, that would be even better.
SetObjectOwner('scripted_hero_name', player_number_not_participating_in_the_game)

This trick won't work on a map with 8 players.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
How can I ensure that the hero (Frodo) reaches a specific region and then achieves victory?
Делаю кампанию "Последний Феникс"
In reply to RedHeavenHero
Auto-translated
RedHeavenHero
SetObjectOwner('scripted_hero_name', player_number_not_participating_in_the_game)

This trick won't work on a map for 8 players.

So, is it impossible to do this on a map for 8 players? I've just encountered mods where neutral heroes exist, but not as objects on the map. They appeared when engaging in combat with any stack of neutral creatures.
To be more precise, here is that mod:
http://heroescommunity.com/viewthread.php3?TID=41303

Statistics

Welcome our newest member: Emil