Skip to content

Posts from Scripts for beginners. Auto-translated

4.5 (2 ratings)
User Avatar
#46
Auto-translated
function objective_1(hero) local player = GetObjectOwner(hero) if GetObjectiveState("objective_name", player) == OBJECTIVE_UNKNOWN then StartDialogScene("dialog_path") SetObjectiveState("objective_name", OBJECTIVE_ACTIVE, player) elseif GetObjectiveState("objective_name", player) == OBJECTIVE_ACTIVE and HasArtefact(hero, artefact_number) then SetObjectiveState("objective_name", OBJECTIVE_COMPLETED, player) RemoveArtefact(hero, artefact_number) end end SetObjectEnabled("creature_name", nil) Trigger(OBJECT_TOUCH_TRIGGER, "creature_name", "objective_1")
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#47
Auto-translated
Thank you. Could you also provide another script (I know I'm bothering you, sorry), a quest script to kill a specific hero, but the quest should appear after a hostile hero attacks me. Also, please write a script for the attack by a hostile hero at a specific moment.
If possible, please write three scripts: the first - for the quest, the second - for the hero's attack, and the third - for everything together.

Added 2 minutes later
By the way, I see that only two people answer questions on this forum (and very rarely others): RedHeavenHero and Ment, which is a pity.
[url=Таверна (фулдилка) - заходите.


User Avatar
#48
Auto-translated
The task of killing an enemy hero can be implemented through quests.

Added 12 minutes later
And I didn't quite understand what exactly "an enemy hero will attack" means.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#49
Auto-translated
1. Understood, I now know how to implement the tasks. 2. On a specific day, an enemy hero attacks. Is it possible to make it happen like this? Description: On a specific day, in a specific location, a specified hero appears with a specific army and directly attacks the castle. HOW CAN I IMPLEMENT THIS?

Added after 12 minutes
And tell me about another script, I know it's small: I want a specified hero to stay in place and not move until I approach him.
[url=Таверна (фулдилка) - заходите.


User Avatar
#50
Auto-translated
2. First, you need to reserve a hero for a specific player.
function new_day()
	local day = GetDate(DAY)
	if day == day_since_start_of_game then
		DeployReserveHero("scripted hero name", x, y, level)
	end
end

Trigger(NEW_DAY_TRIGGER, 'new_day')
To prevent the hero from moving:
EnableHeroAI("scripted hero name", nil)
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#53
Auto-translated
Here's how it looks now (I set it to 2 days for testing purposes), by the way, am I doing something wrong?:
function new_day()
	local day = GetDate(DAY)
	if day == 2 then
		DeployReserveHero("Jazaz", 164, 156, 0)
	end
end

Trigger(NEW_DAY_TRIGGER, 'new_day')
[url=Таверна (фулдилка) - заходите.


User Avatar
#55
Auto-translated
What does "reserved" mean?
And does the hero need to be placed on the map, or will he appear even without being placed?
[url=Таверна (фулдилка) - заходите.


User Avatar
#56
Auto-translated
In the player properties, you select a player and add them to the list of heroes that will be in their reserve.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
#57
Auto-translated
okay, I understand, I'll try now.

Added after 38 seconds
Do I need to place the hero on the map or not?

Added after 12 minutes
In general, it didn't work. I don't understand what the problem is. (I place the hero on the map, I check in the map properties - he is there, the script is correct).
[url=Таверна (фулдилка) - заходите.


User Avatar
#59
Auto-translated
If it's not supposed to be reserved, then how do you reserve it?
In general, I didn't understand the point; please explain everything to me in order.
[url=Таверна (фулдилка) - заходите.


In reply to ggroy
User Avatar
#60
Auto-translated
ggroy
If it's not allowed, how can you reserve it?
In general, I don't understand the point. Please explain everything to me in order.
Add it to the list in player properties, don't place it on the map.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4