Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
Good evening, I tried to create a script that would remove a hero who interacts with a Dungeon (i.e., activates the Dungeon, receives the reward, and then the hero who activated the Dungeon should be removed). But, unfortunately, I couldn't make it work. If it's possible to do this, please help me.
In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910
Good evening, I tried to create a script that would remove a hero who interacts with the Dungeon (i.e., activates the Dungeon, receives the reward, and the hero who activated the Dungeon should be removed). But, unfortunately, I couldn't make it work. If it's possible to do this, please help.
Show the function(s) that handle these actions.
User Avatar
Auto-translated
function PrisonTouch(hero) Trigger(OBJECT_TOUCH_TRIGGER, "Prison", nil) startThread(function(hero) pl = GetObjectOwner(hero) while not (length(GetPlayerHeroes(pl)) > 1) do sleep() end RemoveObject(hero) end, hero) end Trigger(OBJECT_TOUCH_TRIGGER, "Prison", "PrisonTouch") ``` As an alternative, the function initiates a check that waits until the player-owner has more than one hero (to prevent the removal from leading to a defeat), and then removes the hero.
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Auto-translated

As an alternative, the function initiates a check that waits until the owning player has more than one hero (to prevent deletion from resulting in a loss), and then deletes the hero.

Excellent, thank you.

User Avatar
Auto-translated

Hi! So, I wrote a function, added a notification using print, and to avoid the eyesore of the green font, I decided to change its color. Therefore, here's the code:

function AllowHero(PLAYER, Hero)
print("Hero ", Hero, " is not on the map. The function to add him to the map is working")

That is, in the game, the console should display yellow text with an orange hero name, but for some reason, Hero is displayed in an eye-hurting green color. How can I fix this issue? And also, is it possible to change the console font color from green to another color? Because green is very uncomfortable for me.

User Avatar
Auto-translated
Generally, you are right, it works in prints with , but try concatenating the hero's name instead of specifying it next. Among the colors that are definitely available by "name" are black, blue, neutral, negative, positive, and so on, just like in MlTags. And if you add \n before the string, the entire print will be white. Changing the default color in the console – I think it might be possible through workarounds, if, again, you can find the color tag color_positive in the game files and specify a different color inside it, for example, #FFFFFF (white).
С уважением, }{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
try concatenating the hero's name instead of specifying it separately

I don't quite understand what you mean; I would appreciate it if you could show me an example).



Added 2 minutes later
}{0TT@6bI4
From the colors that are definitely available based on "names" – black, blue, neutral, negative, positive, and so on, as in MlTags. And if you add \n before the string, the entire print will be white.

Changing the default color in the console – I think it might be possible through some workarounds, if, again, you can find the color tag color_positive in the game files and specify a different color inside, for example, #FFFFFF (white)...

Regarding colors: In general, I first saw this feature on the "Veil of Darkness" map by RedHeavenHero, which led me to conclude that his maps are interesting not only for their plot and landscape design but also for the interesting "behind-the-scenes" aspects.

Regarding the console color: Hmm, thank you... I need to try and see, but it seems to me that this is embedded somewhere in the game's resources, which cannot be accessed without dissecting the engine.

User Avatar
Auto-translated
..Hero

I'll test the xdb with tags right now. If it doesn't work, it seems that only the exe file will work frown
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
..Hero

I'll test the xdb with tags right now. If it doesn't work, it seems that only the exe file will work frown
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
Auto-translated
}{0TT@6bI4, thank you! Now everything works correctly 😎
Auto-translated
function PrisonTouch(hero) Trigger(OBJECT_TOUCH_TRIGGER, "Prison", nil) startThread(function(hero) pl = GetObjectOwner(hero) while not (length(GetPlayerHeroes(pl)) > 1) do sleep() end RemoveObject(hero) end, hero) end Trigger(OBJECT_TOUCH_TRIGGER, "Prison", "PrisonTouch") ```

I tried this script, but unfortunately, the hero is not removed. Nothing happens.

In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910
function PrisonTouch(hero)
Trigger(OBJECT_TOUCH_TRIGGER, "Prison", nil)
startThread(function(hero) pl=GetObjectOwner(hero); while not (length(GetPlayerHeroes(pl))>1) do sleep() end; RemoveObject(hero) end, hero)
end

Trigger(OBJECT_TOUCH_TRIGGER, "Prison", "PrisonTouch")

I tried this script, but unfortunately, the hero is not removed.
Nothing happens.

Does the console report any errors? Does the Dungeon have the script name "Prison"?
Auto-translated
Does the console report any errors? Does the Dungeon have the scripted name "Prison"?
Yes, the console doesn't show any problems. Yes, I gave the dungeon the name "Prison". But if you use the editor's console, it doesn't understand why "Length" is needed.
User Avatar
Auto-translated
Good evening (day/morning) to everyone. Does anyone know how script data is saved when a map is saved? For example, I want to store some player-specific data so that it is saved when the map is reloaded. I understand that mapscript.lua is executed when the map is loaded. Is there a way to store data globally? Perhaps GameVars? (The manual has a vague description of them, and I couldn't find a good example in other maps). P.S. In MasteR's wonderful scenario, Twilight of Darkness, I saw an implementation using quest progress, but I still want a less "workaround" approach.
User Avatar
Auto-translated
Specifically, after a map restart? Only SetGameVar("variable name", value), GetGameVar("variable name").

I haven't heard about "Twilight of Darkness"; could you provide more details?
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________

Statistics

Welcome our newest member: Emil