Skip to content

Posts from Scripts Auto-translated

4.8 (8 ratings)
#3625
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
#3626
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
#3627
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"
_________________
#3628
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
#3629
Auto-translated

Hi! So, I wrote a function, added a notification in it using print, and to avoid having to stare at the green font, I decided to recolor it. So, I have this code:

function AllowHero( PLAYER, Hero )
print( "<color=yellow>Героя <color=orange>", Hero, " <color=yellow>нет на карте. Функция по его добавлению на карту работает" )

I.e., in the game console, yellow text with an orange hero name Hero should be displayed, but for some reason, Hero shows up in an eye-searing green color for me. How could I fix this issue? Also, is there any way to change the console font color from green to something else? Because green is really uncomfortable for me.

User Avatar
#3630
Auto-translated
Actually, you're writing everything correctly — in prints, works, just try concatenating the hero's name instead of specifying it next.
Of the colors definitely available by "name" — black, blue, neutral, negative, positive, and so on, like in MlTags. And if you add \n before the string, the entire print will be white

Changing the default color in the console entirely — I think it's possible through workarounds, if, again, you find the color_positive tag in the game files and specify a different color inside it, e.g., #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
#3631
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
#3632
Auto-translated
"<color=white>"..Hero

I'll test xdb with tags now, if it doesn't work — then indeed, only exe frown
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
#3633
Auto-translated
"<color=white>"..Hero

I'll test xdb with tags now, if it doesn't work — apparently, indeed, only exe frown
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
User Avatar
#3634
Auto-translated
}{0TT@6bI4, thank you! Now everything works correctly 😎
#3635
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
#3636
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"?
#3637
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
#3638
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
#3639
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"
_________________