Skip to content

Posts from Current questions and answers regarding the map editor.

5.0 (12 ratings)
User Avatar
15 years ago
Auto-translated

function Plus()
res=GetPlayerResource(1,6);
if (res>[amount of money needed to hire]) then
AddObjectCreatures([script name of the town],[creature ID],[number of creatures]);
SetPlayerResource(1,6,res-[amount of money needed to hire]);
end else
MessageBox(GetMapDataPath()..[file name where it is written that there is not enough money, with extension and in quotes]);
end;
end;
Trigger(NEW_DAY_TRIGGER,"Plus");
It should work.
User Avatar
15 years ago
Auto-translated
Thank you very much, I just started learning about scripts.
In reply to Ment
15 years ago
Auto-translated
Ment
I'll answer the second question right away: this mod will help. http://all4heroes.net/node/435
The first one is a bit more complicated. You can do it like this: ChangeHeroStat([hero name],7,10). This gives the hero 10 movement points (I'm not sure how much that is, to be honest). And to give everyone 15% permanently... You can use a tricky loop that iterates through all the heroes. But I'll think about it and get back to you.
So, you can't use brains, which is a shame:( A mod on such a small map probably won't help much, although it does help prevent them from running away, if I understand correctly? That's good, because sometimes they run away without a fight. As for the first question (you need to reduce it), if you can, please answer a little more precisely where and how to enter it. And also, do the names need to be in English?
In reply to нонстоп
User Avatar
15 years ago
Auto-translated
nonstop
So, you can't reduce intelligence, which is a shame:( A mod for such a small map probably won't help, although it does help prevent fleeing, if I understand correctly? That's good, because sometimes they run away without a fight. And regarding the first question (need to reduce), if you can, please answer a little more precisely, where and how to enter the values. And also, do the names need to be in English?
Done.
h={'Ving','Straker','','','','','','','','','','','','','','','','','','','',''}--for 20 heroes on the map (and two starting ones), if you need to allow more, you need to add more
--write ,''. If there are more starting heroes, you need to add them at the beginning.
hq=0;
i=0;
nh=0;
k=-800;--the turn will be reduced by 800 points
function NewHero(hero)
hq=hq+1;
h[hq]=hero;
ChangeHeroStat(hero,7,k);
end;
function NewDay()
i=1;
while i<=hq do
ChangeHeroStat(h,7,k);
i=i+1;
end;
end;
function MinusHero(hero)
while (i<=hq) do
if(h==hero) then
while(i
h=h[i+1];
end;
i=hq;
end;
i=i+1;
end;
hq=hq-1;
end;
ChangeHeroStat(h[1],7,k);
ChangeHeroStat(h[2],7,k);
hq=2;--if there are 2 heroes on the map at the beginning, otherwise, you need the same functions and hq=3
Trigger(PLAYER_ADD_HERO_TRIGGER,1,'NewHero');--if player 1 hires a hero
Trigger(PLAYER_ADD_HERO_TRIGGER,2,'NewHero');--for player 2. If there is player 3, then the same function is needed for him, but replace 2 with 3
Trigger(NEW_DAY_TRIGGER,'NewDay');
Trigger(PLAYER_REMOVE_HERO_TRIGGER,1,'MinusHero');--one of player 1's heroes is defeated
Trigger(PLAYER_REMOVE_HERO_TRIGGER,2,'MinusHero');
This is how it works for me. But this is not a 15% reduction, but a reduction of 800 points (set by the parameter k). And it should work for all other parameters.

Added 1 minute ago
The names should be in English, yes.
15 years ago
Auto-translated
Ment, thanks, but I still don't understand. I went to the map properties, clicked on scripts, copied everything, and pasted it there (without any Russian letters, of course). The only thing I added was: `
ChangeHeroStat(h[1],7,k);
ChangeHeroStat(h[2],7,k);` Here, I also added the same thing, but with (h[3],7,k); and (h[4],7,k);. I have 4 players, and if I understand correctly, this also needs to be done, right? `
hq=2;` I changed it to `hq=4;` because there are four players with starting heroes. And I also added the following to `Trigger(PLAYER_REMOVE_HERO_TRIGGER,1,'MinusHero');` and `Trigger(PLAYER_REMOVE_HERO_TRIGGER,2,'MinusHero');`: `
Trigger(PLAYER_REMOVE_HERO_TRIGGER,3,'MinusHero');
Trigger(PLAYER_REMOVE_HERO_TRIGGER,4,'MinusHero');` (I didn't touch anything else). But there's no result; I've already tried increasing the value, but it doesn't work. Today, I figured out how to click the "check" button, and it gives me the following errors: `
Function NewHero not defined, line 6
Function newDay not defined, line 11
Function MinusHero not defined, line 18
Function nh not defined, line 4` Either I'm pasting it in the wrong place, or I don't understand anything at all.
User Avatar
15 years ago
Auto-translated
I'm trying to create animations for creatures, but it's not working! I'm writing the following:
1. Script - Name
2. Script PlayObjectAnimation("soldat1", "attack01", IDLE);
3. But it still doesn't attack.
4. What should I do?
In reply to нонстоп
User Avatar
15 years ago
Auto-translated
нонстоп
Ment...Either I'm entering it in the wrong place or I don't understand anything:(
Did you fix the hero names in the array? These errors are quite normal, but the last one confuses me a bit because nh-- is not a function, but a variable. And minus 800 points should be fine; when I set minus 3000 for heroes, they completely stop taking turns.
EfReeZe
I'm trying to create animations for creatures here, but it doesn't work! I write everything:
1. Script-Name
2. Script PlayObjectAnimation("soldat1", "attack01", IDLE);
3. But it still doesn't attack
4. What should I do?
1. Are you entering the name in the Map Properties Tree?
2. Not all creatures have an "attck01" animation, but the "attack00" animation usually exists. Even that isn't available for units of the Forest Pact, but this mod fixes it.
In reply to Ment
15 years ago
Auto-translated
Ment
Did you fix the hero names in the array?

Oops, could you please provide more details, if possible, as I don't understand any of this.
Is everything else I did correct?
User Avatar
15 years ago
Auto-translated
In line 1 of the code, we initialize the variable h. At the beginning, it contains the names of the heroes; I have my own names there, as you can see. But you should have different names, and there should be 4 of them. Do you know how to find them?

Added 1 minute later
nonstop
Is everything else correct?
Seems like it.
15 years ago
Auto-translated
No, I don't know, and how does it work? Does this mean I just copied the quotation marks and spaces instead of entering the names? Haha. So, if I enter all the heroes there, will they all have -800?
User Avatar
15 years ago
Auto-translated
In theory, yes. We take a hero, click on "object properties," go to the "settings" tab, and in the "script name" field, we find its script name. That's what we need.
15 years ago
Auto-translated
Thank you, I'll give it a try. Ment, it just doesn't work at all. I'm attaching a text document; please take a look and tell me what's wrong. I think I followed all the instructions.
Attachments 1
1 file attached • Total size: 1.1 KB
User Avatar
15 years ago
Auto-translated
1. Are you entering the name in the Map Properties Tree?
2. Not all creatures have the "attck01" animation, but the "attack00" animation is usually present. Even if the latter is missing for Sylvan units, this mod fixes it.

Yes, yes, it's exactly as you said, changing the attack animation didn't help either.
In reply to нонстоп
User Avatar
15 years ago
Auto-translated
нонстоп
Ment, well, basically, it just doesn't work:( I'm attaching a text document, please take a look and see what's wrong. I think I followed all the instructions:(
How many starting heroes do you have? 16? Then you need 16 lines, but it would be easier to loop it. Otherwise, I looked at it, and it seems like some kind of error occurred during copying (when I was copying the code).
Try this code (at the end of the message).
EfReeZe
Yes, yes, it's exactly like that, changing the attack also didn't help.
Another problem might be with the case, it's important that the unit name exactly matches what you have written in the script.
Attachments 1
1 file attached • Total size: 1.1 KB
In reply to Ment
15 years ago
Auto-translated
Ment
How many starting heroes do you have? 16? Then you need 16 lines, but it will be easier to loop. Otherwise, I looked, and it seems that some kind of nonsense happened during copying (when I copied the code).
Try this code.
Can we switch to "you" instead of "you" (formal)? It feels a bit awkward. I understand that I wasn't quite getting it. So, the idea is to include the 4 heroes that start near the cities? And the rest are just commas: ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', ',', '', and it should work, right? Is that correct? I just listed all the heroes that I allowed on this map, which was wrong. Is that right? And one more question, can dungeons affect the operation of this loop? 16 allowed (including the starting ones) + 4 in dungeons.

Statistics

Welcome our newest member: recijeb