Auto-translated
Rhenish, here's a version with partial conversion. Breaking it down into units is good, but firstly, it's not entirely obvious to players, and secondly, it's not obvious to me. I'm not sure I can write a script to find slots in the army. But here, you can convert vampires in parts and immediately convert the maximum number. I haven't checked the script (!), I don't have the opportunity, but it seems to be working fine...
function OurTalkBox()
TalkBoxForPlayers( PLAYERFLT_1, nil,nil,'path to the test file with the description of Vyacheslav's ability and the question of how many creatures to convert','path to an additional text file, I don't know what it's for, play around with it', 'callbackvamps', 1, 'path to the text of the window title','path to the text of the title before the buttons, I also don't know what it's for, if it's not needed, set it to nil', 0, 'path to the first answer, I recommend putting one creature there','path to the second answer, in this case, 5 creatures','here, for example, 15 creatures','here, for example, 50','the largest number of creatures that can be converted with the given number of vampire princes and the given number of resources for the player' );
end;
function callbackvamp(nom)
if nom==1 then
if (((GetPlayerResource(1, GOLD)>=700) and (GetPlayerResource(1, MERCURY)>=1)) and (GetHeroCreatures('Visas', 155)>=1)) then
RemoveHeroCreatures('Visas',155,1);
AddHeroCreatures('Visas',89,1);
else
MessageBox('path to the file where it will be written that there are not enough resources');
end;
elseif nom==2 then
if (((GetPlayerResource(1, GOLD)>=3500) and (GetPlayerResource(1, MERCURY)>=5)) and (GetHeroCreatures('Visas', 155)>=5)) then
RemoveHeroCreatures('Visas',155,5);
AddHeroCreatures('Visas',89,5);
elseif ((GetPlayerResource(1, GOLD)<3500) or (GetPlayerResource(1, MERCURY)<5)) then
MessageBox('path to the file where it will be written that there are not enough resources');
elseif (GetHeroCreatures('Visas', 155)<5)
MessageBox('path to the file where it will be written that there are not enough vampires');
end;
elseif nom==3 then
if (((GetPlayerResource(1, GOLD)>=10500) and (GetPlayerResource(1, MERCURY)>=15)) and (GetHeroCreatures('Visas', 155)>=15)) then
RemoveHeroCreatures('Visas',155,15);
AddHeroCreatures('Visas',89,15);
elseif ((GetPlayerResource(1, GOLD)<10500) or (GetPlayerResource(1, MERCURY)<15)) then
MessageBox('path to the file where it will be written that there are not enough resources');
elseif (GetHeroCreatures('Visas', 155)<15)
MessageBox('path to the file where it will be written that there are not enough vampires');
end;
elseif nom==4 then
if (((GetPlayerResource(1, GOLD)>=35000) and (GetPlayerResource(1, MERCURY)>=50)) and (GetHeroCreatures('Visas', 155)>=50)) then
RemoveHeroCreatures('Visas',155,50);
AddHeroCreatures('Visas',89,50);
elseif ((GetPlayerResource(1, GOLD)<35000) or (GetPlayerResource(1, MERCURY)<50)) then
MessageBox('path to the file where it will be written that there are not enough resources');
elseif (GetHeroCreatures('Visas', 155)<50)
MessageBox('path to the file where it will be written that there are not enough vampires');
end;
elseif nom==5 then
max=GetPlayerResource(1, GOLD)/700 - mod(GetPlayerResource(1, GOLD),700)/700;
if max>GetPlayerResource(1, MERCURY) then
max=GetPlayerResource(1, MERCURY);
end;
if max>GetHeroCreatures('Visas', 155) then
max=GetHeroCreatures('Visas', 155);
end;
if max>0 then
RemoveHeroCreatures('Visas',155,max);
AddHeroCreatures('Visas',89,max);
else
MessageBox('path to the file where you will write that the player cannot convert any creatures');
end;
end;
if (GetHeroCreatures('Visas', 155)>0) then
QuestionBox('path to the text file where you will ask if the player wants to continue converting the remaining vampire princes', 'OurTalkBox', nil);
end;
end;
function vamps(hero)
if (hero=='Visas' and GetHeroCreatures('Visas', 155)>0 and GetDate(DAY_OF_WEEK)==1) then -- checking if all conditions are met
OurTalkBox;
end;
sleep(1); -- this and the following line are not needed if you don't include the line with the comment below.
MakeHeroInteractWithObject('hero','city_name');
end;
SetObjectEnabled('city_name',nil); -- it's problematic to add this line. Let's just say, it's better not to, I don't know what glitches it will cause. It's needed so that entering the city doesn't precede the appearance of the conversion window, but you can convert after visiting the city, right?
Trigger(OBJECT_TOUCH_TRIGGER,'city_name','vamps');