Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
14 years ago
Auto-translated
But you won't be able to reset it that way, as it will reset and reactivate again... Here's how:
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil );
It will reset, I agree.
User Avatar
14 years ago
Auto-translated
Resident of Kirov, these are basic scripts... messagebox and removeobject... Copy this into your "MapScript.lua" file. function hatF () Trigger(OBJECT_TOUCH_TRIGGER, "hat" nil ); MessageBox (GetMapDataPath().."text.txt"); end; Trigger(OBJECT_TOUCH_TRIGGER, "hat" "hatF" ); Create a file in Unicode format named "text" and place it in the map data archive. Write the message in it. Create an object (in your case, a peasant hut), name it "hat" in the object tree, which will be located on the right. Added 1 minute ago So, you need to activate the trigger first, and then reset it? I'll try it now. Added 8 minutes ago Maybe I didn't understand something, or I missed something in the code, but the script still doesn't work :( Currently, it looks like this: function dopF () prog = 1; MessageBox (GetMapDataPath().."text10.txt"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", nil ); sleep (5); SetObjectiveState('obj_dop', OBJECTIVE_ACTIVE); SetObjectiveVisible( 'obj_dop', true, PLAYER_1 ); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", "dopF" ); end; function dop1 () if prog == 1 then MessageBox (GetMapDataPath().."text11.txt"); elseif prog == 2 then SetObjectiveState("obj_dop", OBJECTIVE_COMPLETED); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil ); AddHeroCreatures("hero", 64, 30); end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", "dop1" ); end; function fenixF () Trigger(OBJECT_TOUCH_TRIGGER, "fenix", nil ); prog = prog +1; Trigger(OBJECT_TOUCH_TRIGGER, "fenix", "fenixF" ); end;
User Avatar
14 years ago
Auto-translated
Hmm... Unfortunately, I don't quite understand your idea, but most likely the line
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil );
should be placed after the line
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil );
Also, the line Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", "dop1" ); should definitely be after the 'end', not before. Also, the line Trigger(OBJECT_TOUCH_TRIGGER, "fenix", "fenixF" ); should be placed after the nearest 'end', not before.
User Avatar
14 years ago
Auto-translated
Okay, I'll arrange the end triggers now... but I didn't understand this:
but most likely the line
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil );
should be placed after the line
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil );


Added 7 minutes ago
Something started working...
Now the message I wanted is displayed, if prog is equal to one, the trigger didn't reset, everything is as intended, BUT for some reason, issuing the quest didn't work, the main trigger, where SetObjectiveState is... however, there is progress. Currently, the script looks like this:

function dopF()
prog = 1;
MessageBox(GetMapDataPath().."text10.txt");
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", nil);
sleep(5);
SetObjectiveState('obj_dop', OBJECTIVE_ACTIVE);
SetObjectiveVisible('obj_dop', true, PLAYER_1);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", "dopF");
end;

function dop1()
if prog == 1 then
MessageBox(GetMapDataPath().."text11.txt");

elseif prog == 2 then
SetObjectiveState("obj_dop", OBJECTIVE_COMPLETED);
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil);
AddHeroCreatures("hero", 64, 30);
end;
end;
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", "dop1");

function fenixF()
Trigger(OBJECT_TOUCH_TRIGGER, "fenix", nil);
prog = prog + 1;
end;
Trigger(OBJECT_TOUCH_TRIGGER, "fenix", "fenixF");
User Avatar
14 years ago
Auto-translated
The same error occurs; remove `Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", "dopF");` from below.
14 years ago
Auto-translated
function dopF(heroname) prog = 1 MessageBox(GetMapDataPath() .. "text10.txt"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", nil); sleep(5) SetObjectiveState('obj_dop', OBJECTIVE_ACTIVE); SetObjectiveVisible('obj_dop', true, 1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "wayF", "dopF"); end; function dop1() if prog == 1 then MessageBox(GetMapDataPath() .. "text11.txt"); end; if prog == 2 then SetObjectiveState("obj_dop", OBJECTIVE_COMPLETED); AddHeroCreatures("hero", 64, 30); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil); end; end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", "dop1"); function fenixF(heroname) prog = prog + 1 Trigger(OBJECT_TOUCH_TRIGGER, "fenix", nil); end; end; Trigger(OBJECT_TOUCH_TRIGGER, "fenix", "fenixF"); Added after 47 seconds Approximately like this.
User Avatar
14 years ago
Auto-translated
It all worked ;) Thank you very much :) I'll post the finished map in a day or two :)

Added 1 minute ago
If anyone is interested, the working script looks like this:

function dopF () prog = 1; MessageBox (GetMapDataPath().."text10.txt"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way", nil ); sleep (5); SetObjectiveState('obj_dop', OBJECTIVE_ACTIVE); SetObjectiveVisible( 'obj_dop', true, PLAYER_1 ); end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way", "dopF" );

function dop1 () if prog == 1 then MessageBox (GetMapDataPath().."text11.txt");
elseif prog == 2 then SetObjectiveState("obj_dop", OBJECTIVE_COMPLETED); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", nil ); AddHeroCreatures("hero", 64, 30); end; end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "way1", "dop1" );

function fenixF () Trigger(OBJECT_TOUCH_TRIGGER, "fenix", nil ); prog = prog +1; end; Trigger(OBJECT_TOUCH_TRIGGER, "fenix", "fenixF" );
In reply to AkaR
User Avatar
14 years ago
Auto-translated
Could you provide a script that displays different messages on different days (but within the same region)? Specifically: * When entering reg1 during the first week, display message mes1. * When entering reg1 during the second week, display message mes2. * When entering reg1 during the third week, display message mes3. * When entering reg1 during the fourth week, display message mes4. * And so on. Thank you in advance!
User Avatar
14 years ago
Auto-translated
There is a GetDate function; it returns the date.
You can do this: create a trigger on a region, use GetDate in the condition, and vary the dates using elseif. (I haven't used this function, so I'm not sure if it's possible to return only the day or, depending on the parameter, return the day, week, or month. You can check this in the manual.)
User Avatar
14 years ago
Auto-translated
This function can return anything: Day (absolute and relative), week (only relative), month (month is month). If something too complex is needed, it's not difficult to write it yourself using the available functions.
GetDate(week) - returns the week number relative to the month (1, 2, 3, 4).
User Avatar
14 years ago
Auto-translated
What are absolute and relative days?
In reply to 32MeTpa
User Avatar
14 years ago
Auto-translated
32MeTpa
What are absolute and relative days?
Absolute day is the day count since the start of the game, and relative day is the day of the week or day of the month. Seems like that's how it works.
14 years ago
Auto-translated
Please tell me how to add animations to creatures on the map, for example, when playing Heroes, I saw an animation of peasants waving pitchforks on the map, not in battle, or knights waving swords, archdevils punching, etc. How can I add the same to my map???
I created a map, but there's nothing interesting in it.:confused: :confused: :confused: :confused: :confused: :confused: :confused: :confused:
User Avatar
14 years ago
Auto-translated
It’s very simple: you add a script to the map: PlayObjectAnimation(monster name in quotes, animation name, loop);
For example:
PlayObjectAnimation("priest","attack00",IDLE);
The name must be your own, script-based name. To name a creature with that name, you need to select it, find the Name line in the left panel, and enter the name there (in our case,
priest
).
In reply to Ment
14 years ago
Auto-translated
Explain to me, like I'm an elk, what these scripts are all about, because I have no idea what they are or how they work!

Statistics

Welcome our newest member: recijeb

Users Online 3 users 1351 guests