Skip to content

Posts from Scripts for beginners.

4.5 (2 ratings)
User Avatar
11 years ago
Auto-translated
Could you please provide the script? After entering a region, it would display a message, and the camera would focus on the specified region. Thank you.
In reply to ggroy
User Avatar
11 years ago
Auto-translated
I am increasingly convinced that I am a complete noob when it comes to mapmaking :smile07:. Has anyone already created a Russian-language manual on scripts, or even better – scripts with examples, screenshots, and a detailed, easy-to-understand explanation (sorry if this is an overdone topic)?
User Avatar
11 years ago
Auto-translated
Yes, everything is available.
User Avatar
11 years ago
Auto-translated
Could you please provide the script for the following scenario: After joining, I was attacked by a group of creatures.
User Avatar
11 years ago
Auto-translated
Help!:smile45: Can you suggest a script that would make it so the hero doesn't need a town? I'm creating a map with a hero (without a town), with various outposts and garrisons... But when I launch it, it says the task is to capture any town within 1 week.:smile45:
In reply to Ghost Archer
User Avatar
11 years ago
Auto-translated
Ghost Archer
Could you provide a script that would allow a hero to function without needing a town?
In the map editor, look at the settings tree, specifically the "objectives" branch. There, you'll find the condition "DieInWeekWithoutTowns," which is set to "true" by default. Change it to "false." There are several of these, including a general one and ones for each player, as well as for primary and secondary quests. To be sure, it's best to go through and disable them all.
In reply to Jack_of_shadows
10 years ago
Auto-translated
Wow, it was hard to find a place where people understand scripts.

Guys, help me out, I need scripts to enhance the AI players.

On a specific day, add a certain amount of gold/resources to each AI player. Add a certain number of monsters of a specific level to the main city of each AI player.

Thanks in advance.
In reply to RedHeavenHero
User Avatar
10 years ago
Auto-translated
After writing such scripts and clicking "OK", the editor crashes for me.
User Avatar
10 years ago
Auto-translated
Please, someone help me :)

I've just started learning scripting, so I don't quite understand why the following code isn't working for me:(
function f1()
MessageBox("The Prophet does not wish to see you.")
end
SetObjectEnabled("Prophet", nil)
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", 'f1')

SetObjectEnabled works as expected, but the Trigger doesn't. What's wrong?
User Avatar
10 years ago
Auto-translated
MessageBox("The Prophet does not wish to see you.")
This is completely wrong. Look at the manual; it needs a link to a text file, not just plain text.
In reply to Ment
User Avatar
10 years ago
Auto-translated
Ment
That is completely wrong. Look at the manual; it requires a link to a text file, not just text.
Thank you :)
Another question, if it's not too much trouble)
I have a secondary "Conquer" objective of type Manual with initial visibility/activity parameters set to false.
But it's not working :(
path = GetMapDataPath()
function activate(obj)
SetObjectiveState(obj, OBJECTIVE_ACTIVE,PLAYER_2)
end

function complete(obj)
SetObjectiveState(obj, OBJECTIVE_COMPLETED,PLAYER_2)
MessageBox(path.."meow1.txt")
end

function proph_event(hero)
if GetObjectiveState("Conquer") == OBJECTIVE_UNKNOWN then
activate("Conquer")
else
if GetObjectiveState("Conquer") == OBJECTIVE_ACTIVE and HasArtefact(hero, 29) then
complete("Conquer")
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", nil)
end
end

SetObjectEnabled("Prophet", nil)
Trigger(OBJECT_TOUCH_TRIGGER, "Prophet", "proph_event")
User Avatar
10 years ago
Auto-translated
OBJECTIVE_UNKNOWN
Check this out. PLAYER_2 is questionable... If it's a single-player map, then the person is playing as the first player. If it's multiplayer, then it's okay...
In reply to Ment
User Avatar
10 years ago
Auto-translated
Ment
Check this out.
PLAYER_2 is questionable... If it's a single-player map, the player plays as the first player. If it's multiplayer, that's okay...
It didn't become much clearer somehow :(
I'm not creating anything right now, just experimenting. That's why I have both the first and second player, but the quests should be tied to the second player.
OBJECTIVE_UNKNOWN — the task is unknown to the player.
It seems to be correct; this thing is in the list of the GetObjectiveState method's return values. Regarding what is written in script_functions_rus
How would you personally do it? :)
User Avatar
10 years ago
Auto-translated
I'm not creating anything substantial right now, just experimenting. That's why I have both the first and second player, but the quests should be tied to the second player.
I don't understand how that works for you... Are you sure you're actually playing as the second player? ) If you're playing as the first player, nothing will happen with the quests, because your script specifies that the state only changes for the second player.
It seems like everything is correct; this is included in the list of the `GetObjectiveState` method. Regarding what's written in `script_functions_rus`
How would you personally do it?
Well, I just don't remember. If it's written that way in the manual, then it's correct.
User Avatar
10 years ago
Auto-translated
It seems like the `proph_event` function is missing an `end` statement for the `if/else` block.

Statistics

Welcome our newest member: recijeb