Мои сценарии:
Лесной хранитель (лесной союз)
Путь к свету (чернокнижник)
Фалькон Сокол (орден порядка)
Инквизиция Ариоха (некроманты) - готово на 90%
New here? I'm Roha — want a quick tour?
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?
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 = RandomCircleSpawnCoordsIs 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.)
I don't want to seem annoying, but there's another problem with the script:I copied the code into the console, adding "@" at the beginning, and it executed – meaning it at least printed the difficulty level.
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.
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.
Hello, dear mapmakers. Can you provide a script that removes a creature from the map?
RemoveObject("scripted monster name");
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.