Posts from Scripts
Which function is used to change the name and description of an object?
Also, can you tell me how to fix the error: Value was NIL when getting global with name 'ChangeResource'?function give_sulfur()
ChangeResource(4, 5, 'Biara')
Trigger(OBJECT_TOUCH_TRIGGER, 'kotel', nil);
end
2) There is no such function as ChangeResource; check the manual for functions that modify resources.
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога
Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
1) OverrideObjectTooltipNameAndDescription(object, path_to_name_text, path_to_description_text)
2) There is no such function as ChangeResource; refer to the manual to see which functions change resources.
2) Interestingly, the function "ChangeResource" is described in the file with function descriptions, which I downloaded from heroesworld.
while GetObjectiveState('meet_demons', PLAYER_1) == OBJECTIVE_ACTIVE do
sleep(5)
end
SetObjectiveState('hero_from_hell', OBJECTIVE_ACTIVE, PLAYER_1);
MessageBox(GetMapDataPath()..'5.txt');
while 1 do
if GetObjectiveState('kill_daeva', PLAYER_1)== OBJECTIVE_COMPLETED
and
GetObjectiveState('capture_mines', PLAYER_1) == OBJECTIVE_COMLETED
then
sleep(5)
SetObjectiveState('hero_from_hell',OBJECTIVE_COMPLETED, PLAYER_1)
SetObjectiveState('go_throw_dungeon',OBJECTIVE_ACTIVE, PLAYER_1)
end
end
After completing the "meet_demons" quest and closing the "5" message, the game freezes. What did I do wrong?
an infinite loop
{
condition check.
}`. You need to add a sleep function to the loop. Also, it would be better if it runs in a separate thread (it is not clear from the code whether it is wrapped in a thread or not).
MessageBox(GetMapDataPath()..'1.txt');
MessageBox(GetMapDataPath()..'2.txt');
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'Svetlana_Vyacheslav1', 'talk1');
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'demons', 'talk2');
function talk1 ()
MessageBox(GetMapDataPath()..'3.txt')
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'Svetlana_Vyacheslav1', nil);
end
function talk2 ()
MessageBox(GetMapDataPath()..'4.txt');
Trigger(REGION_ENTER_AND_STOP_TRIGGER, 'demons', nil);
end
function task1()
while GetObjectiveState('meet_demons', PLAYER_1) == OBJECTIVE_ACTIVE do
sleep(5)
end
SetObjectiveState('hero_from_hell', OBJECTIVE_ACTIVE, PLAYER_1);
MessageBox(GetMapDataPath()..'5.txt');
end;
function task2()
while 1 do
if GetObjectiveState('kill_daeva', PLAYER_1)== OBJECTIVE_COMPLETED
and
GetObjectiveState('capture_mines', PLAYER_1) == OBJECTIVE_COMLETED
then
sleep(5)
SetObjectiveState('hero_from_hell',OBJECTIVE_COMPLETED, PLAYER_1)
SetObjectiveState('go_throw_dungeon',OBJECTIVE_ACTIVE, PLAYER_1)
end
end
end;
startThread(task1);
startThread(task2) ;
Added 14 minutes ago
And yes, I didn't quite understand where exactly I need to put the `sleep` and what value should be in the parentheses. :smile35:
They will be able to.
It will be. They will be able to.
Added 2 minutes later
By the way, how do you scroll up and down in the console?