Auto-translated
Help, kind people, if there's anyone alive here!
Please help me write a simple script. I don't know why, but none of the options work.
But please don't tell me to "read the manual," I've read it many times, and one of the options is actually from there.
It's a simple action: when the hero touches an object (or, even better, enters a specific zone, but for now, even the object doesn't work), he should teleport to a specific point.
The following scripts don't work:
function PobegF (heroname)
SetObjectPosition((heroname), 88, 102, floor -1);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF");
It says, "attempt to perform arithmetic on a function value."
------
function PobegF (heroname)
SetObjectPosition(heroname, 88, 102, floor -1);
end;
Trigger(4, "Proba", "PobegF");
It says the same thing.
------
function PobegF ()
SetObjectPosition("Raelag", 88, 102, floor -1);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF");
The same thing happens.
------
function PobegF ()
SetObjectPosition("Raelag", 88, 102, floor);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF");
It says, "Wrong type of argument 4, when calling function SetObjectPosition."
------
function PobegF ()
SetObjectPosition("Raelag", destination_151, 138, floor -1);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF");
It says, "attempt to perform arithmetic on a function value."
------
function PobegF ()
SetObjectPosition("Raelag", destination_151, 138, floor);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF");
It says, "Wrong type of argument 4, when calling function SetObjectPosition."
What's going on?
I don't think you declared the 'floor' variable anywhere, so the question is: why are you using it when calling the SetObjectPos functions? Instead, you should write 0 (surface) or 1 (underground), for example, SetObjectPosition("Raelag", 182, 71, 0). Let me explain where the error comes from. 'floor' is a built-in function for rounding up. There is no comma before "-1," so the game tries to subtract 1 from 'floor.' But 'floor' is a function! And you can't subtract numbers from functions yet. That's why the error appeared

Also, the line 'destination_151' is strange; again, did you declare a variable with that name? Unlikely. If you wanted to specify a coordinate, just leave it as 151.
The final version of the script:
function PobegF (heroname)
SetObjectPosition(heroname, 88, 102, 0, -1);
end;
Trigger(OBJECT_TOUCH_TRIGGER, "Proba", "PobegF")
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________