Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 5 - Modders Workshop > Thread: Undocumented scripting functions
Thread: Undocumented scripting functions This thread is 2 pages long: 1 2 · «PREV
lotihoti
lotihoti


Famous Hero
posted April 26, 2015 02:50 PM

Ok then... If they dont need to be red - here are functions which i found and didnt got a note:

1. showHighlighting
2. addUnit
3. removeUnit
4. RemoveAllUnits
5. UnitCastGlobalSpell
6. GetUnitType
7. combatSetPause
8. combatReadyPerson
9. commandDoSpell
10. commandDoSpecial
11. commandShot
12. commandMoveAttack
13. SummonCreature
14. GiveTurnToNextPlayers

I am not sure if this are functions or not - i found them between functions - but they dont turn red.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
magnomagus
magnomagus


Honorable
Legendary Hero
modding wizard
posted April 26, 2015 03:52 PM

Those are mostly combat scripts i think, some were in frostymuads post above yours.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
frostymuaddib
frostymuaddib


Promising
Supreme Hero
育碧是白痴
posted April 26, 2015 09:47 PM

lotihoti said:

It is possible that they are variables or ids like "PLAYER_1".



Those ids, such as PLAYER_1, are defined in common.lua, I think. They are just simple constants (e.g. PLAYER_1 = 0)

I'll probably test the new functions that you found, as soon as I get my H5 to run. I'm having some issues with it.
____________
"Occam's shuriken: when the answer is elusive, never rule out ninjas." -- Dr. Gordon Freeman (Freeman's Mind)
"lol" -- VERRIKER VON ERWINSSEN

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Funnyach
Funnyach

Tavern Dweller
posted May 10, 2015 11:34 PM

Nice work dude!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
lotihoti
lotihoti


Famous Hero
posted June 08, 2015 06:18 PM

Soooo... Trying something right now and i dont know the syntax and so but i found this functions and saw that the game at least knows the commands... I event dont know if they are intresting or not.

Function that i discovered:
1. Finish()
2. SetControlMode()
3. CombatEnableFinish()
4. CombatRemovaAllUnits()
5. CombatSetPause()
6. GetArtifactSetItemsCount()
7. ReplaceDwelling()
8. RemoveHeroCreatures()

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
magnomagus
magnomagus


Honorable
Legendary Hero
modding wizard
posted June 08, 2015 06:38 PM

I appreciate your work, but you should check your discoveries with the manual, because most of those were already in the manual.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
lotihoti
lotihoti


Famous Hero
posted June 08, 2015 06:45 PM
Edited by lotihoti at 18:46, 08 Jun 2015.

Hmmm i checked them and found only 1 so far oO

Edit: OK found 3 of 8

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
zmudziak22
zmudziak22


Famous Hero
posted June 23, 2015 12:01 PM

Is there any function about town conversion to player race?

For Example on map is 1 Inferno and 3 Havens. Script could convert castles as long as each player have equal number of castles.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
lotihoti
lotihoti


Famous Hero
posted June 23, 2015 01:23 PM

Look in: EditorDocumentation, Functions. There is a function called: ConvertTown();. This should solve your Problem.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
magnomagus
magnomagus


Honorable
Legendary Hero
modding wizard
posted July 07, 2016 07:12 PM
Edited by magnomagus at 19:15, 07 Jul 2016.

This is very important scripting information regarding version 3.1 that was deeply buried on celestialheavens, I post it here because it must have a backup on HC.

-----------------------------------------------------------------------
Changed scripting functions: (most of the content in this part DOES NOT work for exe files based on Quantomas AI)

+ Added another parameter to SetObjectPosition() function, works for heroes only, defines type of teleportation effect (-1 = default, 0 - no effect, 1 - warp, 2 - teleport, 3 - dimension door, 4 - town portal)

+ Added another parameter to AddHeroCreatures(), RemoveHeroCreatures(), AddObjectCreatures(), RemoveObjectCreatures() functions, defines slot number to which the creatures should be placed (if possible). This way you can add several stacks of the same creatures.

+ New triggers: HERO_ADD_SKILL_TRIGGER, HERO_REMOVE_SKILL_TRIGGER, parameters for event handlers: heroName, skill, mastery

+ New trigger: HERO_TOUCH_TRIGGER (works as OBJECT_TOUCH_HERO, applies to heroes only, and hero must be disabled with SetObjectEnabled() function)

New functions:

+ floor(n) - round towards 0: floor(1.75)=1, floor(-3.7)=-3
+ ceil(n) - round away from 0: ceil(2.25) = 3, ceil(-7.1) = 8
+ intg(n) - round to nearest integer
+ frac(n) - returns fractional part of a number: frac(1.23)= 0.23
+ round(n) - returns integer part of a number round(1.23)=1

+ GetPlayerRace( playerId ) - Get player race
+ IsAIPlayer( playerId ) - returns 1 if plaer is AI, 0 otherwise.
+ GetPlayerTeam( playerId ) - Returns team number
+ GetPlayerNecroEnergy( playerId ) - returns amount of dark energy player has (for necros)

+ GetObjectArmySlotCreature( objName, slotIndex ) - returns type and number of creatures in the given slot slotIndex of object objName
+ GetTownRace( townName ) - self-explanatory
+ GiveHeroBattleBonus( heroName, bonusType, amount ) - Gives a hero battle bonus for the next bttle (bonus types are defined in advmap-startup.lua)

+ WarpToMap( mapdbid, playerId = -1 ) - loads map mapdbid where the player will play for playerId (single player only). You can create non-linear campaigns this way.

+ WarpHeroExp( heroName, exp ) - sets hero's experience to given amount. Doesn't affect skills, parameters, etc.

+ TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
- Message box with up to 5 answers. Example:
s = 'Text/Chest/Choose.txt'
TalkBoxForPlayers( PLAYERFLT_1, nil,s, s,s, 'test1', 0, s,s, 0, s,s,s )

-----------------------------------------------------------------
Corrections to documentation: (most of the content in this part DOES work for exe files based on Quantomas AI)

GetHeroCount( playerID )

SetPlayerResource( playerID, resourceKindID, quantity, hero="" ) - added another parameter, shows flying icon with resource delta (as if this hero picked up resource pile)

DeployReserveHero( hero, x, y, floor=0, rot=0 ) - now you can set rotation of deployed hero (in degrees)

HasHeroArtefact & GetHeroArtifactsCount - comment to onlyEquipped incorrect. Should read: 0 - count all (default), 1 - equipped only.

GiveArtifact/GiveArtefacy, bindToHero - comment incorrect. Should read: 0 - do not bind (default), 1 - bind to hero.

CreateMonster( monsterName, creatureID, creatureCount, x,y,floorID, moodID=1, courageID=2, rotation=0, doesNotGrow=0)
-Now you can set whether the monster should grow.

SetMonsterCourageAndMood( monsterName, playerID, courageID, moodID ) <-- correct parameters order: first courage then mood

GetObjectCreaturesTypes <-- returns not an array but 7 values (so-called tuple)
E.G.: t1,t2,t3,t4,t5,t6,t7 = GetObjectCreaturesTypes( "mine1" )
The same true for GetHeroCreaturesTypes

CreateStatic( scriptName, dataFile, x,y,floorID, rot=0, terrainAligned=-1, scalePercent=100 )
terrainAligned: -1=auto (as pre-patch), 0=disable, 1=force terrain align
scalePercent: 100=normal size

Win( playerID=-1 )
In multiplayer games (all kinds) can define the player who wins.
The same applies to:
WinTeam( teamID )
Loose( playerID=-1)

GetCurrentPlayer() - DO NOT USE this function in maps with support for Simultaneous Turns, use IsPlayerCurrent( playerID ) instead.

IsPlayerCurrent( playerID )
IsPlayerInGhostMode( playerID )
IsPlayerWaitingForTurn( playerID )
IsTeamCurrent( teamID )
- self-explanatory

SetAmbientLightForPlayers( playersFilter, floorID, lightName, fade=false, time=1 )
- For MP

MessageBoxForPlayers( playersFilter, msg, callback )
QuestionBoxForPlayers( playersFilter, msg, callbackYes, callbackNo )
- For MP

Play2DSound( soundName, asVoiceover=0 )

Play2DSoundForPlayers( playersFilter, soundName, asVoiceover=0 )
Play3DSoundForPlayers( playersFilter, soundName, x,y,floorID )

StartDialogSceneForPlayers( playersFilter, dialogDBID, callback="", save="" )
StartCutSceneForPlayers( playersFilter, cutSceneDBID, callback="", save="" )

-All self-explanatory

GetGameVar( name )
SetGameVar( name, value )

- Use this to get/set game variables. Values are written to a file assossiated with player profile. ALL MAPS AND CAMPAIGNS SHARE THE SAME FILE. Use long and descriptive names with prefixes to avoid accidental mess-up. Game vars can be used to transfer ANY info between campaign maps, for example.

BlockGame( playersFilter=0 )
UnblockGame( playersFilter=0 )
- parameter is only used in MP.

MoveCamera( x,y,floorID, zoom=50, pitch=1.57, yaw=0, noZoom=0, noRotate=0, noMotion=0 )
MoveCameraForPlayers( playersFilter, x,y,floorID, zoom=50, pitch=1.57, yaw=0, noZoom=0, noRotate=0, noMotion=0 )
-self-explanatory

DisableCameraFollowHeroesForPlayers( playersFilter, disableOwn, disableAlly, disableEnemy )
-self-explanatory

ExitGame()
Instantly exits game.

PlayVisualEffect( effectName, objectName="", tag="", x=0,y=0,z=0, rot=0, floorID=0, playersFilter=0 )
- for MP, can now define whom to show

SetAIHeroFleeControl( hero, uniqueControl )
if uniqueControl=1, this hero is unaffected by global flee control rules (has its own)

GetLastSavedCombatIndex()
GetSavedCombatResult( index )
GetSavedCombatArmyPlayer( index, winner )
GetSavedCombatArmyHero( index, winner )
GetSavedCombatArmyCreaturesCount( index, winner )
GetSavedCombatArmyCreatureInfo( index, winner, creatureIndex ) => returns creatureID, countTotal, countDied

IsPlayerLost( playerID ) -self-explanatory

CanShowToPlayer( playerID ) - is it possible to show a message box ( msgbox/qbox/talkbox) to a player (if he will see it). Important for MP. Use in cycles with sleep, like this:

while not CanShowToPlayer( PLAYER_1 ) do
sleep(10)
end;
MessageBox(....)

GetTurnTimeLeft( playerID ) - how much time is left for player (remember time in combats is partially compensated for players in MP games)

GetSoundTimeInSleeps( soundName ) - returns sound's length in sleeps, not in seconds.

New combat functions:
GetRagePoints( unitName )
GetRageLevel( unitName )
-self-explanatory
____________
MMH5.5 Downloads | MMH5.5 Translations | MMH5.5 FAQ

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
mctronic
mctronic


Hired Hero
posted April 10, 2018 02:51 AM
Edited by mctronic at 02:52, 10 Apr 2018.

Did some tests with the function CreateTreasure.

CreateTreasure(Script Name, Treasure Type, Qty, x-coord, y-coord, floorID, rot=0)



 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
frostymuaddib
frostymuaddib


Promising
Supreme Hero
育碧是白痴
posted April 20, 2018 10:41 PM

CreateTreasure(ScriptName, type, Qty, x, y, floorID, rot)

Creates treasure with type type, with quantity Qty and script name ScriptName, on the location (x,y,floorID) with rotation rot. If the location is occupied, treasure is created on nearby tile.

ScriptName - script name of the created treasure, so it can be later used in scripts

type

0 - crystal
1 - gem
2 - gold
3 - mercury
4 - ore
5 - sulfur
6 - wood
7 - UNKNOWN
8 - campfire
9 - treasure chest
10 - sea chest
11 - floatsome
12 - UNKNOWN
13 - shipwrecked peasant

Note: If function is called with two values marked with UNKNOWN, nothing will be created, but following calls to the function with same coordinates will behave like there is something on the tile (even if it is passable).

Qty - quantity of the created resources. Quantity of gold is multiplied with 100. I didn't notice this argument influencing campfire, sea chest, floatsome and shipwrecked peasant. As for treasure chest, it acts as following:
0 - artifact
n (where n>0) - (n+1)*500 gold or n*500 exp
____________
"Occam's shuriken: when the answer is elusive, never rule out ninjas." -- Dr. Gordon Freeman (Freeman's Mind)
"lol" -- VERRIKER VON ERWINSSEN

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · «PREV
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0669 seconds