Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
#2795
Auto-translated
Does anyone know how the startCombat function works? I'm planning to create a series of campaigns, but before that, I want to test all the scripts. Here's the thing: I saw in the manual that an enemy hero can be used as an enemy in combat, and in the fifth mission of campaign 6, the hero's stats were stored in the map file. How can I do that?;)

And a similar question about siegeTown: how do I set the city's stats?
User Avatar
#2796
Auto-translated
If I understand the question correctly, you need to, for example, create a copy of the standard town description in your map (this will be a file with an extension like AdvMapTownShared), customize it as needed, and then specify it as a parameter in SiegeTown. The Heroes files, such as AdvMapHeroShared, are copies of standard heroes or new heroes; they are automatically generated when you manipulate the Shared hero.
Нет войне.
In reply to Gerter
User Avatar
#2797
Спасибо:D
In reply to Gerter
User Avatar
#2798
Auto-translated
Gerter
If I understand the question correctly, you need to, for example, create a copy of the standard town description in your map (this will be a file with an extension like AdvMapTownShared), customize it as needed, and then specify it as a parameter in SiegeTown. The Heroes of Might and Magic files, such as AdvMapHeroShared, are copies of standard or new heroes; they are automatically generated when you manipulate the Shared hero.
Could you elaborate? I don't understand how the town file in the game folder relates to the fact that StartCombat triggers a battle with a hero.
...И справедливость я несу
На острие меча.


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



О кампании

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



User Avatar
#2799
Auto-translated
you can specify the town file as a parameter in SiegeTown, without placing it on the map. StartCombat is not relevant here.
Нет войне.
In reply to Gerter
User Avatar
#2800
Auto-translated
Gerter
you can specify the town file as a parameter in SiegeTown, without placing it on the map. StartCombat is not relevant here.
Oh, I didn't notice his question below, sorry.
...И справедливость я несу
На острие меча.


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



О кампании

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



User Avatar
#2802
Auto-translated
That’s exactly what I meant; StartCombat has nothing to do with it. I was only referring to SiegeTown.
Нет войне.
User Avatar
#2804
Auto-translated
Is there a function or script that can be used to make the AI attack a town or player? I need it so that as soon as a player enters a zone, certain AI armies immediately rush to attack the player's heroes and castles, if the player captures them.
...И справедливость я несу
На острие меча.


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



О кампании

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



User Avatar
#2805
Auto-translated
How can I make an allied hero follow the main hero, like Laslo does on the second map of the "Frida's Dilemma" campaign?
...И справедливость я несу
На острие меча.


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



О кампании

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



User Avatar
#2806
Auto-translated
via MoveHero to the coordinates of the desired hero, minus 1, for example.
Нет войне.
In reply to Gerter
User Avatar
#2807
Auto-translated
Gerter
use MoveHero to move to the coordinates of the desired hero, minus 1, for example
Thank you!
...И справедливость я несу
На острие меча.


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



О кампании

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



In reply to inQizitOr
#2808
Auto-translated
inQizitOr
How do you make an allied hero follow the main hero, like Laszlo does in the second map of the "Freyda's Dilemma" Campaign?
I found it in the same mission: a script that makes him follow her:

MustFollow = 1
OUR_HERO_FREYDA = "Freyda";
OUR_HERO_LASZLO = "Laszlo";
FOLLOWING_RADIUS = 5.5;

function Distance(Object1,Object2)
if IsObjectExists(Object1) == true then
Obj1_x,Obj1_y,Obj1_z = GetObjectPosition(Object1);
else
print("Object1 ",Object1," doesn't exist");
return -1;
end;
if IsObjectExists(Object2) == true then
Obj2_x,Obj2_y,Obj2_z = GetObjectPosition(Object2);
else
print("Object2 ",Object2," doesn't exist");
return -1;
end;
if Obj1_z == Obj2_z then
SQRT = sqrt((Obj1_x - Obj2_x)*(Obj1_x - Obj2_x) + (Obj1_y - Obj2_y)*(Obj1_y - Obj2_y));
return SQRT;
else
print("Error. Objects are not at same ground level.");
return -1;
end;
end;

function FollowHeroRealTime(Master, Slave, Radius)
while 1 do
sleep(5);
if IsHeroAlive(Master) == nil or IsHeroAlive(Slave) == nil or Distance(Master,Slave) == -1 then
print("hero alive master = ",IsHeroAlive(Master) );
print("hero alive slave = ",IsHeroAlive(Slave) );
print("Distance value = ", Distance(Master,Slave) );
print("One of heroes is dead. Thread FollowHeroRealTime terminated...");
return
end;
while Distance(Master,Slave) >= Radius and MustFollow == 1 and Distance(Master,Slave) ~=-1 do
MovePrice = CalcHeroMoveCost(Slave,GetObjectPosition(Master));
ChangeHeroStat(Slave,STAT_MOVE_POINTS,-2500);
ChangeHeroStat(Slave,STAT_MOVE_POINTS,MovePrice-300);
MoveHeroRealTime(Slave,GetObjectPosition(Master));
sleep(5);
end;
end;
end;

startThread(FollowHeroRealTime, OUR_HERO_FREYDA, OUR_HERO_LASZLO, FOLLOWING_RADIUS);
Карты: Экспедиция ГрувераНаследие ШантириВременной парадоксПоиски рунной сферыПуть возвращения
In reply to AstralLein
User Avatar
#2810
Auto-translated
AstralLein
A very complex question. How do I remove a two-cell rock with a scripted name "Rock" from the map using a script? RemoveObject cheerfully throws an error...
You need to set "IsRemovable" to True in the rock's settings in the settings tree.

Added 9 minutes later
AstralLein
A very complex question. How do I remove a two-cell rock with a scripted name "Rock" from the map using a script? RemoveObject cheerfully throws an error...
If you remember, there was a script on my map in the mine where the rock was removed from the way.
...И справедливость я несу
На острие меча.


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



О кампании

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



Statistics

Welcome our newest member: dodoD0D0