Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
12 years ago
Auto-translated
Ah, yes, of course, it was blocked. By the way, I'm also interested in portals, as well as exits from dungeons.
In reply to RedHeavenHero
User Avatar
12 years ago
Auto-translated
RedHeavenHero
Copypasted from a fan manual.<col width="41" style="width: 31pt; mso-width-source: userset; mso-width-alt: 1450;"> <col width="249" style="width: 187pt; mso-width-source: userset; mso-width-alt: 8846;"> <col width="177" style="width: 133pt; mso-width-source: userset; mso-width-alt: 6286;"> <col width="518" style="width: 389pt; mso-width-source: userset; mso-width-alt: 18432;">
func TalkBoxForPlayers Opens a dialog with several response options (from 1 to 5) for selected players (playersFilter).
The function does not issue error messages because if parameters are incorrect, default values are used
playersFilter PlayersFilteringConstantsID Identifier of selected players
iconRef Reference to the icon texture
iconTooltipRef Path to the icon tooltip text
textRef Path to the dialog text
addTextRef Path to the dialog text (additional)
callback String with the name of a lua function, through whose first parameter the player's response is reported (number: 0 - cancel, -1 - closed by player, 1.. - number of the response selected by the player)
mode Mode type: 0 - with OK button, 1 - OK/Close
titleTextRef Path to the window title text
selectTextRef Path to the header text before selection options
defaultOption Number of the response highlighted by default (number: 0 - none, 1.. - response number)
optionTextRef path to response text № 1
[ optionTextRef] Path to response text № ...
[Response number]


Added after 3 minutes
The player who answered the question and the response number (responses 1-5, non-natural values indicate that the window was closed) are passed to the function with the name provided as the callback parameter.

thx, but I don't quite understand all the components of the function. I need a clear example. I need to ask the player a question with 4 response options, and they must choose one of them
User Avatar
12 years ago
Auto-translated
And yet, another question: is it possible to find out the name of a unit, rather than its unique ID? For example, Archdevils, Angels, etc.
User Avatar
12 years ago
Auto-translated
Do you need the name in a string or a link to a file with that name?
User Avatar
12 years ago
Auto-translated
I need a name so I can display it in FlySign.

Added 25 minutes later
The name should be in a string. However, I can also create a bunch of .txt files, of course.
User Avatar
12 years ago
Auto-translated
They have already been created. Soon I will post a correspondence table of IDs and files.

Added after 17 minutes
CreaturesNames = {
'/Text/Game/Creatures/Haven/Peasant.txt',
'/Text/Game/Creatures/Haven/Militiaman.txt',
'/Text/Game/Creatures/Haven/Archer.txt',
'/Text/Game/Creatures/Haven/Marksman.txt',
'/Text/Game/Creatures/Haven/Footman.txt',
'/Text/Game/Creatures/Haven/Swordsman.txt',
'/Text/Game/Creatures/Haven/Griffin.txt',
'/Text/Game/Creatures/Haven/RoyalGriffin.txt',
'/Text/Game/Creatures/Haven/Priest.txt',
'/Text/Game/Creatures/Haven/Cleric.txt',
'/Text/Game/Creatures/Haven/Cavalier.txt',
'/Text/Game/Creatures/Haven/Paladin.txt',
'/Text/Game/Creatures/Haven/Angel.txt',
'/Text/Game/Creatures/Haven/Archangel.txt',
'/Text/Game/Creatures/Inferno/Familiar.txt',
'/Text/Game/Creatures/Inferno/Imp.txt',
'/Text/Game/Creatures/Inferno/Demon.txt',
'/Text/Game/Creatures/Inferno/HornedDemon.txt',
'/Text/Game/Creatures/Inferno/HellHound.txt',
'/Text/Game/Creatures/Inferno/Cerberi.txt',
'/Text/Game/Creatures/Inferno/Succubus.txt',
'/Text/Game/Creatures/Inferno/InfernalSuccubus.txt',
'/Text/Game/Creatures/Inferno/Nightmare.txt',
'/Text/Game/Creatures/Inferno/FrightfulNightmare.txt',
'/Text/Game/Creatures/Inferno/PitFiend.txt',
'/Text/Game/Creatures/Inferno/Balor.txt',
'/Text/Game/Creatures/Inferno/Devil.txt',
'/Text/Game/Creatures/Inferno/ArchDevil.txt',
'/Text/Game/Creatures/Necropolis/Skeleton.txt',
'/Text/Game/Creatures/Necropolis/Skeleton_Archer.txt',
'/Text/Game/Creatures/Necropolis/Walking_Dead.txt',
'/Text/Game/Creatures/Necropolis/Zombie.txt',
'/Text/Game/Creatures/Necropolis/Manes.txt',
'/Text/Game/Creatures/Necropolis/Ghosts.txt',
'/Text/Game/Creatures/Necropolis/Vampire.txt',
'/Text/Game/Creatures/Necropolis/Vampire_Lord.txt',
'/Text/Game/Creatures/Necropolis/Lich.txt',
'/Text/Game/Creatures/Necropolis/Demilich.txt',
'/Text/Game/Creatures/Necropolis/Wight.txt',
'/Text/Game/Creatures/Necropolis/Wraith.txt',
'/Text/Game/Creatures/Necropolis/Bone_Dragon.txt',
'/Text/Game/Creatures/Necropolis/Shadow_Dragon.txt',
'/Text/Game/Creatures/Preserve/Pixie.txt',
'/Text/Game/Creatures/Preserve/Sprite.txt',
'/Text/Game/Creatures/Preserve/Blade_Juggler.txt',
'/Text/Game/Creatures/Preserve/War_Dancer.txt',
'/Text/Game/Creatures/Preserve/Wood_Elf.txt',
'/Text/Game/Creatures/Preserve/Grand_Elf.txt',
'/Text/Game/Creatures/Preserve/Druid.txt',
'/Text/Game/Creatures/Preserve/Druid_Elder.txt',
'/Text/Game/Creatures/Preserve/Unicorn.txt',
'/Text/Game/Creatures/Preserve/War_Unicorn.txt',
'/Text/Game/Creatures/Preserve/Treant.txt',
'/Text/Game/Creatures/Preserve/Treant_Guardian.txt',
'/Text/Game/Creatures/Preserve/Green_Dragon.txt',
'/Text/Game/Creatures/Preserve/Gold_Dragon.txt',
'/Text/Game/Creatures/Academy/Gremlin.txt',
'/Text/Game/Creatures/Academy/Master_Gremlin.txt',
'/Text/Game/Creatures/Academy/Stone_Gargoyle.txt',
'/Text/Game/Creatures/Academy/Obsidian_Gargoyle.txt',
'/Text/Game/Creatures/Academy/Iron_Golem.txt',
'/Text/Game/Creatures/Academy/Steel_Golem.txt',
'/Text/Game/Creatures/Academy/Magi.txt',
'/Text/Game/Creatures/Academy/Arch_Magi.txt',
'/Text/Game/Creatures/Academy/Genie.txt',
'/Text/Game/Creatures/Academy/Master_Genie.txt',
'/Text/Game/Creatures/Academy/Rakshasa.txt',
'/Text/Game/Creatures/Academy/Rakshasa_Rukh.txt',
'/Text/Game/Creatures/Academy/Giant.txt',
'/Text/Game/Creatures/Academy/Titan.txt',
'/Text/Game/Creatures/Dungeon/Scout.txt',
'/Text/Game/Creatures/Dungeon/Assasin.txt',
'/Text/Game/Creatures/Dungeon/Witch.txt',
'/Text/Game/Creatures/Dungeon/Blood_Witch.txt',
'/Text/Game/Creatures/Dungeon/Minotaur.txt',
'/Text/Game/Creatures/Dungeon/Minotaur_King.txt',
'/Text/Game/Creatures/Dungeon/Rider.txt',
'/Text/Game/Creatures/Dungeon/Ravager.txt',
'/Text/Game/Creatures/Dungeon/Hydra.txt',
'/Text/Game/Creatures/Dungeon/Chaos_Hydra.txt',
'/Text/Game/Creatures/Dungeon/Matron.txt',
'/Text/Game/Creatures/Dungeon/Matriarch.txt',
'/Text/Game/Creatures/Dungeon/Deep_Dragon.txt',
'/Text/Game/Creatures/Dungeon/Black_Dragon.txt',
'/Text/Game/Creatures/Neutrals/Fire_Elemental.txt',
'/Text/Game/Creatures/Neutrals/Water_Elemental.txt',
'/Text/Game/Creatures/Neutrals/Earth_Elemental.txt',
'/Text/Game/Creatures/Neutrals/Air_Elemental.txt',
'/Text/Game/Creatures/Neutrals/Black_Knight.txt',
'/Text/Game/Creatures/Neutrals/Death_Knight.txt',
'/Text/Game/Creatures/Neutrals/Phoenix.txt',
'/Text/Game/Creatures/Dwarf/Defender.txt',
'/Text/Game/Creatures/Dwarf/Stout_Defender.txt',
'/Text/Game/Creatures/Dwarf/Axe_Fighter.txt',
'/Text/Game/Creatures/Dwarf/Axe_Thrower.txt',
'/Text/Game/Creatures/Dwarf/Bear_Raider.txt',
'/Text/Game/Creatures/Dwarf/Blackbear_Raider.txt',
'/Text/Game/Creatures/Dwarf/Brawler.txt',
'/Text/Game/Creatures/Dwarf/Berserker.txt',
'/Text/Game/Creatures/Dwarf/Rune_Mage.txt',
'/Text/Game/Creatures/Dwarf/Flame_Mage.txt',
'/Text/Game/Creatures/Dwarf/Thane.txt',
'/Text/Game/Creatures/Dwarf/Warlord.txt',
'/Text/Game/Creatures/Dwarf/Fire_Dragon.txt',
'/Text/Game/Creatures/Dwarf/Magma_Dragon.txt',
'/Text/Game/Creatures/Haven/Landlord.txt',
'/Text/Game/Creatures/Haven/Longbowman.txt',
'/Text/Game/Creatures/Haven/Vindicator.txt',
'/Text/Game/Creatures/Haven/BattleGriffin.txt',
'/Text/Game/Creatures/Haven/Zealot.txt',
'/Text/Game/Creatures/Haven/Champion.txt',
'/Text/Game/Creatures/Haven/Seraph.txt',
'/Text/Game/Creatures/Neutrals/Wolf/name.txt',
'/Text/Game/Creatures/Neutrals/SnowApe/name.txt',
'/Text/Game/Creatures/Neutrals/Manticore/name.txt',
'/Text/Game/Creatures/Neutrals/Mummy/name.txt',
'/Text/Game/Creatures/Orcs/Goblin1.txt',
'/Text/Game/Creatures/Orcs/Goblin2.txt',
'/Text/Game/Creatures/Orcs/Centaur1.txt',
'/Text/Game/Creatures/Orcs/Centaur2.txt',
'/Text/Game/Creatures/Orcs/Orc1.txt',
'/Text/Game/Creatures/Orcs/Orc2.txt',
'/Text/Game/Creatures/Orcs/Shaman1.txt',
'/Text/Game/Creatures/Orcs/Shaman2.txt',
'/Text/Game/Creatures/Orcs/OrcChief1.txt',
'/Text/Game/Creatures/Orcs/OrcChief2.txt',
'/Text/Game/Creatures/Orcs/Wyvern1.txt',
'/Text/Game/Creatures/Orcs/Wyvern2.txt',
'/Text/Game/Creatures/Orcs/Cyclop1.txt',
'/Text/Game/Creatures/Orcs/Cyclop2.txt',
'/Text/Game/Creatures/Inferno/3rd/Quasit_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/HornedLeaper_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/FirebreatherHound_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/SuccubusSeducer_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/Hellmare_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/PitSpawn_Name.txt',
'/Text/Game/Creatures/Inferno/3rd/ArchDemon_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/Stalker_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/BloodWitch2_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/MinotaurCaptain_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/BlackRider_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/AcidicHydra_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/ShadowMistress_Name.txt',
'/Text/Game/Creatures/Dungeon/3rd/RedDragon_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/Dryad_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/BladeSinger_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/SharpShooter_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/HighDruid_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/WhiteUnicorn_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/AngerTreant_Name.txt',
'/Text/Game/Creatures/Preserve/3rd/RainbowDragon_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/SkeletonWarrior_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/DiseaseZombie_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/Poltergeist_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/Nosferatu_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/LichMaster_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/Banshee_Name.txt',
'/Text/Game/Creatures/Necropolis/3rd/HorrorDragon_Name.txt',
'/Text/Game/Creatures/Academy/3rd/GremlinSaboteur_Name.txt',
'/Text/Game/Creatures/Academy/3rd/MarbleGargoyle_Name.txt',
'/Text/Game/Creatures/Academy/3rd/ObsidianGolem_Name.txt',
'/Text/Game/Creatures/Academy/3rd/CombatMage_Name.txt',
'/Text/Game/Creatures/Academy/3rd/DjinnVizier_Name.txt',
'/Text/Game/Creatures/Academy/3rd/RakshasaKshatri_Name.txt',
'/Text/Game/Creatures/Academy/3rd/StormLord_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/StoneDefender_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/Harpooner_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/WhiteBearRider_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/BattleRager_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/FlameKeeper_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/ThunderThane_Name.txt',
'/Text/Game/Creatures/Dwarf/3rd/LavaDragon_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/GoblinDefiler_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/CentaurMaradeur_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/OrcWarmonger_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/ShamanHag_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/OrcchiefChieftain_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/WyvernPaokai_Name.txt',
'/Text/Game/Creatures/Orcs/3rd/CyclopBloodeyed_Name.txt',
}
User Avatar
12 years ago
Auto-translated
Okay, I understand. I'll try it now and let you know if it works.

Added 54 minutes later
Is a comma before the end of the loop mandatory?

Added 43 minutes later
And one more question:

I have an array, for example, a = {1, 2, 3} I have variables, for example, a1 = 0 and b1 = 0 But when I try to do this: b1 = a[a1], it doesn't work, even though the value should be a number. How can I do this?

a = {1,2,3}
a1 = 0
b1 = 0
b1 = a[a1] --error
User Avatar
12 years ago
Auto-translated
A comma at the end is optional.
Because there is no element with a zero index in this array, only 1, 2, 3, and they correspond to the elements 1, 2, 3.

Added 6 minutes later
By the way, it was also not necessary to equate b1 to zero.
User Avatar
12 years ago
Auto-translated
aaa... and how do I set, for example, element 0 to be equal to the number 1, element 1 to be equal to the number 5, and so on?
User Avatar
12 years ago
Auto-translated
Arrays that start with 0 are usually not used, or they are created like this: `
table = {[0]=1; 5, 4, 3, 8}
`
User Avatar
12 years ago
Auto-translated
and if I call a[a1], will it display 1, and if a[a1+1], will it display 5? or can I simply write the array a = {0, 1, 2, 3, 4}, but start checking the cells from the first one, so it will display the number 1?
User Avatar
12 years ago
Auto-translated
1) yes.
2) It will be 0, because it is the first.
User Avatar
12 years ago
Auto-translated
Yeah, I figured that out. I was confused because if you access the hero's name through an array, the first hero in the player's list will be at index zero...

Now, I have one last question, as I've already done everything else:
-Basically, I can display a message with the name of a .txt creature. But how can I convert this name into a regular variable? Is that even possible? So that I can display a message like: has been added, !
In reply to Heroist
User Avatar
12 years ago
Auto-translated
ShowFlyingSign({"path to the main text"; creatures=value from the table, number=something}, other arguments)
User Avatar
12 years ago
Auto-translated
so, will it convert that value within the quotes from the table into a regular text label? I wrote it like that at first, but then I didn't bother checking)

Added 1 minute ago
--ShowFlyingSign({GetMapDataPath().."test.txt"; trues=CreaturesNames[gg1], trues2=retro2, trues3=retro3}, "Nymus", -1, 7);

Statistics

Welcome our newest member: recijeb