Skip to content

Posts from Adding a hero and a couple of questions.

No ratings yet — be the first to rate!
User Avatar
10 years ago
Auto-translated
Okay, I'm working on a map with several heroes that need to join the player. But besides that, there are other issues:
1) First, I can't get the map objective to trigger and a new one to appear when entering a specific region.
SetObjectiveState(objectiveName, state, playerID = PLAYER_1);, if I understand correctly, this is what I need.
I've tried using OBJECTIVE_COMPLETED for the state, and I've entered the correct name and PLAYER_1 for the playerID, but it doesn't work. When the player enters the region, they get stuck, and nothing happens, even though something should be triggered.
2) Based on the above (i.e., when entering a specific region), I need to add a hero. I think I should use
SetObjectOwner(objectName, playerID);
I don't know if it works, so the first question is the most important.

Added 22 minutes later
Oh, and one more thing. I created a Castle where everything is built: the Hall of Elders and the Castle is fully upgraded. There are no taverns or buildings where creatures can be bought. An enemy hero is standing there because their AI is turned off. I noticed that some hero appeared and disappeared abruptly in the Castle. I don't understand why; they can't buy anything. There are no buildings, no tavern, and no nearby reinforcement locations. Nothing. Can you explain?
User Avatar
10 years ago
Auto-translated
I'm not an expert in scripts, but maybe I can help with something... :)
Could you send me your text with the script?
User Avatar
10 years ago
Auto-translated
SetRegionBlocked("VillinaLock", true, 4); SetRegionBlocked("ScarecrowLock", true, 3); SetRegionBlocked("GolemLock", true, 3); EnableHeroAI("Skeggy", false); SetObjectiveVisible("MeetScarecrow", false, PLAYER_1); SetObjectiveVisible("MeetGolem", false, PLAYER_1); SetObjectiveVisible("DefeatCyclop", false, PLAYER_1); function MeetCyclopF() SetObjectiveVisible("DefeatCyclop", true, PLAYER_1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MeetCyclop", nil); end; function MeetVillina() SetObjectiveState("MeetVillina", OBJECTIVE_COMPLETED, 1); SetObjectiveVisible("MeetScarecrow", true, PLAYER_1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "VillinaLock", nil); end; function MeetScarecrow() SetObjectiveState("MeetScarecrow", OBJECTIVE_COMPLETED, 1); AddHeroCreatures("Ally", CREATURE_WOLF, 29); AddHeroCreatures("Toto", CREATURE_WOLF, 29); SetObjectOwner("Scarecrow", PLAYER_1); SetObjectiveVisible("MeetGolem", true, PLAYER_1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "ScarecrowLock", nil); end; function MeetGolem() SetObjectiveState("MeetGolem", OBJECTIVE_COMPLETED, 1); AddHeroCreatures("Ally", CREATURE_IRON_GOLEM, 10); AddHeroCreatures("Toto", CREATURE_IRON_GOLEM, 10); SetObjectOwner("Golem", PLAYER_1); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "GolemLock", nil); end; function MeetPeasants() if IsHeroAlive("Skeggy"); then MessageBox("/Maps/SingleMissions/Oz/MeetPeasants.txt"); else Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Peasants", nil); MessageBox("/Maps/SingleMissions/Oz/MeetPeasants2.txt"); RemoveObject("Peasants"); end; end; Trigger(REGION_ENTER_AND_STOP_TRIGGER, "Peasants", "MeetPeasants"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "MeetCyclop", "MeetCyclopF"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "GolemLock", "MeetGolem"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "VillinaLock", "MeetVillina"); Trigger(REGION_ENTER_AND_STOP_TRIGGER, "ScarecrowLock", "MeetScarecrow"); ```

Added 35 seconds ago
Yes, yes, I'm making a map about "The Wizard of Oz," don't judge me
In reply to Pit Lord
User Avatar
10 years ago
Auto-translated
You have the keyword "then" after the semicolon following the "if IsHeroAlive("Skeggy");" statement. There should not be a semicolon after the conditional statement.
if IsHeroAlive("Skeggy")
then MessageBox("/Maps/SingleMissions/Oz/MeetPeasants.txt");
I think it should be like this...
User Avatar
10 years ago
Auto-translated
Of course, thank you, but this question is the least important right now. I need to understand why the map objective isn't being completed when I enter the region.
In reply to Pit Lord
User Avatar
10 years ago
Auto-translated
Perhaps, this error is the reason why they don't work. After all, if it's a syntax error, the entire code won't function. Try checking it.
User Avatar
10 years ago
Auto-translated
No, no, it still doesn't work. It just doesn't work.
In reply to Pit Lord
User Avatar
10 years ago
Auto-translated
Try adding `GetObjectiveState("MeetVillina", OBJECTIVE_ACTIVE, 1);` before the `SetObjectiveVisible` line.
Also, in the Properties Tree, check the quest type (it should be Manual).
User Avatar
10 years ago
Auto-translated
The easiest way is to open the console and see what error message it displays. I think that's what will happen in this case.
In reply to Ment
User Avatar
10 years ago
Auto-translated
Ment, please answer me in the "Scripts" thread, if it's not too much trouble.
In reply to Ment
User Avatar
10 years ago
Auto-translated
Ment
The easiest way is to open the console and see what error message it displays. I think that's what's happening in this case.

IS THERE A CONSOLE HERE? Wow, I suspected it, but I didn't think it would be so simple. How do I enable it and view it?
In reply to Pit Lord
User Avatar
10 years ago
Auto-translated
Pit Lord
IS THERE A CONSOLE HERE? Wow, I suspected, but I didn't think it would be that simple. And how do I turn it on and view it?

Of course, there is.
User Avatar
10 years ago
Auto-translated
No, the console cannot be opened. And cheats don't work either... It doesn't work as described in the instructions – there is no folder in the profiles directory (there is only the default_profile folder) for my profile. Nothing works when I press the "Ё" key. I don't know what's going on.

Statistics

Welcome our newest member: recijeb

Users Online 1 users 1245 guests