:mad: I apologize in advance for the wall of text, but since this person doesn't want to
(learn anything) open the Manuals themselves, I will quote the necessary parts from there.
Quoting: "Almost everything in this world is done using triggers. For example, it looks like this:
Trigger(REGION_ENTER_AND_STOP_TRIGGER,
“kamilla”,
“kamillaF” );
The trigger will remain in the game at all times and react to the 'stimuli' that you have
specified. For example, this one will react to a hero entering the “kamilla” region and call the
“kamillaF” function at that time. Let's examine this example in much more detail."
To create a region, go to the 4th tab in the editor panel, click New Region and, while holding the LMB on the map, drag the mouse cursor. That is, a region is created the same way as selecting a group of objects"The region is named kamilla. What needs to be done so that it reacts to someone
entering it and displays a text message? Correct, attach a trigger.
Check the official Nival scripting manual (located at: "game folder\Editor Documentation") or Novik's manual and find the most (and only) suitable trigger - Trigger(REGION_ENTER_AND_STOP_TRIGGER, sRegionName, sProc)
(The procedure (sProc) is called when any hero stops in the region named
sRegionName).
Triggers must be written exactly in the form they are presented. So we will write this one as: Trigger(REGION_ENTER_AND_STOP_TRIGGER, «now write the region name we gave it in quotes», «the name of the function that will be called when we enter there»), and after that it should look like this -
Trigger(REGION_ENTER_AND_STOP_TRIGGER,
“kamilla”,
“kamillaF” );
You can give the function any name, but for convenience, I give it the same name as the region (in this case), only adding the letter 'F'.
Where do you get the function that will be called? It's very simple – write it.
Here is what it looks like:
function kamillaF ()
MessageBox("Maps/SingleMissions/MAP_NAME/TEXT_NAME.txt");
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kamilla", "kamillaF");
(Scripts are entered only in Map Properties -> Scripts)Explanation:
This is the mandatory function keyword, then the name specified in the trigger, then empty
parentheses. Why? I don't know, but sometimes it doesn't work without them.
Then, on the next line, comes the actual command. MessageBox () calls a window with
the text you described. For the game to be able to read the text, the text file in
Unicode format must be in the map folder at the address the script refers to (/Maps/SingleMissions/MAP_NAME). How to put the file there? Open the
map with any archiver - it is a regular zip archive. Place the file in the final folder. How
to make a file in Unicode format? Copy any text document from the map (for example,
name) and make a copy of it, then put it back with the new text and name,
as described above. All names should be given in Latin letters.
Instead of MessageBox, you can enter any other command or even ten MessageBoxes,
all of them will be executed in turn.
!Attention – how exactly to use the commands is described in sufficient detail by Novik and in the
official Nival scripting manual. Therefore, this is not within the scope of this
manual.
Be sure to make sure that the commands are written exactly as they are presented in the
manuals. !Remember, uppercase and lowercase letters are different characters! Also,
don't forget to put a semicolon after each command.
At the end, you must put end;"
In our case, instead of the MessageBox() function, the PlayObjectAnimation () function is needed. Its parameters can be found in the manual."Most often, it is necessary for the function to trigger only once, when the hero enters the
specified region for the first time. To do this, reset the trigger and, preferably, write this at the very
beginning of the function (however, it can be at the end – it will reset where you write it). It is reset simply: Trigger(REGION_ENTER_AND_STOP_TRIGGER,
“kamilla”,
nil); that is, instead of
the function name, the value
nil is entered… The function now looks like this:
function kamillaF ()
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "kamilla", nil );
MessageBox ("/Maps/SingleMissions/ MAP_NAME / TEXT_NAME.txt");
end;
"
That is all you need to know to play an animation for an object. How to give a name to an object (this will be needed in the PlayObjectAnimation() function) has already been explained to you in more than sufficient detail. Link to the manual:
http://hmmp.ru/_ld/1/101_5_1.pdf