Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
#621
Auto-translated
Hmm. I think so. You can simply count them (excluding non-summonable units and those summonable units that died). But you definitely need to experiment. Because the game might calculate that all summonable creatures died at the end of the battle, and in this case, you would have to create special victory conditions to first count everything and then end the battle.
 

К А
Стикеры GBF в Telegram
#622
Auto-translated
In general, you can determine when one of the sides has no units left, then use BlockGame, count the summoned units, unblock the game, and end the battle.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
User Avatar
#623
Auto-translated
I think that in this case, the unit counting mechanism built into the game will handle its task faster, and the battle will end before the BlockGame command is executed.
 

К А
Стикеры GBF в Telegram
#624
Auto-translated
Well, I'll try to experiment. In general, how can I find out which UnitName is assigned to which creature? Best regards.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
User Avatar
#625
Auto-translated
Perhaps, call GetDefender(Attacker)Creatures and, for each element of the array, get the creature type?
 

К А
Стикеры GBF в Telegram
#626
Auto-translated
Let's try, thank you. Best regards.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
#627
Auto-translated
I have the following question. Let's say, according to the plot, the hero has to choose which path to take. If he takes a specific path, his army will decrease each day. This can be done using New_day_trigger. Let's assume that in this case, the variable h is assigned the value 1. Then:
Trigger(NEW_DAY_TRIGGER, "hello")
function hello()
if GetDate(DAY) == 2 and h==1 then
RemoveHeroCreatures(...);
elseif GetDate(DAY) == 3 and h==1 then
RemoveHeroCreatures(...);
and so on
end;
end;
but this way, you have to specify it for each day. Is there a way to reset the day count at a certain point so that you don't have to write so much?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
#628
Auto-translated
Oligarch
I have a question. Let's say, according to the plot, the hero has to choose which path to take. If he goes down a certain road, his army will decrease each day. This can be done using New_day_trigger. Let's assume that in this case, the variable h is assigned the value 1. Then
Trigger(NEW_DAY_TRIGGER, "hello")
function hello()
if GetDate(DAY) == 2 and h==1 then
RemoveHeroCreatures(...);
elseif GetDate(DAY) == 3 and h==1 then
RemoveHeroCreatures(...);
and so on
end;
end;
but this way you have to write it for each day. Is there a way to reset the day count at a certain point so that you don't have to write so much?
Well, if your variable h=1, then it will remove part of the army every day. And there's no need for these complicated things with determining the date. If you don't want this feature, just change the value of h to anything other than one.
In reply to JonnyP
User Avatar
#629
Auto-translated
JonnyP
well, if you have a variable h=1, then it will indeed remove a portion of the army every day. And there's no need for these complicated date calculations. If the feature becomes unnecessary, you can change the value of h to any number other than one.
:smile11: how could I not have figured that out myself?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
#630
Auto-translated
Yes, you change the value of a variable in a specific place, and that's it. Two region triggers without stopping the hero, changing the value + launching a new thread.
If my line of thinking is correct, then:
h = 0

function RemoveCreaturesStart()
h = 1
startThread(RemoveCreatureProgress)
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,'RC1', nil)
end;
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,'RC1','RemoveCreaturesStart')

function RemoveCreatureProgress()
while 1 do
if h == 1 then
RemoveObjectCreatures('Oddrema', CREATURE_CERBERI,28)
end;
sleep(1)
end;
end;

function RemoveCreatureStop()
if h == 1 then
h=2
else
if (h == 2) or (h == 0) then
h = 1
end;
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,'RC2',nil)
end;
Trigger(REGION_ENTER_WITHOUT_STOP_TRIGGER,'RC2','RemoveCreatureStop')
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
#631
Auto-translated
well, approximately. I generally think like this: attach a region
function regf()
h=1;
Trigger(trololo, nil);
end;
Trigger(trololo);

function hello()
if h==1 then
RemoveCreatures ("Oddrema", 20, 1);
end;
end;
Trigger (NEW_DAY_TRIGGER, "hello");
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
User Avatar
#632
Auto-translated
How do I set up a spawn so that only certain creatures appear at the beginning of the week, and preferably in a specific location?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
User Avatar
#633
Auto-translated
How to set up spawning only certain creatures at the beginning of the week? And, preferably, in a specific location?
Function
CreateMonster

--Example
function NewDay()
if GetDate(DAY_OF_WEEK) == 1 then
CreateMonster('mob1', CREATURE_PEASANT, 50, 45, 51, GROUND);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDay")
In reply to RedHeavenHero
User Avatar
#634
Auto-translated
RedHeavenHero
Function
CreateMonster

--Example
function NewDay()
if GetDate(DAY_OF_WEEK) == 1 then
CreateMonster('mob1', CREATURE_PEASANT, 50, 45, 51, GROUND);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDay")
Thank you. And how do I disable spawning on a new week? For example, Lich week has arrived, and nothing spawns?
Мои карты:
Town
Готовится:Чума (40%), Сосиска(42%), Война Грааля
In reply to Олегарх
User Avatar
#635
Auto-translated
Thank you. But how do I disable spawning on a new week then? For example, Lich week has arrived, and no monsters are spawning?

Then you'll have to do it like this:
function NewDay()
if GetDate(DAY_OF_WEEK) == 1 and GetCurrentMoonWeek() < 84 then
CreateMonster('mob1', CREATURE_PEASANT, 50, 45, 51, GROUND);
end;
end;
Trigger(NEW_DAY_TRIGGER, "NewDay")

Then, if a week of some creature happens, the monster won't be placed on the map.

Statistics

Welcome our newest member: Emil