Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
14 years ago
Auto-translated
In the top panel of the editor, find the MapProperties button, go to the Script tab, then click the EditScript button, and type in the text window.
In reply to Ment
14 years ago
Auto-translated
Ment, one more question, I can’t seem to rename anything. Tell me the exact steps, because it doesn’t quite sink in the first time:smile33: :smile45: :smile45: :smile35:
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
32MeTpa
What are absolute and relative days?
Absolute - day since the beginning of the game.
Relative - as it is written in the game (i.e., day of the week)

Added 2 minutes later
Lendlord
Ment, another question, I can't seem to rename anything, tell me the exact steps, because it doesn't click with me the first time:smile33: :smile45: :smile45: :smile35:
Check here. There are some interesting materials for beginners.
14 years ago
Auto-translated
I just need to understand how to rename a monster, not an entire guide where you can't find anything even with "Ctrl+f".
I have 8 of these guides from different sites, 3 in English and 5 in Russian, but Ment's advice is better, and it's easier to understand than these confusing guides in PDF files.
User Avatar
14 years ago
Auto-translated
It's interesting what kind of guide you have... one manual for scripts, another for the map itself, and the entire editor can be mastered... Well, that's if you read everything, and not just use Ctrl+f.
In reply to Lendlord
User Avatar
14 years ago
Auto-translated
Lendlord
Ment, another question, I can't seem to rename anything, tell me the exact steps, because it doesn't quite register with me the first time:smile33: :smile45: :smile45: :smile35:
You select the monster. A tree of its properties appears on the left. There, you find the "name" field and rename the monster (using only Latin characters).
14 years ago
Auto-translated
Here's how I found the "Name" field a while ago, but I can't rename it. 1) I selected "Peasant." 2) I found the "Name" field. 3) ??????
4) ?????? :smile35:
In reply to Lendlord
User Avatar
14 years ago
Auto-translated
Lendlord
I just need to understand how to rename a monster, not an entire guide where you can't find anything even with "Ctrl+f".
I have 8 of these guides from different sites, 3 in English and 5 in Russian, but Ment gives better advice, and it's easier to understand him than these incomprehensible guides in PDF files.
O_o Why are they incomprehensible?
It's hard to find something in the guide, but there are answers even on this forum.
We just need to point it out, as they say!
Here!
3)
4)Open the guide and read it.
Attachments 1
1 file attached • Total size: 39.6 KB
User Avatar
14 years ago
Auto-translated
I recommend you read this manual; everything is explained very simply and clearly. I personally learned to write scripts quite quickly using it.
User Avatar
14 years ago
Auto-translated
Oligarch
put a semicolon at the end of the line:
PlayObjectAnimation(trololo);

PlayObjectAnimation(trol);

I don't understand at all why you need to put a semicolon.
It never helped, but I put it anyway :D.
User Avatar
14 years ago
Auto-translated
Lenlord, you're not writing a script, but rather a collection of letters. Here's an example of a script with animations on the map (the script is taken from my map):

function orksF()
if GetObjectOwner("helm") == PLAYER_1 then
MoveCamera(87, 61, 0, 50, 1, 180, 1, 0);
sleep(15)
Trigger(OBJECT_TOUCH_TRIGGER, "orks", nil);
PlayObjectAnimation("ork1", "death", ONESHOT_STILL);
sleep(5)
PlayObjectAnimation("ork2", "death", ONESHOT_STILL);
sleep(5)
PlayObjectAnimation("ork3", "death", ONESHOT_STILL);
sleep(5)
PlayObjectAnimation("ork4", "death", ONESHOT_STILL);
sleep(10)
RemoveObject "ork1"
sleep(5)
RemoveObject "ork2"
sleep(5)
RemoveObject "ork3"
sleep(5)
RemoveObject "ork4"
sleep(5)
MoveCamera(87, 40, 0, 50, 1, 180, 1, 0);
sleep(5)
PlayObjectAnimation("human1", "happy", ONESHOT_STILL);
PlayObjectAnimation("human2", "happy", ONESHOT_STILL);
PlayObjectAnimation("human3", "happy", ONESHOT_STILL);
PlayObjectAnimation("human4", "happy", ONESHOT_STILL);
PlayObjectAnimation("human5", "happy", ONESHOT_STILL);
sleep(5)
SetObjectiveState("obj_6", OBJECTIVE_COMPLETED);
sleep(5)
MessageBox(GetMapDataPath().."text9.txt");
sleep(30)
SetObjectiveState('obj_7', OBJECTIVE_ACTIVE);
SetObjectiveVisible('obj_7', true, PLAYER_1);
else
Loose(PLAYER_1)
end;
In reply to AkaR
14 years ago
Auto-translated
AkaR, here's how to add a monster (let's say a GOBLIN), its script name (ork_1), what should be entered in the "Script" section? PlayObjectAnimation... and what comes next? :smile07:
User Avatar
14 years ago
Auto-translated
: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

Statistics

Welcome our newest member: recijeb