Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to }{0TT@6bI4
User Avatar
Auto-translated
Hello everyone, can you tell me how to make a script so that in PlayObjectAnimation, the creature performs an animation, then waits, and after 3 seconds, repeats the animation? Please help me find the error: ``` function message() MessageBox("Maps/SingleMissions/greet/sms1.txt") end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg0", "nil"); ``` The problem is that the trigger works, meaning when my hero enters, he stops, but the message doesn't appear.
In reply to Alinksolo
User Avatar
Auto-translated
Alinksolo
Hello everyone, can you tell me how to make a script so that in PlayObjectAnimation, a creature plays an animation, then waits, and repeats the animation after 3 seconds?

Added 4 hours 14 minutes ago
Please help me find the error in my code:
function message()
MessageBox("Maps/SingleMissions/greet/sms1.txt")
end;

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg0", "nil");
The problem is that the trigger works, meaning when my hero enters, he stops, but the message doesn't appear.

 

1. To get exactly 3 seconds, you need to calculate what number to put in sleep(). The formula: 1 segment = 1/20 seconds. Experiment, start by putting 5 in the parentheses. Maybe 5 segments will be enough).

2. Replace Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg0", "nil"); with Trigger(REGION_ENTER_AND_STOP_TRIGGER, "reg0", "message");

Checking the console during the game is very helpful for identifying errors.

User Avatar
Auto-translated
`sleep(1)` is one-fifth of a second, or 200ms. For 3 seconds, you need to write `sleep(5)` and repeat the animation playback command.
С уважением, }{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
Could you please tell me where I should enter the `sleep()` command, either within the script or by pressing Enter? Also, I still haven't received a message from Azgalor.
In reply to }{0TT@6bI4
User Avatar
Auto-translated
You wrote it correctly, otherwise it doesn't work for me.
PlayObjectAnimation("3", "happy", IDLE);
sleep(5)
In reply to }{0TT@6bI4
User Avatar
Auto-translated
Can I send you a message on VK? I don't know how to upload a photo here.
In reply to }{0TT@6bI4
User Avatar
Auto-translated
Okay, I joined a while ago, where should I write?
In reply to Alinksolo
User Avatar
Auto-translated
Alinksolo
And I still haven't received the message from Azgalor.
What error message does the console display after the trigger is activated? Could it be an incorrect file path in the MessageBox?
User Avatar
Auto-translated
Hello! I need help with a question: In general, I have a counter. The presence of creatures from a list in a hero's army should affect it. For example: enemy_creatures = {106, 107, 108, 109, 110, 111, 112, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28} - these are red creatures and regular demons, as well as "fiery" demons (without alternative upgrades). There are 21 of them in the list, and I write: for enemy=1,21 do if GetHeroCreatures(HeroName, enemy_creatures[enemy]) >= 1 then counter = counter - 1; The problem is that the function affects the counter for the entire list, i.e., even for one stack in the hero's army, it reduces the counter by not 1, but by all 22. How can I write the function so that it only changes the counter if creatures with IDs from the list are present in the hero's army?

Statistics

Welcome our newest member: Emil