Skip to content

Instantly share code, notes, and snippets.

@mike1072
mike1072 / add_map_icons.tpa
Created December 2, 2016 01:15
Function for inserting new worldmap icons for Baldur's Gate and Baldur's Gate 2
// extracts all icons in file path_to_icons with a cycle number equal to or greater than icon_index
// and appends them, in order, to the map icon .bam file associated with the specified worldmap,
// converting the palette of the new icons to that of the existing map icon .bam if necessary
DEFINE_ACTION_FUNCTION ~ADD_MAP_ICONS~
INT_VAR icon_index = 0 // sequence (cycle) number of your first icon in your .bam, indexed from 0
STR_VAR path_to_icons = ~~ // full path to the .bam file containing your icons, e.g. ~mymod/bam/mapicons.bam~
worldmap = ~worldmap~ // which .wmp file should these icons be associated with, e.g. ~worldm25~
RET icons_added // how many icons were successfully added. if this is 0, you have a problem
new_icon_index // sequence number of your first icon in the new .bam - use this when you patch the worldmap