New scripting functions for 3.1 - the list
New scripting functions for 3.1 - the list
The guy from Nival said they did not document new functions. However, -he provided a list and encouraged mapmakers "to experiment!":
---------------------------------------
Here is the list of additional parameters for some existing functions:
+ added additional param to select teleport's effect in script command SetObjectPosition() (only applicable for heroes now, default param value is -1 ~ as if no param behaviour)
+ extended param for script commands: AddHeroCreatures, RemoveHeroCreatures, AddObjectCreatures, RemoveObjectCreatures (param name "desiredSlot", default value is -1)
+ added GetSoundTimeInSleeps() for combat scripts
+ voice-overs script functions (see game maps scripts)
+ added new script triggers types: HERO_ADD_SKILL_TRIGGER, HERO_REMOVE_SKILL_TRIGGER, function HeroGotSkill( heroName, skill, mastery ) print( "Hero ", heroName, " got skill #", skill, " at mastery level #", mastery ); end;
+ additional hero trigger (HERO_TOUCH_TRIGGER), only works for disabled heroes
--------------------------------------
Here is the list of new functions:
GetPlayerRace( player_id ), returns town type id (see advmap-startup.lua)
IsAIPlayer( player_id ), returns 0 if specified player is human, and 1 otherwise
type,count = GetObjectArmySlotCreature( objName, slotIndex );
GetPlayerTeam( playerID )
GetPlayerNecroEnergy( playerID )
WarpToMap( mapdbid, playerID = -1 )
WarpHeroExp( heroName, exp )
GiveHeroBattleBonus( heroName, bonusType, amount )
GetTownRace( townName )
TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
//
// iconRef: empty or non-existing for default icon
// iconTooltipRef: no tooltip if empty
// textRef: constructed texts supported
// addTextRef: constructed texts supported
// callback param values: 0 = cancelled, 1+ = option ID, (-1) = auto-closed (turn time limit exceed/etc.)
// modes: 0 = ok only (default), 1 = ok/cancel
// titleTextRef: plain text ref, non-string or empty/non-existing string to leave default
// selectTextRef: plain text ref, non-string or empty/non-existing string to leave default
// defaultOption: 0 = no default, 1+ = option ID
// optionTextRef: constructed texts supported
// ... up to 5 options supported (may be extended in future)
//
floor(n)
ceil(n)
intg(n)
frac(n)
round(n)
---------------------------
Apparently, some testing will be needed to find out what they do...
---------------------------------------
Here is the list of additional parameters for some existing functions:
+ added additional param to select teleport's effect in script command SetObjectPosition() (only applicable for heroes now, default param value is -1 ~ as if no param behaviour)
+ extended param for script commands: AddHeroCreatures, RemoveHeroCreatures, AddObjectCreatures, RemoveObjectCreatures (param name "desiredSlot", default value is -1)
+ added GetSoundTimeInSleeps() for combat scripts
+ voice-overs script functions (see game maps scripts)
+ added new script triggers types: HERO_ADD_SKILL_TRIGGER, HERO_REMOVE_SKILL_TRIGGER, function HeroGotSkill( heroName, skill, mastery ) print( "Hero ", heroName, " got skill #", skill, " at mastery level #", mastery ); end;
+ additional hero trigger (HERO_TOUCH_TRIGGER), only works for disabled heroes
--------------------------------------
Here is the list of new functions:
GetPlayerRace( player_id ), returns town type id (see advmap-startup.lua)
IsAIPlayer( player_id ), returns 0 if specified player is human, and 1 otherwise
type,count = GetObjectArmySlotCreature( objName, slotIndex );
GetPlayerTeam( playerID )
GetPlayerNecroEnergy( playerID )
WarpToMap( mapdbid, playerID = -1 )
WarpHeroExp( heroName, exp )
GiveHeroBattleBonus( heroName, bonusType, amount )
GetTownRace( townName )
TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
//
// iconRef: empty or non-existing for default icon
// iconTooltipRef: no tooltip if empty
// textRef: constructed texts supported
// addTextRef: constructed texts supported
// callback param values: 0 = cancelled, 1+ = option ID, (-1) = auto-closed (turn time limit exceed/etc.)
// modes: 0 = ok only (default), 1 = ok/cancel
// titleTextRef: plain text ref, non-string or empty/non-existing string to leave default
// selectTextRef: plain text ref, non-string or empty/non-existing string to leave default
// defaultOption: 0 = no default, 1+ = option ID
// optionTextRef: constructed texts supported
// ... up to 5 options supported (may be extended in future)
//
floor(n)
ceil(n)
intg(n)
frac(n)
round(n)
---------------------------
Apparently, some testing will be needed to find out what they do...
Originally they were posted on nival forum and ag.ru forum... Anyway, I suddenly realized I don't want to make a demo map. I've made some experiments, and here are some additional explanations and examples.
---------------------------------------
SetObjectPosition(obj,x,y,z,style)
Additional parameter (style) controls video effect of teleportation (as far as I could make it out, works only for heroes). Default value is -1.
style = -1,0 - Standard effect (astral gate)
= 1 - no effect, instant teleportation
= 2,3 - no effect plus a little delay (about 1 sleep)
= 4 - town portal effect
--------------------------------------------
TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
playersFilter - Whom the dialog will be shown to, use constants from advmap-startup.lua, like in MessageBoxForPlayers.
iconRef - a ref to dxb file pointing to a texture, Icon that will be shown in top left corner of dialog. If ='' or nil, big white square will be shown (very gay).
iconTooltipRef - ref to txt file with text that will appear when hovering mouse above icon.
textRef - text that would be shown beside icon. HOWEVER, it does not show. A BUG, probably. You may as well leave it empty (nil or '').
addTextRef - text that is shown below the buttons with options
callback - name of a function that will be envoked when player hits OK button.
titleTextRef - Caption text in the upper part of dialog (not mandatory)
selectTextRef - Text that will be shown above options (not mandatory)
optionTextRef - text for options. You must enter separate parameter for each option, up to 5 options possible.
Here is an example. I use Sphinx face as an icon.
function choiceisdone(playerid,answer)
--'playerid' holds id of player who sent the callback (as the talkbox could be shown to several players at once)
--'answer' holds option number. 1 for first option. 2 for second, etc. If player hit 'Cancel', answer will hold 0. If TalkBox timed out (in multiplayer games only), it will hold -1.
end;
path= GetMapDataPath();
TalkBoxForPlayers( PLAYERFLT_ALL, '/Textures/Interface/Sphinx/SphinxIcon.(Texture).xdb#xpointer(/Texture)', '', path..'maintext.txt', path..'addtext.txt', 'choiceisdone', 0, path..'captiontext.txt', path..'selecttext.txt', 0, path..'option1.txt', path..'option2.txt',path..'option3.txt')
-------------------------------
Other functions have selfexplanatory names. Ask if confused. The only mystery for me is WarpToMap. It's not clear how to appoint map ids...
---------------------------------------
SetObjectPosition(obj,x,y,z,style)
Additional parameter (style) controls video effect of teleportation (as far as I could make it out, works only for heroes). Default value is -1.
style = -1,0 - Standard effect (astral gate)
= 1 - no effect, instant teleportation
= 2,3 - no effect plus a little delay (about 1 sleep)
= 4 - town portal effect
--------------------------------------------
TalkBoxForPlayers( playersFilter, iconRef, iconTooltipRef, textRef, addTextRef, callback, mode, titleTextRef, selectTextRef, defaultOption, optionTextRef [, optionTextRef, ...] )
playersFilter - Whom the dialog will be shown to, use constants from advmap-startup.lua, like in MessageBoxForPlayers.
iconRef - a ref to dxb file pointing to a texture, Icon that will be shown in top left corner of dialog. If ='' or nil, big white square will be shown (very gay).
iconTooltipRef - ref to txt file with text that will appear when hovering mouse above icon.
textRef - text that would be shown beside icon. HOWEVER, it does not show. A BUG, probably. You may as well leave it empty (nil or '').
addTextRef - text that is shown below the buttons with options
callback - name of a function that will be envoked when player hits OK button.
titleTextRef - Caption text in the upper part of dialog (not mandatory)
selectTextRef - Text that will be shown above options (not mandatory)
optionTextRef - text for options. You must enter separate parameter for each option, up to 5 options possible.
Here is an example. I use Sphinx face as an icon.
function choiceisdone(playerid,answer)
--'playerid' holds id of player who sent the callback (as the talkbox could be shown to several players at once)
--'answer' holds option number. 1 for first option. 2 for second, etc. If player hit 'Cancel', answer will hold 0. If TalkBox timed out (in multiplayer games only), it will hold -1.
end;
path= GetMapDataPath();
TalkBoxForPlayers( PLAYERFLT_ALL, '/Textures/Interface/Sphinx/SphinxIcon.(Texture).xdb#xpointer(/Texture)', '', path..'maintext.txt', path..'addtext.txt', 'choiceisdone', 0, path..'captiontext.txt', path..'selecttext.txt', 0, path..'option1.txt', path..'option2.txt',path..'option3.txt')
-------------------------------
Other functions have selfexplanatory names. Ask if confused. The only mystery for me is WarpToMap. It's not clear how to appoint map ids...
Last edited by Franzy on 20 Aug 2008, 19:21, edited 1 time in total.
@ Franzy -- what about that multi-option question box you were talking about being in 3.1? I don't see it listed. The editor has a QuestionBoxInt() function I don't recall being there before. Could that be it? If so, what is the syntax and the parameters?
rdeford, Mage Of Soquim
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
“Forgiving and being forgiven, loving and being loved,
living and letting live, is the simple basis for it all."
Ernest Holmes 1984
You meant a2p1-texts.pak, right?Franzy wrote:Anyone,
who downloaded english patch 3.1
Could you please check one thing?
Locate file a2p1-data.pak in data folder, open it as zip-archive, and see if there is file UI/CommonBoxes/TalkBox/text.txt.
Reply here.
And yes, there is a file like that. It contains:
<h4><color_bright><value=text>
No matter how powerful one becomes, there is always someone stronger. That's why I'm in a constant pursuit of power, so I can be prepared when an enemy tries to take advantage of me.
Who is online
Users browsing this forum: No registered users and 1 guest