Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to Азгалор
User Avatar
Auto-translated
Thank you so much (I was only able to check it today).
С уважением, ваша Дарина)
Мои сценарии:  
Лесной хранитель (лесной союз)
Путь к свету (чернокнижник)
Фалькон Сокол (орден порядка)
Инквизиция Ариоха (некроманты) - готово на 90%
User Avatar
Auto-translated

function RandomCircleSpawnCoords(x,y,r,fl)
  if x and y and r then
    if not fl then
      flooor = GROUND
    end
    local t = {}
    local n = 1
    x = x-r
    y = y-r
    r = r+r
    for i = x, r do
      print(i)
      for j = y, r do
        print(j)
        if (i - x)*(i - x) + (j - y)*(j - y) <= r*r then
          t[n] = {x1, y1, flooor}
          n = n + 1
        end
      end
    end
    print('Array: ', t)
    print('Length: ', length(t))
    local c = t[random(length(t))+1]
    return c[1], c[2], c[3]
  end
end

RCSC = RandomCircleSpawnCoords

The array 't' is not being populated, and the loops for 'i' and 'j' are not running at all. What could be the problem?

С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4

function RandomCircleSpawnCoords(x,y,r,fl)
  if x and y and r then
    if not fl then
      flooor = GROUND
    end
    local t = {}
    local n = 1
    x = x-r
    y = y-r
    r = r+r
    for i = x, r do
      print(i)
      for j = y, r do
        print(j)
        if (i - x)*(i - x) + (j - y)*(j - y) <= r*r then
          t[n] = {x1, y1, flooor}
          n = n + 1
        end
      end
    end
    print('Array: ', t)
    print('Length: ', length(t))
    local c = t[random(length(t))+1]
    return c[1], c[2], c[3]
  end
end

RCSC = RandomCircleSpawnCoords

The array 't' is not being populated, and the loops for 'i' and 'j' are not running at all. What could be the problem?

RCSC = RandomCircleSpawnCoords
Is that line written exactly like that, or did you copy it incompletely? If it's written that way, then it's obvious why it's not working.)
Нет войне.
User Avatar
Auto-translated
Yes, that's exactly what it says. I created an alias for the function; I call RCSC(14,14,2), for example.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
I have resolved the issue.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
I don't want to sound annoying, but there's another problem with the script: ``` function Diff_setup() slozhnost = GetDifficulty(); if slozhnost == DIFFICULTY_EASY then print("easy"); startThread(sloz_easy); elseif slozhnost == DIFFICULTY_NORMAL then print("norm"); startThread(sloz_norm); elseif slozhnost == DIFFICULTY_HARD then print("hard"); startThread(sloz_hard); elseif slozhnost == DIFFICULTY_HEROIC then print("hero"); startThread(sloz_hero); end; end; function sloz_easy() if (GetDate( DAY ) == 31) then SetRegionBlocked("blok", nil, 4); end; end; function sloz_norm() if (GetDate( DAY ) == 28) then SetRegionBlocked("blok", nil, 4); end; end; function sloz_hard() if (GetDate( DAY ) == 14) then SetRegionBlocked("blok", nil, 4); end; end; function sloz_hero() if (GetDate( DAY ) == 12) then SetRegionBlocked("blok", nil, 4); end; end; startThread(Diff_setup); ``` The console throws an error
Attachments 1
1 file attached • Total size: 14.6 KB
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

In reply to Andrei_21
User Avatar
Auto-translated
Andrei_21
I don't want to seem annoying, but there's another problem with the script:

function Diff_setup()
slozhnost = GetDifficulty();
if slozhnost == DIFFICULTY_EASY  then
print("easy");
startThread(sloz_easy);
elseif slozhnost == DIFFICULTY_NORMAL then
print("norm");
startThread(sloz_norm);
elseif slozhnost == DIFFICULTY_HARD then
print("hard");
startThread(sloz_hard);
elseif slozhnost == DIFFICULTY_HEROIC then
print("hero");
startThread(sloz_hero);
end;
end;

function sloz_easy()
if (GetDate( DAY ) == 31) then
SetRegionBlocked("blok", nil, 4);
end;
end;

function sloz_norm()
if (GetDate( DAY ) == 28) then
SetRegionBlocked("blok", nil, 4);
end;
end;

function sloz_hard()
if (GetDate( DAY ) == 14) then
SetRegionBlocked("blok", nil, 4);
end;
end;

function sloz_hero()
if (GetDate( DAY ) == 12) then
SetRegionBlocked("blok", nil, 4);
end;
end;

startThread(Diff_setup);

The console throws an error.

I copied the code into the console, adding "@" at the beginning, and it executed – meaning it at least printed the difficulty level.
If this isn't the entire code, then the error is probably in something else.
By the way, the code probably doesn't work the way you expect it to.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Okay. I don't rule out the possibility that I made a mistake somewhere earlier. Thank you for your help, RedHeavenHero.
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

User Avatar
Auto-translated
Author
By the way, the code probably doesn't work the way you expect it to.
Yeah, that's right. The code runs once on the first day, returns false for the date checks, and then ends. Unless there's something else in there.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
Yeah, that's right. The code runs once on the first day, returns false for the date checks, and then ends. Unless there's something else in there.

I suspected that this would happen. Oh well, I'll redo it differently.
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

User Avatar
Auto-translated
RedHeavenHero, could you please provide some insight on this? If I rewrite the Errormessage function like this:
errmsg = _ERRORMESSAGE
function _ERRORMESSAGE(msg)
errmsg(msg)
end

And then call MessageBox('') in the console, instead of the usual error "Empty message text!", the game crashes. A long time ago, you helped Durnam hide the error "attempt to call a nil value"; I want to use a similar method to catch the error of a missing text file, i.e., to determine if it exists. I would be grateful for your help.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to }{0TT@6bI4
User Avatar
Auto-translated
Hello, dear mapmakers. Can you suggest a script that removes a creature from the map?
С уважением, ваша Дарина)
Мои сценарии:  
Лесной хранитель (лесной союз)
Путь к свету (чернокнижник)
Фалькон Сокол (орден порядка)
Инквизиция Ариоха (некроманты) - готово на 90%
In reply to Flame Crystal
User Avatar
Auto-translated
Flame Crystal
Hello, dear mapmakers. Can you provide a script that removes a creature from the map?

RemoveObject("script name of the monster");
Сценарий: "Наследие прошлого"
Кампании:
"
Новый порядок", "Серый Альянс""Поиски Истины"

Трейлер №2 кампании "Дыхание Пустоты": https://www.youtube.com/watch?v=XkHKXk5BctA&ab_channel=%D0%90ndrei_21

In reply to Andrei_21
User Avatar
Auto-translated
Andrei_21

RemoveObject("scripted monster name");
Thank you very much!
С уважением, ваша Дарина)
Мои сценарии:  
Лесной хранитель (лесной союз)
Путь к свету (чернокнижник)
Фалькон Сокол (орден порядка)
Инквизиция Ариоха (некроманты) - готово на 90%
In reply to }{0TT@6bI4
User Avatar
Auto-translated
}{0TT@6bI4
RedHeavenHero, could you please provide some insight? If I rewrite the Errormessage function like this:
errmsg = _ERRORMESSAGE
function _ERRORMESSAGE(msg)
errmsg(msg)
end

And then call MessageBox('') in the console, instead of the usual error "Empty message text!", the game crashes. A long time ago, you helped Dorman hide the error "attempt to call a nil value"; I want to catch the error of a missing text file using a similar method, i.e., determine if it exists. I would be grateful for your help.
For some reason, the game crashes when it tries to call _ERRORMESSAGE, which is not a built-in C function. That is, it can only be reassigned to another existing one, such as print or StopTrigger (the latter, despite its name, does nothing in my observation).
If you need to catch an error, use errorHook.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4

Statistics

Welcome our newest member: Emil