Skip to content

Scripts for beginners.

User Avatar
#10
Auto-translated
ggroy
Hello, I'm back with a new question. How can I make it so that when I enter a region and it offers me to hire creatures for a certain amount, upon entering the region, I receive a message and then it offers me to hire them. Help me - URGENTLY.
function hire1(hero)
hire1_hero = hero
MessageBox("path to the text message in Unicode format")
QuestionBox("path to the question text", "hire1_ok")
end

function hire1_ok()
local gold = GetPlayerResource(PLAYER_1, GOLD)
if gold >= hiring_cost then
Trigger(REGION_ENTER_AND_STOP_TRIGGER, "region_name", nil)
SetPlayerResource(PLAYER_1, GOLD, gold - hiring_cost)
AddHeroCreatures(hire1_hero, creature_type, quantity)
else
-- here you can add a message about insufficient funds
end
end

Trigger(REGION_ENTER_AND_STOP_TRIGGER, "region_name", "hire1")
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

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