Skip to content

Posts from Scripts

4.8 (8 ratings)
In reply to IchGViji
Auto-translated
IchGViji


Shiroyasha2910, regarding combat scripts, there is an excellent guide from the respected }{0TT@6bI4: combat scripts - guide
And regarding your idea, I haven't done anything like that myself yet, but as I see it, you should try using the HasHeroSkill() function, and save the result in a variable using the SetGameVar() function, and then retrieve it in the combat script file using GetGameVar(). There might be another way, but this seems to be the most obvious one.

Thank you for the guide.
In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910
Good evening. I'm trying to figure out combat scripts, but so far without success. I saw someone here mention that there's a guide to combat scripts; could someone provide a link to it? Because I couldn't find it.
Is it also possible for someone to help create the necessary script? If it's possible, of course. The idea is this: when a battle starts and the hero has the "Ash's Blessing" skill, 3 archangels appear on the battlefield.

First, the guide is in the message from IchGViji).

Second, something like that is probably possible, but in terms of the story, it seems wrong to me. The Angel Protector is Elrath, not Ash. And 3 archangels at the beginning is a bit too much.

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

Auto-translated

Good evening. I renamed the objects using a standard script. However, for some reason, not all objects were renamed; in x = 2, absolutely everything was renamed. In x = 1, 3, and 4, only some objects were renamed.

I thought that maybe there are duplicate object names somewhere, but no, the names are unique. What else could be causing this problem?

for i = 118,132 do -- reinforcement in the dungeon (first)
for x = 1,4 do

OverrideObjectTooltipNameAndDescription('PortalP'..x..'_'..i,"Maps/Multiplayer/JoyPatriot/Teks/Portal/ReinforcementsName.txt",
"Maps/Multiplayer/JoyPatriot/Teks/Portal/ReinforcementsBio.txt")
end
end
In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910

Good evening. I renamed the objects using a standard script. However, for some reason, not all objects were renamed; in x = 2, absolutely everything was renamed. In x = 1, 3, and 4, only some objects were renamed.

I thought that maybe there are duplicate object names somewhere, but no, the names are unique. What else could be causing this problem?

for i = 118,132 do -- reinforcement in the Dungeon (first)
for x = 1,4 do

OverrideObjectTooltipNameAndDescription('PortalP'. .x..'_'..i,"Maps/Multiplayer/JoyPatriot/Teks/Portal/ReinforcementsName.txt",
"Maps/Multiplayer/JoyPatriot/Teks/Portal/ReinforcementsBio.txt")
end
end
Does the console say anything?
Also, I recommend not hardcoding absolute paths to map files; it's better to use the GetMapDataPath() function. This will save you from having to rewrite all the paths if you decide to rename the map.

P.S. What objects are you renaming? If they are creatures, try using the SetMonsterNames() function

Сценарии:
"Холм мертвецов"
"Священное древо"
In reply to IchGViji
Auto-translated

IchGViji

Doesn't the console say anything?
Also, I recommend not specifying absolute paths to map files; it's better to use the GetMapDataPath() function. This will save you from having to rewrite all the paths if you decide to rename the map.

P.S. What objects are you renaming? If it's creatures, try the SetMonsterNames() function.

The console doesn't say anything about it.

In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910


The console doesn't output anything regarding this.


The OverrideObjectTooltipNameAndDescription function doesn't work with all object types; some of them cannot be renamed using it. For creatures, there is a separate function mentioned in the message above.
What types of objects do you want to rename: creatures, dwellings, or something else?

Сценарии:
"Холм мертвецов"
"Священное древо"
In reply to IchGViji
Auto-translated

IchGViji

The OverrideObjectTooltipNameAndDescription function doesn't work with all object types; some of them cannot be renamed using it. There is a separate function for creatures, as mentioned in the message above.
What types of objects do you want to rename: creatures, dwellings, or something else?

This is all for a one-way portal.

In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910

 

This is all for a one-way portal.

Interesting 🤔... In principle, for one-way portals, you can rewrite their names and descriptions. My only assumption so far is that the necessary objects are located somewhere else, and instead of them, there are ordinary portals (if you say that the console does not complain and absolutely all objects have different names, because 60 objects are renamed).

Сценарии:
"Холм мертвецов"
"Священное древо"
In reply to IchGViji
Auto-translated
IchGViji
Interesting 🤔... In principle, for one-way portals, you can rewrite their names and descriptions. My only assumption so far is that the necessary objects are located somewhere else, and instead of them, there are ordinary portals (if you say that the console doesn't complain and absolutely all objects have different names, because 60 objects are renamed).

Okay, let's assume that I'll review it again, maybe I missed something during the check.

Does anyone else know if it's possible to change the command for a hero using scripts? That is, there is a hero of player 2 on the map, he does something, and through a script, he becomes a hero of player 3. Is something like this possible? I haven't been able to find anything similar in the scripts yet.

In reply to Shiroyasha2910
User Avatar
Auto-translated
Shiroyasha2910

Okay, let's say I'll just review it again, maybe I missed something during the check.

Does anyone else know if it's possible to change a hero's allegiance using scripts? For example, there's a hero belonging to player 2 on the map, they do something, and a script changes their allegiance to player 3. Is something like that possible? I haven't been able to find anything like that in the scripts yet.

It's easy - SetObjectOwner(heroname, teamnumber)

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
Auto-translated
BlueHeavenHero
It's simple - SetObjectOwner(heroname, teamnumber)
Thank you, I completely forgot about that.
User Avatar
Auto-translated

Hello. I'm already racking my brain trying to figure out how SetHeroLootable and IsHeroLootable work.

I tried IsHeroLootable(“heroname”, nil)
I tried SetHeroLootable(“heroname”, nil)
SetHeroLootable(“heroname”, disable)
No matter what I do, the hero's artifacts are still being taken away.

Can you tell me what I'm doing wrong?

In reply to DevoRevo
User Avatar
Auto-translated
DevoRevo

Hello. I've already broken my head trying to figure out how SetHeroLootable and IsHeroLootable work.

I tried IsHeroLootable("heroname", nil)
I tried SetHeroLootable("heroname", nil)
SetHeroLootable("heroname", disable)
No matter what I do, the hero's artifacts are still being taken away.

Can you tell me what I'm doing wrong?

It's simple - if you want to prevent the hero's artifacts from being taken away, use SetHeroLootable("HeroName", nil).
If you want to perform a check, use IsHeroLootable("HeroName").

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

In reply to BlueHeavenHero
User Avatar
Auto-translated

BlueHeavenHero
It's simple – if you want to prevent artifacts from being taken from a hero, use SetHeroLootable("HeroName", nil).
If you want to implement a check, use IsHeroLootable("HeroName").

I tried SetHeroLootable, but it didn't work. I have two types of battles that are launched through a script, where the heroes have artifacts. One battle is launched through StartCombat, and the other is SiegeTown. In both cases, when I defeat the heroes, I receive their loot.

Maybe I need to write it in a separate function? Because I just put it in the general map code.

In reply to DevoRevo
User Avatar
Auto-translated
DevoRevo


I tried SetHeroLootable, but it didn't work. I have two types of battles that are launched through a script, where the heroes have artifacts. One battle is launched through StartCombat, and the other is SiegeTown. In both cases, when I defeat the heroes, I get their loot.

Maybe I need to write it in a separate function? Because I just put it in the general code of the map.

It's strange that it doesn't work. I have this function simply in the general code of the map, but from the very beginning.
Put this script at the very beginning of your code; maybe it will work.

Мои карты:
Падший рыцарь
Сердце Хаоса

Мои моды:
Визуальные:
Изменение внешнего вида героев-некромантов
Существа-жители и кое-что по мелочи в городах Ордена Порядка, Некрополиса и Инферно

NCF-существа:
Странствующие рыцари
Наемники

Statistics

Welcome our newest member: Emil