Connection ErrorBad RequestSession ExpiredSign in requiredForbiddenNot FoundToo Many RequestsServer ErrorBad GatewayService UnavailableGateway TimeoutHTTP Version Not Supported
Session Expired
Your session has expired. Please log in to continue.
Sign in required
You need an account to do that. Sign in or create one — it only takes a minute.
Request Failed
We encountered an issue while processing your request.
Please check your internet connection and try again.
function BiaraKill() while 1 do sleep(10); if IsHeroAlive("Biara") == nil then SetObjectiveState("obj2", OBJECTIVE_COMPLETED); Sleep(2); break; end; end; end;
startThead("BiaraKill);
I need the task obj2 to be completed after Biara dies. Thank you in advance...
RedHeavenHero
10 years ago
Auto-translated
Sleep is written with a capital letter, but it should be lowercase.
In startThread, the variable r is missing.
Before BiaraKill, there's an unnecessary quotation mark.
Knight of the Abyss, Actually, the third option seems to be the best, but I don't really understand scripts; I only started working with them recently. The only thing I can do is create a script that sets the player's starting capital. So, could you tell me what the script itself would look like? I would be very grateful.
And also, there's this thing... If a hero (even an enemy hero) is without a castle, the player loses after a week. Is there a way to remove this function? So that there isn't a mission like "Capture any city within a week."
Added 16 minutes later And how do I make the AI attack on day 2, 3, 4, etc.? That is, not immediately.
Here's the script from the picture (sorry for the Bandicam ad, I didn't think it would be visible). Basically, at the beginning of the second month, a hero (in my case, Grol) appears and runs to coordinates 23, 101. Instead of 23, 101, you need to specify the entry point for your city, and in DeployReserveHero, specify the coordinates where your hero should appear. However, the hero needs to be created first. To do this, press the English letter M, select the Players Properties window, then select the desired player, and at the bottom, there will be a Reserve Heroes window. Click Add there, and you'll figure it out from there.
And to prevent the loss after a week, in the window on the left, find the Objectives tab, click +, select Primary > Common, there will be a zero, this is the "defeat all" task, and below it, there is another window, in which it says true, change true to false, and the loss will no longer occur.
Pert17 I encountered a problem. For some reason, this script only works for one ReserveHero. If I duplicate this script, replacing the hero's name and function name, neither the first function nor the duplicated one will work. So, unfortunately, this function is only suitable for one hero; if you want multiple attacks, it won't work...
Added after 4 minutes And yes, please tell me, if anyone knows, why when I copy the same script but replace DemonAtack_1 with Demon_Atack2, and Calid with Grok, both Demon_Atack1 and Demon_Atack2 stop working? Thank you in advance...
RedHeavenHero
10 years ago
Auto-translated
You don't need to duplicate the entire function; you only need to duplicate the if-then-end block within it.
Ment
10 years ago
Auto-translated
I think you just need to wait for the battle to end, and then run the function again based on the result.
And yes, RedHeaven is right, you need to carefully check the contents. Otherwise, one trigger might overwrite another, at the very least.
I think you just need to wait for the battle to end, and then run the function again based on the result. And yes, RedHeaven is right, you need to carefully check the contents. Otherwise, one trigger will overwrite another, at the very least.
Sorry, I made a mistake. I forgot to mention that the call date also changed, in addition to the function name and hero name. Basically, demons would emerge from the gates of hell and all run to one point, so the RedHeavenHero option is perfect... And can I ask another question? Could you tell me how to set time limits for multiple tasks? I had no problems with one, I wrote a trigger so that upon reaching a certain date, a defeat would be issued, and upon fulfilling the condition, the trigger would be reset, but when I needed another time limit for the next task, I tried to duplicate the function as in the first case, substituting new values, but both functions stopped working. I also tried to combine two functions into one using elseif, thanks to the hints, but I couldn't get anything working... In general, please tell me how I can implement 2 time limits (or intervals) for completing tasks... For example, "capture garrison 1 within one week" and "capture garrison 2 within 3 weeks". Sorry for the long text, I hope I didn't confuse you. As always, thank you in advance...
Added 18 hours 22 minutes ago
In general, I wrote a bunch of nonsense there... Please take a look, the first function is at the top, and the two loose triggers are at the bottom. According to my idea, I wrote NEW_DAY_TRIGGER, which, upon reaching the desired date, would issue a defeat without any questions, and I wouldn't reset this trigger, but I would insert the reset into the task execution function... At first, when there was only one loose trigger, everything worked as it should, but then when there were two triggers, because another "timed" task appeared, both of them stopped working.
Please help, how can I make loose2 and loose3 work, I really need it, it's a matter of life and death :smile45:
Ment
10 years ago
Auto-translated
Copy the contents of loose3 into the body of loose2, without replacing anything, between the two "end" tags. Then delete loose3 and its associated trigger. And see what happens.
Jack_of_shadows
10 years ago
Auto-translated
And also, the trigger is reset incorrectly; it should be: Trigger(NEW_DAY_TRIGGER, nil); the first parameter is the condition, in this case, "new day"; the second parameter is the function that is executed when the condition is met. This is what needs to be reset when the trigger is turned off.
Bravo1853
10 years ago
Auto-translated
The editor crashes when I open Edit Script; I don't know where to enter scripts now.
RedHeavenHero
10 years ago
Auto-translated
Bravo1853
The editor crashes when I open Edit Script; I don't know where to enter scripts now.
Try opening the map with an archiver and editing the map script file with Notepad. The file name is MapScript.lua.
Added 29 minutes later Knight of the Abyss, in addition to what Ment and Jack_of_shadows said, OBJECTIVE_FAILED is written incorrectly in the loose2 and loose3 functions.
Tip: send the script as text in
tags, not as images. Maybe someone will edit it, but no one is likely to retype it from an image.
Copy the contents of loose3 into the body of loose2, without replacing, between the two "end" statements. Delete loose3 and its associated trigger. And see what happens.
Thank you, it helped!) At first, nothing changed... Apparently, because I had another NEW_DAY_TRIGGER. When I inserted it there, everything started working; when the required day is reached, a defeat is issued, but now there is another problem; I don't understand how to reset all this when the task is completed... After all, there is only one trigger, but there are 2 functions. If I reset the trigger when the first task is completed, then along with the contents of loose2, loose3 will also be reset, and the second task will remain without time restrictions... In general, it's all strange; why do two NEW_DAY_TRIGGERs conflict at all? On the developer maps, there are many of these triggers, and everything works fine... And I also looked at the scripts in the second mission for Eliah (there were time limits for capturing garrisons); strangely, there were no scripts for defeat when the required date is reached... How did the developers achieve this without scripts? In general, I apologize for the inconvenience; I guess I'm not ready to work with such scripts yet.
Added 5 minutes later Jack_of_shadows
And the trigger is reset incorrectly; it should be: Trigger(NEW_DAY_TRIGGER, nil); The first parameter is the condition, in this case, "new day"; The second parameter is the function that is executed according to the condition. It is this function that needs to be reset when the trigger is turned off.
Really? I saw on the developer maps that they also specified the function name when resetting... And everything worked for me as long as there was only one trigger. Well, I'll try it the way you said
RedHeavenHero
10 years ago
Auto-translated
The easiest way is to create a single function for all temporary events and add a check for an additional condition, such as the status of the task.