Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
9 years ago
Auto-translated
Aleha, you probably messed something up in the map properties tree for this player. Please check the "players" branch and remove anything suspicious.
User Avatar
9 years ago
Auto-translated
Hey guys, another question about scripts. How can I make a certain number of units appear in a specific city on a specific week? And is that even possible?
User Avatar
9 years ago
Auto-translated
How can I make a specific number of units appear in a specific city on a specific week? And is this even possible?
If a specific week is simply week number N, then it is possible. See the following functions:
Trigger(NEW_DAY_TRIGGER, 'handler_name');
GetDate(ABSOLUTE_DAY);
AddObjectCreatures('city_name', creature_type, quantity, slot_number);
In reply to Jack_of_shadows
User Avatar
9 years ago
Auto-translated
Jack_of_shadows

Trigger(NEW_DAY_TRIGGER, 'handler_name');
GetDate(ABSOLUTE_DAY);
AddObjectCreatures('town_name', creature_type, quantity, slot_number);
I'm a bit slow, but what is "handler_name"? Is it the player number?
And in the second line of the script, should I write "ABSOLUTE_DAY" in parentheses?

Added 16 minutes later
So, for example, if I want 15 Paladins to appear in my town on the 3rd week, what would this script look like?
User Avatar
9 years ago
Auto-translated
Grimrock, sorry, I don't write ready-made scripts; I'm all about self-education :)
"Handler Name" - the name of the function that will be called when the trigger is activated.
ABSOLUTE_DAY - it must be written exactly like that. 3 weeks is approximately 15 days. So, you need to check if the value returned by GetDate(ABSOLUTE_DAY) is equal to 15.
In reply to Jack_of_shadows
User Avatar
9 years ago
Auto-translated
Jack_of_shadows

"Handler name" - the name of the function that will be called when the trigger is activated.
ABSOLUTE_DAY - it must be written exactly like this. 3 weeks is approximately 15 days. So, you need to check that the value returned by GetDate(ABSOLUTE_DAY) is equal to 15.
Can the function name be any name, or is there a specific requirement?
And how do you check that the value returned by GetDate(ABSOLUTE_DAY) is equal to 15?
User Avatar
9 years ago
Auto-translated
after capturing objects
Trigger(OBJECT_CAPTURE_TRIGGER, functionName);
The enemy hero has become an ally
SetObjectOwner(objectName, playerID);
User Avatar
9 years ago
Auto-translated
What is a resource database, and where is it located? I want to display a message, and the message needs to include its ID from the resource database.
User Avatar
9 years ago
Auto-translated
Could you please tell me: in the SetRegionBlocked script, what should be entered in the "status" field to set the region to be blocked?
In reply to WizardNazyr
User Avatar
9 years ago
Auto-translated
WizardNazyr
Could you please tell me: in the SetRegionBlocked script, what should be entered in the status field to set the region to be blocked?
1 - blocked,
nil - open.
In reply to RedHeavenHero
User Avatar
9 years ago
Auto-translated
RedHeavenHero
1 - blocked,
nil - open.
Thank you! I already had a chance to look at the scripts from the campaigns)

Added 14 minutes later
So, here's another question: in the "GetPlayerResource" script, there's a player and a resource type, but how do you specify the amount of resource received?
User Avatar
9 years ago
Auto-translated
So, here's another question: in the "GetPlayerResource" script, there's a player and a resource type, but how do you specify the amount of resource received?
The function returns the current amount of that resource. This function and the one that sets the resource amount are described in the manual.
9 years ago
Auto-translated
I have a problem! How can I make it so that at the beginning of a new day, a battle starts between creatures (Archangels) and the hero (Arantir)? It doesn't seem to be working. ``` function bar (hero) if hero=="Arantir" then StartCombat(Arantir,nil,5,14,1,14,1,14,1,14,1,14,1,nil); end; end; Trigger(NEW_DAY_TRIGGER,"bar"); ``` I've tried it without the `if...then` statement, but it still doesn't work. Can you help me?
User Avatar
9 years ago
Auto-translated
The function that handles the new day does not receive a parameter with the hero's name. Therefore, the if...then statement should be removed, as well as one of the end statements. In StartCombat, the hero's name also needs to be enclosed in quotation marks.
9 years ago
Auto-translated
The function that handles the new day doesn't receive a parameter with the hero's name. Therefore, the if...then statement needs to be removed, as well as one of the end statements. In StartCombat, the hero's name also needs to be enclosed in quotation marks.
Thank you! It helped.

Statistics

Welcome our newest member: recijeb