Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to KioM
User Avatar
14 years ago
Auto-translated
KioM
Hello everyone, can anyone help me understand the command:
CreateStatic
Example from the description:
CreateStatic(scriptName, DataFile, x, y, floorId, rotation, terrainAligned, scalePercent);

All parameters are clear except for DataFile
I somehow assumed that the path to the extracted object should be specified, but there seems to be something else (I need the name, but I don't understand what kind of name it is...)
A pointer to the object type in the resource base. Could it be the path to Shared?
User Avatar
14 years ago
Auto-translated
that's exactly what I was pointing out; the problem might also be that the object I need is of the type "Building" in the original, and not "Static"... :(

Added after 34 minutes
In short, I figured it out; I should have paid attention to the object type right away; the whole problem was in that. I recreated the object with the "Static" type, and now it works ;) (and I was foolishly starting to think that the command wasn't working).
In reply to KioM
User Avatar
14 years ago
Auto-translated
Is there a command to unlock a region? Yes, and also regarding IsObjectExist ('monster name'). How can it be used, for example, to display a message if the monster is defeated?
User Avatar
14 years ago
Auto-translated
Force it into an infinite loop, and if the result is negative, display a message and exit the loop (so that resources aren't wasted).
In reply to Ment
User Avatar
14 years ago
Auto-translated
Ment
Force it into an infinite loop, and if the result is negative, display a message and exit the loop (to avoid wasting resources).
Yes, that's true, but how do you write the condition for a negative result? ... == nil then?
User Avatar
14 years ago
Auto-translated
I'm not sure if it returns nil or false; it's more likely the latter. Here's a version that will definitely work: `~=true then`
In reply to Ment
User Avatar
14 years ago
Auto-translated
Ment
I don't know if it returns nil or false, but it's more likely the latter. This option will definitely work:
~=true then
Thanks. So, regarding the first question: how do you unlock a region?
User Avatar
14 years ago
Auto-translated
SetRegionBlocked(region name, preserving case, nil);
User Avatar
14 years ago
Auto-translated
Does anyone know why the game developers forgot to declare global constants for the factions in the game?)))

RACE_HEAVEN, RACE_PRESERVE, etc., are not declared; that is, the numbers representing the constants are missing. Or do I need to include a separate file with the script? I haven't found where these factions are declared...

================
Another question of this nature: if I give a player three cities at the start, but when loading the map and scripts, I take away two castles, is there any way to close the fog of war for these two cities?), because in practice, the rights to both cities have passed to another player, but the cities remain visible to the first player.
User Avatar
14 years ago
Auto-translated
Well, they didn't announce it, so it's fine. Just call them by their number. I think they will be the same as the city types:
TOWN_HEAVEN = 0
TOWN_PRESERVE = 1; -- Sylvan
TOWN_ACADEMY = 2
TOWN_DUNGEON = 3
TOWN_NECROMANCY = 4
TOWN_INFERNO = 5
TOWN_FORTRESS = 6
TOWN_STRONGHOLD = 7
Regarding the fog, I already said that I have never encountered such a function in my life.
User Avatar
14 years ago
Auto-translated
yes, they are the same, I already checked. I'm just curious what numbers they should have: RACE_SPECIAL, RACE_RANDOM_TYPE, RACE_NO_TYPE... it's a pity about the fog (as an example of insufficient functionality of the Heroes script library :() and if you try to disable the automatic opening of the fog of war, take away the cities, and then turn it back on?) or is it unlikely... when loading, will the cities belonging to the player automatically reveal their fog of war zone?
User Avatar
14 years ago
Auto-translated
I don't know for sure. I think it will be released, though.
User Avatar
14 years ago
Auto-translated
Dear Ment, have you had a chance to look more closely at the AllowHeroHiringByRaceInTown() command? It seems to be working strangely. I want to set it up so that, for example, in two towns (a human town and an elven town), heroes can only be hired based on the town's race. I'm writing:
AllowHeroHiringByRaceInTown('humanTown', TOWN_HEAVEN, 1);
AllowHeroHiringByRaceInTown('elvenTown', TOWN_PRESERVE, 1);
and I'm also using a loop to prevent the hiring of heroes of other races in these towns. As a result, in the first town where the player starts (e.g., the human town), heroes of the human race can be hired, and everything is normal, but in the second town, there are no heroes at all. I'm not sure what the problem is.
User Avatar
14 years ago
Auto-translated
I haven't encountered that. It seems like there might be an issue with the loop. Could you please check it or provide the code?
User Avatar
14 years ago
Auto-translated
blockedTavern = {TOWN_ACADEMY, TOWN_HEAVEN, TOWN_PRESERVE, TOWN_FORTRESS, TOWN_NECROMANCY, TOWN_INFERNO, TOWN_STRONGHOLD, TOWN_DUNGEON};
blockedTavern.n = length(blockedTavern);
allTown = {'AcademyTown', 'HeavenTown', 'SylvanTown', 'DwarvenTown', 'NecropolisTown', 'InfernoTown', 'HordeTown', 'DungeonTown'};
for i = 1, blockedTavern.n do
for j = 1, length(allTown) do
AllowHeroHiringByRaceInTown(allTown[j], blockedTavern, 0);
end;
end;
AllowHeroHiringByRaceInTown('AcademyTown', TOWN_ACADEMY, 1);
AllowHeroHiringByRaceInTown('HeavenTown', TOWN_HEAVEN, 1);
AllowHeroHiringByRaceInTown('SylvanTown', TOWN_PRESERVE, 1);
AllowHeroHiringByRaceInTown('DwarvenTown', TOWN_FORTRESS, 1);
AllowHeroHiringByRaceInTown('NecropolisTown', TOWN_NECROMANCY, 1);
AllowHeroHiringByRaceInTown('InfernoTown', TOWN_INFERNO, 1);
AllowHeroHiringByRaceInTown('HordeTown', TOWN_STRONGHOLD, 1);
AllowHeroHiringByRaceInTown('DungeonTown', TOWN_DUNGEON, 1);

That is, I first prohibit hiring any heroes in all cities, and then allow hiring heroes of that city's race in each city separately. Most likely, the loop is not correct; I think it is wrong to prohibit hiring all heroes. Perhaps there is a way to select individual values from the blockedTavern list for each case?

Statistics

Welcome our newest member: recijeb