Skip to content

Posts from Scripts for beginners.

4.5 (2 ratings)
Auto-translated
Who can help? I need a script of this kind: a neutral monster stands on the map. When attacked, it displays a text message. After reading the text and closing it, the monster disappears, and a specific structure appears in a designated area of the map. I honestly tried to read this section from the beginning, but I got tired after 20+ pages. Please let me know if it's possible to create such a script, and if so, who can help me. Thanks in advance.
User Avatar
Auto-translated
kycaka, please refer to the FAQ in the link in my signature:
kycaka
a neutral monster is present
question "How to perform an action when touching a specific monster?"
kycaka
displays a text message
question "How to display a simple text message?" (and possibly "I'm trying to display a text message, but it doesn't appear. What should I do?")
kycaka
the monster disappears
question "How to remove a specific object from the map?"
kycaka
a specific building appears
see the CreateDwelling() function in the documentation.
РПГ-сценарий для HoMM5: Путь героя
ЧаВо по созданию карт для HoMM5: ЧаВо
In reply to Jack_of_shadows
Auto-translated
Jack_of_shadows
kycaka, please refer to the FAQ from the link in my signature: question "How to perform an action when a specific monster is touched?", question "How to display a simple text message?" (and possibly "I'm trying to display a text message, but it doesn't appear. What should I do?"), question "How to remove a specific object from the map?". See the CreateDwelling() function in the documentation.

Jack_of_shadows
kycaka, please refer to the FAQ from the link in my signature: question "How to perform an action when a specific monster is touched?", question "How to display a simple text message?" (and possibly "I'm trying to display a text message, but it doesn't appear. What should I do?"), question "How to remove a specific object from the map?". See the CreateDwelling() function in the documentation.

1. I have read your FAQ. There is almost nothing there about my problem. I know how to place a monster. I just wrote down all the steps I need as an example.
2. I couldn't find anywhere in your FAQ how to use a script to PLACE, not REMOVE, a building.
3. I know how to display a text message, but it is displayed at the end, not at the beginning of the event.

And I repeat, I don't want to delve into studying scripts and writing code. THIS TOPIC IS CALLED - SCRIPTS FOR BEGINNERS, not learning how to write scripts and code. I just need help on how to configure the monster so that the message is displayed before the script, not after. So that first there is a message that describes everything, then you close it, the monster disappears, and a building appears, and not the other way around - first the monster disappears, a house appears, and then a message appears saying what happened. And I need the script itself so that the monster disappears and a building appears at specific coordinates.

I will even write down again what I need step by step.
- Explain how to prepare the monster. Don't just give links to read for half a year about how to do it, but provide an EXAMPLE. I, and many others, will simply read the example, and that will be ENOUGH so that we don't have to read tons of unnecessary information.
- Write a script where a piece of the script is highlighted and it is indicated what it is for and what it does. And this will be an EXAMPLE of how to write such a script. Not an attempt to teach me to code. You yourself spent a lot of time figuring this out, so why send others down the same path? The topic was created specifically so that you share your knowledge with those who need it at the moment. WE NEED YOUR KNOWLEDGE, NOT LINKS TO READ SOMETHING AND LEARN IT OURSELVES.
- Explain the nuances, such as if a building is being placed, then here in the script it is indicated that the coordinates are above or in the Dungeon. That here in the script it is written that the message is displayed before the script's action, or if it is written this way, then after. BELIEVE ME, ONE LESSON OF PRACTICE IS BETTER THAN 100 HOURS OF THEORY.

In the future, I wanted to ask a couple more questions, and they are not related to this question. For example, how to make it so that at the beginning of each month, a script moves the strongest hero of each player to a specific location. But I'm already afraid of the pile of links that I will be given. Probably, after reading them, I will no longer want to create a map, but to develop artificial intelligence...
User Avatar
Auto-translated
Of course, you want to know "what to press to make everything work," but please show some respect to those who are helping you. Manuals are written precisely so that we don't have to explain the same thing to every new script writer. And yes, simple tasks like "simply displaying a message" can evolve into increasingly larger specifications.

And Jack_of_shadows has already written everything you need; you're just too lazy to figure it out. Here's an example:
function MyMobHandler(hero, obj)
if hero == "hero name" then -- So that the script only works for the main hero. If it should work for everyone, remove this
MessageBox("Path/To/Text/file.txt", "MyMobHandlerCallback('"..obj.."')")
end
end

function MyMobHandlerCallback(obj)
Trigger(OBJECT_TOUCH_TRIGGER, obj, nil)
RemoveObject(obj)
-- CreateDwelling("dwell", TOWN_HEAVEN, 3, PLAYER_1 115, 115, GROUND)
-- You can't create an arbitrary building with a script, only a dwelling
end

SetObjectEnabled("MobName", nil)
Trigger(OBJECT_TOUCH_TRIGGER, 'MobName', 'MyMobHandler')
С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________
Auto-translated
How do I set up a Prophet's Hut so that I can take and complete the same quest multiple times? I set it to "Bring creatures." The reward gives other creatures. I take the quest, deliver the required creatures, receive the reward, and the quest is completed. But I can't take the quest again, even though I've set "Quest.CanUncomplete" to "true" in the hut's settings. What am I doing wrong?

Also, if I assign the same group to both a Portal of Water and an Underground Passage, will they conflict?

Statistics

Welcome our newest member: Emil