Skip to content

Posts from Scripts

4.8 (8 ratings)
Auto-translated
No matter what our math teacher says, you can also walk home through the covered market. A system of QuestionBox prompts could ask the player which faction they are playing as, and then display: ShowFlyingSign(spTXT, sObjectName, nPlayerID, nTimeSec) Displays the message spTXT to player nPlayerID, which flies away from object sObjectName for nTimeSec. Ideally, you could also use something like: if GetObjectOwner('starting_city_of_player') == PLAYER_1 then elseif GetObjectOwner('starting_city_of_the_second_player') == PLAYER_2 then and so on. I don't know any other ways, maybe more experienced mapmakers know. Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
Is it possible to make monsters move around on the map? For example, could a peasant walk back and forth along a road?
Auto-translated
Hmm, I'm not sure. You could attach an animation to his walking, but moving him... I only know SetObjectPosition, but that's definitely not what you need. Best regards.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война
In reply to djulian13
User Avatar
Auto-translated
djulian13
No matter what our math teacher says, you can also walk home through the covered market.
...
Sincerely.
Firstly, it makes more sense to apply GetObjectOwner to a hero. Secondly, the ability to display a message for a specific player definitely exists in at least version 3.1, although I can't remember exactly how to do it right now.
 

К А
Стикеры GBF в Telegram
In reply to djulian13
User Avatar
Auto-translated
djulian13
Hmm. I'm not sure. You could attach a walking animation to him, but moving him... I only know SetObjectPosition, but that's definitely not what you need.
Best regards.
Yeah, that's not it. So, during the movement animation, he'll just be moving his legs?
In reply to Олегарх
Auto-translated
Oligarch
Is it possible to make monsters move on the map? For example, a peasant walking back and forth on a road?
Yes, it is possible.
1 - Play the animation of the monster's movement.
or
2 - Turn the monster into a hero (by replacing the model and animation with a monster's).
User Avatar
Auto-translated
There are some nuances regarding movement. The thing is, a monster with this animation won't simply walk back and forth; instead, it will run forward, teleport backward, and then run forward again. So, it needs to be turned around after each cycle.
 

К А
Стикеры GBF в Telegram
In reply to Iron Wolf
User Avatar
Auto-translated
Iron Wolf
Guys, please tell me, I added a message box to a multiplayer map that appears when interacting with an object, but when player 1 interacts with the object and receives the message box, all other players see the same message box on their next turn. Is it possible to make it so that only the hero who interacted with the object sees the message box, while any player can interact with the object and see the message box?
djulian13
No matter what our math teacher says, you can also go home through the covered market.
A system of QuestionBox-es asking the player which faction they are playing as would allow for:
ShowFlyingSign( spTXT, sObjectName, nPlayerID, nTimeSec)
Displays the message spTXT to player nPlayerID, flying away from object sObjectName within nTimeSec.
Ideally, you could also use something like if GetObjectOwner('player_starting_city') == PLAYER_1 then
elseif GetObjectOwner('second_player_starting_city') == PLAYER_2 then
and so on.
I don't know how else – maybe more experienced map makers know.
Sincerely.
Here is one of my posts to help you. For future reference: use search ;) Here
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
Auto-translated
Please help.
1. How can I make a leveled-up hero with an army stay in a town and not leave?
2. How can I make a hero appear from a portal with an army after a certain action and attack a town, and when he is killed, after some time, another hero appears from the portal and so on?

Thank you in advance!
In reply to Ment
User Avatar
Auto-translated
Ment
There are some nuances regarding movement. The thing is, a monster with this animation won't walk back and forth, but rather run forward, teleport backward, and run forward again. So, it needs to be somehow turned around after each cycle.
And how does such a script look in general?
User Avatar
Auto-translated
1. You select a town, switch to the Garrison tab, place your army, and in the GarrisonHero tab, place the garrison hero. In the script, you write:
EnableHeroAI('hero name', nil);
2. You need to set a trigger for this action. Something like this:
function func(parameter)
SetObjectPosition('enemy hero name for teleportation', coordinates);
MoveHeroRealTime('this hero', town coordinates);
Trigger(action code, additional parameters, nil);
Trigger(same, but for a duration);
end;
Trigger(action code, additional parameters, func);

I can elaborate further if you provide more details about the goal.
---------
How does such a script look in general?
PlayObjectAnimation('monster name', 'move', IDLE);
If it involves rotations, there might be problems... The issue now lies with SetObjectPosition; it theoretically can rotate, but as I clarified, changing the teleportation effect (which we need to eliminate!) only works in 3.1 and only applies to heroes, so I'm not even sure.
 

К А
Стикеры GBF в Telegram
In reply to Ment
Auto-translated
1. I think I did everything correctly, but it still comes out and attacks me. 2. And regarding the second point, i.e. For example, in Heroes V, in the last mission for Isabel, demons appeared from a portal during a certain period of time and attacked the city.
In reply to Ment
User Avatar
Auto-translated
Ment
PlayObjectAnimation('monster name','move',IDLE);
If rotations are involved, there are problems... The issue now lies with SetObjectPosition; theoretically, it can rotate, but as I clarified, changing the teleportation effect (which we need to disable!) only works in version 3.1 and only applies to heroes, so I'm not even sure.

Does PlayObjectAnimation move the object by a random distance?
In reply to Ment
Auto-translated
Movement
There are some nuances regarding movement. The thing is that a monster with such an animation won't walk back and forth, but rather run forward, teleport backward, and run forward again. So, it needs to be somehow turned around after each cycle.

Perhaps there's a more elegant solution (without turning around) – this can be done with the help of 2 peasants running towards each other (but with a time delay) – then the player will have the illusion that it's the same character running back and forth (although in reality, they are two identical twins).
Auto-translated
Regarding hero respawning.
It's done using MoveHero and a new day trigger.
function Respawn()
if GetDate(DAY) == 5 then
MoveHero(function parameters, see the manual)
elseif GetDate(DAY) == 5 then
MoveHero()
and the cycle continues
end;
end;
Trigger(NEW_DAY_TRIGGER, 'Respawn')
Dyrman, thank you!
Oligarch, no, he stays in place and moves.
Sincerely.
Мои карты:
SinglePlayer: Выбор Зехира
Падение Стедвика(pre-release)
Готовится: Зима Титанов, Столетняя война

Statistics

Welcome our newest member: Emil