Posts from Current questions and answers regarding the map editor.
Loads another map. As I understand it, you need to specify the correct map.xdb (or specify it somewhere and then indicate its number).
Apparently, it only works in single-player mode in version 3.1, but I haven't found any use for it in the developers' files.
WarpToMap(GetMapDataPath().."map.xdb#xpointer(/AdvMapDesc)", 1)And in the main menu, it says that it failed to load the map, etc.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , 'function name')
function function name ()
--This is where the check is triggered when any hero enters the region. Write whatever you want here. If you need to complete a quest:
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED)
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , nil)
endNow, this function will react to any contact with this region. The only thing is, the computer might also enter this region, and then the function will trigger for it. If you do it like this:
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , 'function name')
function function name ()
if GetCurrentPlayer() == 1 then
--This is where the check is triggered when any hero of the first player enters the region. Write whatever you want here. If you need to complete a quest:
SetObjectiveState ('objname' , OBJECTIVE_COMPLETED)
Trigger(REGION_ENTER_AND_STOP_TRIGGER , 'trigger name' , nil)
end
endThen the function will work for any hero of the first player - by default, a human.
function proverka()
while 1 do
sleep(1)
if GetHeroCreatures ('heroname' , creature_id) < 1 then
--what happens if the number of creatures in the hero's army is less than 1
break -- if you need to disable the check later
end
end
end
startThread(proverka)
sleep(1) -- a small pause for checking; if you remove it, the check will be continuous, and the game will crash. But with it, there's a very small, imperceptible pause between checks for the player.
if -- an argument for the check. In this case, while starts the check, sleep prevents the game from being overloaded; it itself is ignored, and only what is written in if and далее is checked.
startThread(funcname) -- starts this check-function right from the beginning of the game. You can write it at any time you need. The if check will start immediately, with an interval of sleep(1), and will continue until break.
function funcname ()
while 1 do
sleep(1)
if
--what you need to check continuously
break -- after it, the entire cycle stops working. It simply ends to avoid overloading the game.
end
end
end
startThread(funcname)Here is the code for checking something. In if and далее, you write what you need to check. In the parentheses of startThread, you specify (without quotes) the function that needs to be launched -- funcname.
Something like that. ;)