Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to EnterEsc
User Avatar
Auto-translated
EnterEsc
Fellow Heroes enthusiasts, please help me with these questions:
1) How can I create a large message window, not the standard MessageBox, but a larger one? (the one with the scroll on the left)
2) Is it possible to edit the Mission Log? (the one where dialogues and quest assignments are recorded)
3) How can I make it so that when purchasing a map from a cartographer, both water and land are revealed?

Thank you in advance!

1). This is a mod. You can find it on the forum or, by opening a map with this mod, using an archiver and searching in the UI folder.
2). Yes, by replacing one quest with another using a script.
3). Either by installing another cartographer on the water or using a script.
In reply to Долгий
User Avatar
Auto-translated
2) I mean adding some custom text there, and which function edits this Diary?
3) Can you provide an example of such a script?
In reply to EnterEsc
User Avatar
Auto-translated
EnterEsc
2) I mean adding some custom text there, and which function edits this Diary?
3) Can you provide an example script?

2). In the top panel of the editor, you need to activate the Map properties tree. There is a folder called Objectives. Primary is for main quests. Secondary is for side quests. Common is for general quests. Player specific is for quests specific to a particular player. The standard "kill 'em all" quest is a main, general quest. The CaptionFileRef field is for the quest name, and the descriptionFileRef field is for the description.
3). You need to give the cartographer a script name in the window on the left, in the name parameter.
Replace everything written in Cyrillic in the script with what is required:


HERO = 0;
SetObjectEbabled("script_name_of_cartographer",nil);
function cartographer(hero,obj)
HERO = hero;
QuestionBoxForPlayers(GetObjectOwner(HERO),"link_to_file_with_text_for_buying_maps","yes");
end;
function yes()
if GetPlayerResource(GetObjectOwner(HERO),6) >= price_of_maps then
SetPlayerResource(GetObjectOwner(HERO),6, GetPlayerResource(GetObjectOwner(HERO),6)-price_of_maps);
OpenCircleFog(50,50,0,999,GetObjectOwner(HERO));
Trigger(OBJECT_TOUCH_TRIGGER,"script_name_of_cartographer",nil);
else
MessageBoxForPlayers(GetObjectOwner(HERO),"link_to_file_with_text_that_not_enough_money");
end;
end;
Trigger(OBJECT_TOUCH_TRIGGER,"script_name_of_cartographer","cartographer");
In reply to Долгий
User Avatar
Auto-translated
Thank you. P.S. Using OpenCircleFog is brilliant; I wouldn't have thought of it.
In reply to EnterEsc
User Avatar
Auto-translated
EnterEsc
Thank you.

P.S. Using OpenCircleFog is brilliant, I wouldn't have thought of it.


Forgot to collect the money for the map. Updated the script.
User Avatar
Auto-translated
Need help again. How can I make enemy heroes pursue your hero and engage in battle, even if the battle is a losing one for them? SetAIHeroAttractor and SetAIPlayerAttractor don't work.
In reply to EnterEsc
User Avatar
Auto-translated
EnterEsc
Need help again. How do I make enemy heroes pursue your hero and engage in battle with him, even if the battle is a losing one for them? SetAIHeroAttractor and SetAIPlayerAttractor don't work.
Set the "attractiveness" value to "2," which means "forget about the dangers and run to fight him." At least, that's how it worked for me. I think if these functions don't help, you'll have to use more complex schemes, like taking the coordinates of your hero and setting the computer to run to them using MoveHero, repeating this every day, and in some thread, checking if CalcHeroMoveCost(...) < 100, then StartCombat(...). I think such a scheme will suit you, right?)
С уважением, }{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
Ah, if only parameter 2 worked in this function... By the way, complex constructions aren't very effective either. GetObjectPosition, when used with NEW_DAY_TRIGGER, calculates the coordinates at the beginning of the player's day. During that turn, the hero will move, and the coordinates will become irrelevant for the computer.
User Avatar
Auto-translated
you could simply loop the MoveHeroRealTime function to make the enemy constantly move towards the desired hero's position. However, it's better not to loop CalcHeroMoveCost, as the game will start to lag if you create an infinite loop with this function.
Нет войне.
In reply to Gerter
User Avatar
Auto-translated
Gerter
You could simply loop the MoveHeroRealTime function so that the enemy constantly moves towards the position of the desired hero. However, it's better not to loop CalcHeroMoveCost, as the game starts to lag if you create an infinite loop with this function.
I don't know...
function check_loop()
while 1 do
local x, y, floor=GetObjectPosition("nMyhero");
if CalcHeroMoveCost(?)("nAI", x, y, floor)<=100 then
StartCombat(...);
end;
sleep(1)
MoveHero("nAI", x, y, floor);
end;
end;

startThread(check_loop);
Have you checked if it crashes? Simply looping MoveHero will move the AI "towards us," but it won't trigger interaction, and the player will still decide whether to attack or not. The goal, as I understand it, is for the AI to automatically attack us...
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to Gerter
User Avatar
Auto-translated
If you use MoveHeroRealTime, that's enough for attacking, but RealTime is RealTime; it will happen directly at any moment, possibly during the player's turn, and there will be no way to escape. Regular MoveHero might require StartCombat, yes. Although I'm not sure, but it seemed to me that I encountered something like that. Attractors don't work. If the behavior of your heroes isn't rigidly defined and you need them to target something, even if only sometimes and imprecisely, an attractor might work, but it shouldn't be used for a precise target. And even if it works normally for the mapmaker, there will most likely still be players for whom it won't work.
 

К А
Стикеры GBF в Telegram
In reply to Ment
User Avatar
Auto-translated
Ment
If you use MoveHeroRealTime, that should be enough for attacking, but RealTime is RealTime, it will happen directly at any moment, possibly during the player's turn, and there will be no way to escape.
Regular MoveHero might require StartCombat, yes. Although I'm not sure, but it seemed to me that I encountered something like that.
Attractors don't work. If the behavior of your heroes is not rigidly defined and you need them to target something, even if only sometimes and imprecisely, an attractor might work, but it shouldn't be used for a rigid target. And even if it works normally for the mapmaker, there will most likely still be players for whom it won't work.
Essentially, 👍 :smile54:
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
In reply to Ment
User Avatar
Auto-translated
Ment
If you use MoveHeroRealTime, that's enough for an attack, but RealTime is RealTime; it will happen directly at any moment, possibly during the player's turn, and there will be no way to escape.
A regular MoveHero might require StartCombat, yes. Although I'm not sure, but it seemed to me that I encountered something like that.
Attractors don't work. If your heroes' behavior isn't rigidly defined and you need them to target something, even if only sometimes and imprecisely, an attractor might work, but it shouldn't be used for a rigid target. And even if it works normally for the map editor, there will most likely still be players for whom it won't work.
You can move without problems only during the turn of the desired player, using a construct like:
while 1 do
while not IsPlayerCurrent(desired_player) do
sleep()
end
MoveHeroRealTime(...)
sleep()
end

And regarding CalcHeroMoveCost, I had a task to constantly check the distance between 2 heroes, and this function, when called in a loop, caused lag in the game, so I had to simply calculate the distance in cells
Нет войне.
User Avatar
Auto-translated
Hello, I need help with a script, but I don't know how to create it. When interacting with a specific object, a dialog should appear, similar to the one from the messagebox command, but with multiple answer options. Thank you in advance to whoever writes the script for me. And another question: is it possible, and if so, how can I make it so that the script executes the following command: the hero can move around the map and explore areas, but only a small portion of the map around the hero is visible, and the area beyond the hero's viewing radius is black. This would allow me to create a labyrinth where the hero can only see a small area, and all the places he has been will not be visible on the map. I hope you understand what I'm asking, as I'm not very good at explaining my idea.
In reply to Лоли Никита
User Avatar
Auto-translated
Loli Nikita
Hello, I need help with a script, but I don't know how to do it. When interacting with a specific object, a dialog should appear, similar to the messagebox command, but with several answer options. Thank you in advance to whoever writes me how to implement this command.
And another question, is it possible and if so, how can I make a script that performs the following command: the hero can move around the map and explore areas, but only a small piece of the map around the hero will be visible, and the area beyond the hero's vision range will be black, thus allowing for a labyrinth where the hero can see only a little bit, and all the places he has been will not be visible on the map. I hope you understand what I wanted to ask, as I don't quite know how to explain my idea.
Hello. I won't provide the TalkBoxForPlayers function script here because everything is described in detail by the highly respected Jack_of_shadows.
Here is his material FAQ from Jack_of_Shadows
Be sure to check it out.
I assume you want to reduce the hero's view distance? Install an extended map editor (search online for how to do it). Then, View=>Game Database=>New Window.
Next, select Resource=>Select Tables=>Put ticks on all. Then open the map for which you need a reduced view distance. In the upper left window, click on the panel; a large list of "unclear" lines should appear. Look for something like RPGStats, although I can't say exactly. Click on it, and a folder will appear in the window; click on the plus sign, another one will appear; click on that too, then a gray inscription GameMechanics will appear; double-click on it. A table with values will appear in the lower left window. Click the plus sign next to adventure, find BaseHeroLookRange, and change it from 12 to 1, for example. Voila. I recommend disabling Scouting and Silent Stalker via script.Attention! After performing the described procedure to reduce the viewing range, your map will become a mod, and the viewing range will be reduced everywhere where there is your map nearby.

Added after 5 minutes
Loli Nikita
And another question, is it possible and if so, how can I make a script that performs the following command: the hero can move around the map and explore areas, but only a small piece of the map around the hero will be visible, and the area beyond the hero's vision range will be black, thus allowing for a labyrinth where the hero can see only a little bit, and all the places he has been will not be visible on the map. I hope you understand what I wanted to ask, as I don't quite know how to explain my idea.
I look forward to seeing your labyrinth) No offense to anyone and no self-praise; I hope my labyrinth will be a worthy response to yours, despite the lack of scripts and mods;)
С уважением, }{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