Skip to main content

Functions

Scripting API Reference documenting the methods and functions available in Multiverse.

ReturnFunctionParametersDescription
voidLogconst char* pcFmt, ...Logs a message to the console. The console can be enabled from the launcher's settings.
voidAddScriptstring scriptNameLoads and runs a script in the Child mode. This script will be removed when switching levels. View the OnScript event for more information.
stringget_script_dirReturns the current running script directory path.
voidexit_scriptThe script will no longer be processed, but will remain loaded until the scripting engine chooses to dispose of it.

The following methods are accessible through the reserved Game object.

ReturnFunctionParametersDescription
voidallowSaveLoadbool stateSetting state to false will completely disable the save & load functionality.
stringgetCampaignNameReturns the current loaded campaign name as a string.
SWORD getLevelReturns the current level being played.
ULONGgetTurnReturns the current game turn. The turn number does not increase while the game is paused.
Note: one real life second is equivalent to 12 game turns.
View the OnTurn event for additional information.
ULONGgetTurnSecondReturns the current game turn in seconds. i.e current game turn * 12.
Note: the return value will be ULONG_MAX (0xffffffff) if the turn has already been processed.
View the OnTurn event for additional information.
UWORD getLastOpenMsgIdxReturns the ID of the last opened message box.
ULONGgetGameMode
voidsetGameModeULONG mode
voidquit
Example
local currentLevel = Game.getLevel()
Log(string.format("Current level: %i", currentLevel))

Globals​

You can use these functions to get and cache global objects.

ReturnFunctionParametersDescription
SpellsTypeInfo*getSTIUBYTE model
SpellsTypeInfo*get_spells_type_infoUBYTE model
SceneryTypeInfo*get_scenery_type_infoUBYTE model
BuildingTypeInfo*get_building_type_infoUBYTE model
VehicleTypeInfo*get_vehicle_type_infoUBYTE model
PeopleTypeInfo*get_people_type_infoUBYTE model
ThingMoveInfo*get_thing_move_infoUBYTE model
Example
blast_sti = get_spells_type_info(M_SPELL_BLAST)
blast_sti.Cost = 1000
ReturnFunctionParameters
GlobalSaveItemsgsi
GlobalNonSaveItemsgnsi
GlobalSaveMultiverseItemsgsmi
PlayersInfoplayer_info
WorldInfoworld_info
P3Constantsconstants
ModsListMVMod
Player2getPlayer2UBYTE num
Example
_gnsi = gnsi()
Log(string.format("%ix%i", _gnsi.ScreenW, _gnsi.ScreenH))

_world_info = world_info()
_world_info[1 + TRIBE_BLUE].Building = 255

_constants = constants()
_constants.PersBlastDamage = 201

Achievements​

The following methods are accessible through the reserved Achievements object. Note that all states should be handled by the user. For example, when an achievement reaches its target value, it will not be automatically unlocked. The dflt fields will be used when no such achievement is found, meaning the function will return whatever value you specified as default. Another thing to keep in mind is that these functions can be slow, so avoid overusing them.

ReturnFunctionParametersDescription
voidSetCountint countSet the total count of Achievements added. This tells the launcher how many achievements to look for.
voidAddint index, string title, string description, string image, string glow, bool unlocked, int value, int targetValueTo hide the progress bar, set the TargetValue to -1. This is particularly useful for achievements that have a binary state. Image previews can be images in png, jpg, or bmp formats. Avoid including the file extension of the image in the 'Image' parameter. You can add an optional Glow effect to achievements by using the 'Glow' parameter and providing a hex string for the color (e.g. #ffe345).
voidUpdateValueint index, int valueUpdate the "value" field of an achievement.
voidUpdateUnlockedint index, bool unlockedUpdate the "unlocked" field of an achievement.
voidUpdateUnlockedValueint index, bool unlocked, int valueUpdate the "value" and "unlocked" fields of an achievement.
boolGetUnlockedint index, bool dfltRetrieves the "unlocked" status of an achievement.
intGetTargetint index, int dfltRetrieves the "target" field value of an achievement. An achievement should be considered unlocked when it reaches the "target" value.
intGetValueint index, int dfltRetrieves the "value" field value. You may use this to keep track of the acheivement's progress.
voidResetDeletes the achievement file.

Buildings​

ReturnFunctionParametersDescription
voidset_building_on_fireThing* t_thing, SBYTE damaging_playerSets a building on fire.
Thing*get_me_a_random_buildingUBYTE pnGet a random building, can return nil if it cannot find a building.
voidcreate_building_explode_thingsThing* t_thing, UBYTE create_face_mode, UBYTE bldg_object, SBYTE constr_stage, Thing* whirlwind, UBYTE no_explode, SLONG num_faces_to_create, SLONG start_face_num, UBYTE create_face_smokeCreate a building exploding effect (many building pieces flying around).
voidget_building_entrance_coordThing* t_thing, Coord2D* tcGet the buidling's entrace coordinates.
Thing*remove_person_from_building_dwellersThing* t_thing, Thing* specific_thingRemove a person that occupies a building. You may specify a specific person that you want removed, otherwise specific_thing can be given a nil value. It can return a nil value if there's nobody inside the building to begin with.
voidset_building_sprog_timeUBYTE pn, SWORD m1, SWORD m2, SWORD m3Controls how quickly braves are spawned from huts (green bar). The parameter m1 refers to the first Small Hut upgrade stage, m2 is the Medium Hut, and m3 is the Large Hut. These values overwrite the original constants. Default constant values are 4000, 3000, 2000.
voidset_building_max_sprogging_populationUBYTE pn, SWORD m1, SWORD m2, SWORD m3Adjust the max. population cap increase given by every built Hut. The parameter m1 refers to the first Small Hut upgrade stage, m2 is the Medium Hut, and m3 is the Large Hut. These values are additive, they do not overwrite the original constants.
voidset_training_min_framesUBYTE pn, UBYTE valAdjusts the max. amount of mana drained by training troops. Use a lower value for more mana usage which means faster training.
voidinit_archer_hutUBYTE modelInitialize a building model to act as an Archer Training hut.

Camera​

The following methods are accessible through the reserved Camera object.

ReturnFunctionParametersDescription
Coord3DgetCoordsGets the current coordinates of the camera view.
voidsetCoordsCoord3D c3dSet the current coordinates of the camera view.
SWORDgetZoomLevelGets the current zoom level of the camera.
SWORDgetAngleGets the current angle of the camera.
voidsetAngleSWORD angleSet the current angle of the camera.

Commands​

ReturnFunctionParametersDescription
voidadd_player_command_entryPlayer* t_player, UBYTE cmd_type, UWORD data, UWORD map_pos
voidcommand_person_go_to_coord2dThing* t_thing, Coord2D* cdCommand the person to go somewhere.
SLONG command_person_go_into_buildingThing* t_thing, Thing* b_thingCommand the person to enter a building.
SLONG command_person_build_buildingThing* t_thing, Thing* b_thingCommand the person to help construct a building.
SLONG command_person_follow_person_idxThing* t_thing, SLONG person_idxCommand the person to follow another person.
SLONG command_person_enter_vehicleThing* t_thing, Thing* v_thingCommand the person to enter a vehicle.
SLONG command_person_sabotage_bldg_ptrThing* t_thing, Thing* b_thingCommand the person to burn a building.
SLONG person_has_command_leftThing* t_thingDoes the person have any commands left? Returns 1 or 0.
voidset_persons_current_command_completeThing* t_thingMarks the current person command as complete.
UBYTE get_cmd_curr_target_coordCommands* cptr, Coord2D* tcReturns the command's target cooordinates. i.e a CMD_GOTO_POINT command will return the goto point of the person.
UWORD get_next_free_command_list_idx
voidadd_persons_commandThing* t_thing, UWORD cmd_list_idx, SBYTE cmd_idx
UBYTE is_person_at_cmd_point_destThing* t_thing, Commands* cptrHas the person reached the command's target coord destination?
voidremove_all_persons_commandsThing* t_thing
SLONGcommand_person_attack_map_idxThing* t_thing, UWORD map_idx
voidupdate_cmd_list_entrySWORD cmd_idx, UBYTE cmd_type, CmdTargetInfo* cti, UBYTE input_flags
Commands*get_thing_curr_cmd_list_ptrThing* t_thing

Counter​

ReturnFunctionParametersDescription
voidcounter_initSLONG value, SLONG decrementStarts a counter countdown in the top right corner.
voidcounter_resumeSLONG inc_by, SLONG decrement_speed
voidcounter_stop
voidcounter_pause
SLONG counter_have_i_reached_zero
boolcounter_going
SLONGcounter_get_time

Difficulty​

The following methods are accessible through the reserved Difficulty object.

ReturnFunctionParametersDescription
voidLockLocks the difficulty to the current grade. It may no longer be changed from the in-game options menu.
voidProcessbool stateToggle whether Multiverse should process the selected difficulty. For example, turning this off will not give the human player double mana generation on easy mode.
UBYTE getGets the current difficulty grade.
voidsetUBYTE diffSets the difficulty grade – assuming it's not locked.

Drawing​

ReturnFunctionParametersDescription
voidPlayCutscenestring fileNamefileName represents the name of the cutscene file, including the file extension. Ensure the file is located in a folder named "FMV", and its format is AVI.
UBYTE*WScreen
SLONG GFGetGuiWidth
SWORD PhysicalScreenWidth
voidPopSetFontUBYTE font, UBYTE bankSets the text font bank. This should be called before DrawTextStr, as the font will constantly change whenever the game draws different text.
voidDrawTextStrint x, int y, string sDraws text to the screen.
UBYTE COLOURUBYTE clrRetrieves a color. DrawBox(0, 0, 100, 100, COLOUR(CLR_RED). View this for additional CLR ids.
voidDrawBoxint x, int y, int w, int h, int cDraws a filled rectangle to the screen.
voidDrawBoxOutlineint x, int y, int w, int h, int cDraw a rectangle outline to the screen.
voidLbDraw_RectangleTbRect x, UBYTE clrDraws a rectangle.
voidLbDraw_RectangleOutlineTbRect x, UBYTE clrDraws a filled rectangle.
voidLbDraw_CircleSLONG x, SLONG y, SLONG rad, UBYTE colour, SLONG typeDraws a filled circle to the screen.
voidLbDraw_CircleOutlineSINT x, SINT y, UINT Radius, UBYTE clrDraws a circle outline to the screen.
voidLbDraw_TriangleSINT x, SINT y, SINT x, SINT y, SINT x, SINT y, UBYTE clrDraws a triangle to the screen.
voidLbDraw_LineSINT x, SINT y, SINT x, SINT y, UBYTE clrDraws a line to the screen.
voidLbDraw_PixelSINT x, SINT y, UBYTE clrDraws a single pixel to the screen.
TbSprite*get_hspr_spriteUBYTE bank, ULONG numGets a sprite pointer from the hspr0-0.dat bank. You may pass this pointer as a parameter to LbDraw_Sprite or LbDraw_ScaledSprite.
TbSprite*get_hfx_spriteULONG numGets a sprite pointer from the hfx0-0.dat bank. You may pass this pointer as a parameter to LbDraw_Sprite or LbDraw_ScaledSprite.
TbSprite*get_mvhfx_spriteULONG numGets a sprite pointer from the mvhfx.dat bank. You may pass this pointer as a parameter to LbDraw_Sprite or LbDraw_ScaledSprite.
voidLbDraw_SpriteSINT x, SINT y, TbSprite* lpSpriteDraw a sprite to the screen.
voidLbDraw_ScaledSpriteSINT x, SINT y, TbSprite* lpSprite, UINT nDestWidth, UINT nDestHeightDraw a sprite to the screen.
voidLbDraw_SpriteExSINT x, SINT y, TbSprite* lpSpriteDraw a sprite to the screen. Ex method permits the use of negative screen coords.
voidLbDraw_ScaledSpriteExSINT x, SINT y, TbSprite* lpSprite, UINT nDestWidth, UINT nDestHeightDraw a sprite to the screen. Ex method permits the use of negative screen coords.
SLONG string_widthstring strGets the width of a string.
SLONG CharHeightUBYTE characterGets the height of a text character.
SLONG CharWidthUBYTE cGets the width of a text character.
UBYTE LbPalette_FindColourUBYTE r, UBYTE g, UBYTE b
voidLbDraw_SetGhostTableDWORD address
voidLbDraw_SetAlphaTableUBYTE table_idx
voidLbDraw_SetFlagsOnULONG fMask
voidLbDraw_SetFlagsOffULONG fMask
SLVec2*get_scaled_sprite_dest_w_and_hSLONG bucket_idx, SLONG retw, SLONG reth
voiddraw_tiled_backgroundSWORD x, SWORD y, SWORD nx, SWORD ny
voidset_clipping_windowUBYTE* screen, SLONG window_width, SLONG window_height, SLONG screen_width
voiddraw_menu_object2_at_screen_posObjectDrawInfo* odi
TbPaletteRGB*get_pal_entry_rgbUBYTE index
voidDrawStretchyButtonBoxTbRect* t_rect, BorderLayout* t_layout
voidset_pal_entry_rgbUBYTE index, UBYTE r, UBYTE g, UBYTE b
voidsky_colorint type, bool force
voidset_level_typeSBYTE leveltypeSets the level texture bank.
voidflash_player_msg_onstring str, int duration, int player_num, int attributesWrite text on the bottom right corner.
Note: does not have to be called every frame.
voidload_palettestring filename
voidLbDraw_SetClipRectTbRect rect
voidLbDraw_ReleaseClipRect
voidLbDraw_SetViewPortTbRect rect
voidLbDraw_ReleaseViewPort
voidgui_draw_me_a_person_exThing* t_thing, SLONG sx, SLONG sy, ULONG flags, ULONG scale_type

Fog of War​

The following methods are accessible through the reserved FoW object.

ReturnFunctionParametersDescription
voidsetViewRangeUBYTE model, int rangeSets the fog reveal range of units persons.
voidUncoverCoord3D cd, int duration, int radiusReveals fog around the area. Set duration to -1 for a permanent reveal.
voidUncoverAllint durationReveals the whole map. Set duration to -1 for a permanent reveal.
voidFow.UncoverReincSitebool state
voidCoverCoord3D cd, int radius, bool darkCovers the area in fog.
voidClear
Example
FoW.setViewRange(M_PERSON_SPY, 15)

Flyby​

ReturnFunctionParametersDescription
voidflyby_start
voidflyby_stop
boolflyby_in_progress
voidflyby_create_new
voidflyby_set_interuptableUBYTE setflagIf setflag is 0, then the flyby cannot be cancelled with the SPACE key.
voidflyby_set_event_posUBYTE x, UBYTE z, SWORD start_tens_secs, SWORD duration_tens_secs
voidflyby_set_event_angleSWORD angle, SWORD start_tens_secs, SWORD duration_tens_secs
voidflyby_set_event_zoomSWORD zoom_level, SWORD start_tens_secs, SWORD duration_tens_secs
voidflyby_set_event_interest_pointUBYTE x, UBYTE z, SWORD start_tens_secs, SWORD duration_tens_secs
voidflyby_set_event_tooltipUBYTE x, UBYTE z, UBYTE forced_type, SWORD start_tens_secs, SWORD duration_tens_secs
voidflyby_open_dialogSWORD string_idx, SWORD start_tens_secs
voidflyby_set_end_targetUBYTE x, UBYTE z, SWORD angle, SWORD zoom_level

Fight​

ReturnFunctionParametersDescription
UBYTE is_person_in_fight_properThing* t_thing
UBYTE does_cell_area_contain_attackable_enemyThing* t_thing, UWORD map_idx, SLONG vrad1, SLONG vrad2, UBYTE check_bldgs, UBYTE allow_full_fights
UBYTE does_cell_area_contain_attackable_enemy_superThing* t_thing, UWORD map_idx, SLONG vrad1, SLONG vrad2, UBYTE check_bldgs, UBYTE sw_special_targets_only

FENEW​

The following methods are accessible through the reserved FENEW object.

ReturnFunctionParametersDescription
voidhideTutorialHides the "Tutorial" button from the Main Menu screen.
voidhideNewGameHides the "New Game" button from the Main Menu screen.
voidstartLevelULONG idx
voidsetMenuSLONG menu
SLONGgetCurrentMenu
voidsetBackgroundSLONG idx

GUI​

ReturnFunctionParametersDescription
voidGFSetSpellMenuOn
voidGFSetBuildingMenuOn
voidGFSetPeopleMenuOn
voidset_buildings_buttonint idx, int type, int data
SLONGGFGetGuiWidthGets the width of the People/Spells/Buildings panel on the left.
SLONGKillMenuIdint id

Input​

Visit the Events. page for additional Input API reference.

ReturnFunctionParametersDescription
voiddisable_inputsULONG type_flagsDisables user input. Possible type_flags.
voidenable_inputsULONG type_flagsEnables user input. Possible type_flags.

Mouse​

The following methods are accessible through the reserved Mouse object.

ReturnFunctionParametersDescription
SINTgetScreenXGet the mouse X position in screen space.
SINTgetScreenYGet the mouse Y position in screen space.
UBYTEgetMapXGet the mouse X position in world space (PosAsXZ).
UBYTEgetMapZGet the mouse Z position in world space (PosAsXZ).
UWORDgetWorldXGet the mouse X position in world space (Coord).
UWORDgetWorldZGet the mouse Z position in world space (Coord).
UWORDgetPointedThingIdxIf the mouse is hovering over a Thing*, it will return that object's ThingNum.
Note: this does not work for all Thing* types.
UWORDgetPointedObjThingIdxIf the mouse is hovering over a (3D) Thing*, it will return that object's ThingNum.
Note: this does not work for all Thing* types.
boolisPointValidIs the user pointing his cursor at valid map coordinates? For example, this would return false when pointing at the sky
Example
local thing = THING_IDX_2_PTR(Mouse.getPointedThingIdx())
if (thing ~= nil) then
Log(string.format("Thing's type: %i, model: %i", thing.Type, thing.Model))
end
...
create_thing(T_PERSON, M_PERSON_SPY, TRIBE_BLUE, Mouse.getMapX(), Mouse.getMapZ())

Map​

ReturnFunctionParametersDescription
UWORD MARKER_IDX_2_MAP_XZUBYTE idx
MapElement*MAP_ELEM_IDX_2_PTRUWORD idx
MapElement*MAP_ELEM_RIDX_2_PTRUWORD idx
ULONGMAP_ELEM_PTR_2_IDXMapElement* me
MapElement2*MAP_ELEM2_IDX_2_PTRUWORD idx
MapElement2*MAP_ELEM2_RIDX_2_PTRUWORD idx
ULONGMAP_ELEM2_PTR_2_IDXMapElement2* me
boolProcessMapUBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement*)> f
boolProcessMap2UBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement2*)> f
boolProcessMapXZUBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement*, MapPosXZ&)>
boolProcessMapWhoMapElement* me, std::function<bool(Thing*)>
voidmark_reincarnation_site_mesCoord3D* rscoord, SBYTE owner, UBYTE mode
Coord3Dmarker_to_coord3dUWORD markeridx
Coord2Dmarker_to_coord2dUWORD markeridx
voidset_square_map_paramsUWORD mapidx, SWORD radius, UBYTE update
voidupdate_sub_cell_collide_dataUWORD mapidx, SWORD radius
voidupdate_texture_pageUWORD map_idx, SWORD radius
SLONG count_people_of_type_in_areaint x, int z, int type, int opponent, int radius
UBYTE is_map_point_landCoord2D* t_coord
SLONG get_dist_xz_cell_quickUWORD map_idx, UWORD map_idx
SLONG get_world_dist_xyzCoord3D* t, Coord3D* t
SLONG get_coastline_pointCoord2D* upd_tc, MapElement* me, UWORD m_pos
SWORD point_altitudeSWORD wx, SWORD wz
UBYTE is_map_cell_near_coastUWORD map_idx, SWORD cell_radius
UBYTE are_surround_cells_all_landUWORD map_idx
UBYTE is_thing_on_groundThing* t_thing
voidaffect_mapwho_area_by_playerUBYTE affect_code, UWORD map_idx, SWORD radius, SBYTE damaging_player
voidaffect_mapwho_areaUBYTE affect_code, UWORD map_idx, SWORD radius
UBYTE are_coords_on_same_map_cellCoord2D* tc, Coord2D* tc
voidensure_point_on_groundCoord3D* tc
voidmap_idx_to_world_coord3d_centre_no_altUWORD map_idx, Coord3D& tcd
voidcentre_coord3d_on_blockCoord3D* t_coord
voidensure_thing_on_groundThing* t_thing
UBYTE is_map_point_seaCoord2D* t_coord
UBYTE get_map_elem_ownerMapElement* me
voidmap_idx_sub_cell_to_world_coord2d_centreuword map_idx, Coord2D* t_coord
voidmap_idx_to_world_coord3d_no_altUWORD map_idx, Coord3D* t_coord
voidmap_idx_to_world_coord3dUWORD map_idx, Coord3D& tcd
UBYTE is_building_on_map_cellUWORD map_idx
voidmap_ptr_to_world_coord2dMapElement* me, Coord2D* t_coord
voidmap_ptr_to_world_coord3dMapElement* me, Coord3D* t_coord
voidmap_ptr_to_world_coord2d_centreMapElement* me, Coord2D* t_coord
voidmap_idx_to_world_coord2d_centreUWORD map_idx, Coord2D* t_coord
voidmap_idx_to_world_coord3d_centreUWORD map_idx, Coord3D& t_coord
voidmap_idx_to_world_coord2dUWORD mapidx, Coord2D* t_coord
UWORD world_coord3d_to_map_idxCoord3D* t_coord
UWORD world_coord2d_to_map_idxCoord2D* t_coord
MapElement2*world_coord2d_to_map2_ptrCoord2D* t_coord
MapElement2*world_coord3d_to_map2_ptrCoord3D* t_coord
MapElement*world_coord2d_to_map_ptrCoord2D* t_coord
MapElement*world_coord3d_to_map_ptrCoord3D* t_coord
UBYTE is_map_elem_all_grassMapElement* me
UBYTE are_surround_cells_too_steep_for_buildingUWORD map_idx, SWORD bldg_model
UBYTE does_cell_contain_shape_obstacleUWORD mapidx
UBYTE is_map_elem_all_seaMapElement* me
UBYTE is_map_elem_all_landMapElement* me
UBYTE is_map_elem_coastMapElement* me
UBYTE move_in_direction_mapposxzMapPosXZ* m, UBYTE direction, UBYTE x_inc, UBYTE z_inc
SLONG get_world_dist_xz_cellUWORD map_idx, uword map_idx
SLONG get_world_dist_xzCoord2D* t1, Coord2D* t2
SLONG get_world_dist_xz_quickCoord2D* t1 Coord2D* t2
Thing*utils_is_swamp_on_map_posUWORD pos, SLONG pn
voidcoord2D_to_coord3DCoord2D* c2, Coord3D* c3
voidcoord3D_to_coord2DCoord3D* c3, Coord2D* c2
voidset_map_elem_object_shadowMapElement* me, SLONG shadow_val

Math​

ReturnFunctionParametersDescription
SLONG G_RANDOMULONG modReturns a random number (mod not included). i.e G_RANDOM(3) possible returns are 0, 1, 2.
SLONG G_RANDOM_QUICKULONG modSame as G_RANDOM, but less "random" at the cost of better performance speed.
UWORD DEGREESUWORD deg
SWORD ROUND_ANGLESWORD angle
ULONG Pack32 UWORD n1, UWORD n2

Move​

ReturnFunctionParametersDescription
void set_person_look_at_target_anglesThing* thing, Thing* target
void set_moving_thing_dest_angleThing* thing, UWORD angle
UWORD get_angle_xzCoord2D* p1, Coord2D* p2
void move_xzCoord3D* position, UWORD angle_xz, SWORD speed
void apply_speed_to_velocityGeneral3D* v, Coord3D* tc, SLONG speed, SLONG angle
SWORDis_valid_jnav_pathThing* t_thing, Coord2D* start_c2d, Coord2D* end_c2d

Mods​

The following methods are accessible through the reserved Mods object.

ReturnFunctionParametersDescription
voidLock
SBYTE replace_bank_hsprSBYTE target_idx, UBYTE load_bank_num
SBYTE replace_bank_blocksSBYTE target_idx, UBYTE load_bank_num
voidremove_bank_replacement_hsprUWORD identifier
voidremove_bank_replacement_blocksUWORD identifier
boolis_blocks_bank_snowySBYTE bank
boolis_bank_hspr_replacedSBYTE bank
boolis_bank_blocks_replacedSBYTE bank
boolload_alpha_tablestring path, UBYTE level_type
voidgenerate_8_players_alpha_table
voidsetBetaTribeUBYTE pn, bool is_beta
voidsetBadgeBetaUBYTE pn, bool is_beta
voidsetBadgeDrawAsUBYTE pn, signed char draw_as
voidsetBadgeDrawUBYTE pn, bool draw
voidsetBetaTribeBankUBYTE pn, signed char bank
voidsetDisguiseBetaUBYTE pn, bool state
TbSprite*create_spr_bankstring name
TbSprite*get_sprite_from_bankTbSprite* sprite, ULONG num
std::vector<string>get_loaded_mods_list

Players​

ReturnFunctionParametersDescription
Player*PLAYER_IDX_2_PTRUBYTE idxConverts a player index (0, 1, 2, 3) to a pointer.
Player*getPlayerUBYTE pnGets a player pointer.
voidset_players_shaman_initial_commandPlayer* t_player
ULONGis_player_in_submit_modePlayer* t_playerReturns whether the AI player is in sulk mode (giving up).
voidset_level_failed_or_completeUBYTE complete_flagSets the level state to won (1) or lost (0).
voidset_players_alliedSBYTE player1, SBYTE ally_numAllies player1 with player2.
Note: For the alliance to go both ways, a second call is required for player2.
voidset_players_enemiesSBYTE player1, SBYTE ally_numBreaks an alliance between two players.
voidadjust_players_manaPlayer* t_player, SLONG amt, UBYTE modeGive the player a specifc amount of mana. amount can be a negative value – removing mana from the player. mode is unused.
UBYTE are_players_alliedSBYTE player1, SBYTE player2Returns whether player is allied to player2.
Note: player1 can be allied to player2, but the second player can still consider the first player an enemy.
voidlevel_load_in_level_details_and_computer_player_infoSLONG level_numInitializes a computer player using the level header info (attributes, scripts, etc.).
SLONG set_player_can_buildSLONG index, SLONG player_numUnlocks a building model for the player specified. index is a M_BUILDING define.
voidset_player_cannot_buildSLONG index, SLONG player_numRemoves a building model for the player specified. index is a M_BUILDING define.
SLONG player_can_buildSLONG index, SLONG player_numReturns whether the player has the index building unlocked as an availability type.
voidSET_PLAYER2_FLAGUBYTE pn, ULONG flag, bool state
boolis_player_aliveULONG pn
voidset_player_nameULONG pn, string str

People​

ReturnFunctionParametersDescription
Thing*get_me_a_random_personUBYTE pnReturns a person at random or nil if none is found.
Thing*getShamanUBYTE pnReturns a pointer to the Shaman or nil if not found.
voidchange_thing_state_and_initThing* t_thing, UBYTE state
voidset_top_state_for_players_people_in_statePlayer* t_player, SBYTE state
UBYTEset_person_new_stateThing* t_thing, UBYTE state
voidperson_upgrade_subclassThing* t_thing
boolis_person_subclassThing* t_thing
boolis_person_archerThing* t_thing
boolis_person_melee_ghoulThing* t_thing
boolis_person_ranged_ghoulThing* t_thing
boolis_person_neutral_tribeThing* t_thing
voidset_person_neutralThing* t_thing
voidrevert_person_neutralThing* t_thing
SLONG get_spy_disguise_ownerThing* t
UWORD is_valid_thing_idxThing* t_thing
voidset_person_varied_stand_or_cheer_animThing* t_thing, SLONG chance_of_cheer
voidset_person_draw_info_from_stateThing* t_thing
voiddamage_personThing* victim, SBYTE damaging_player, SLONG damage_value, UBYTE ignore_shield
UBYTE is_person_in_airshipThing* t_thing
UBYTE is_person_driver_in_any_vehicleThing* t_thing
UBYTE is_person_in_boatThing* t_thing
UBYTE set_person_jumping_animThing* t_thing
UBYTE is_person_preachingThing* t
voidset_person_working_animThing* t_thing
voidperson_look_at_building_centreThing* t_thing, Thing* b_thing
SLONGis_person_in_a_fightThing* t_thing
UBYTEis_person_on_a_shapeThing* t_thing
UBYTEis_person_on_a_buildingThing* t_thing
SLONGhas_person_failed_navigationThing* t_thing
voidinit_person_hspr_bankUBYTE model, UBYTE owner, SBYTE bank
voiddeselect_personThing* t_thing
boolis_person_selectedThing* t_thing
voidset_archer_fire_arrowsThing* t_thing, UWORD count
UWORDget_archer_fire_arrowsThing* t_thing
voidchange_single_persons_selected_statusThing* t_thing, ULONG select_flag, ULONG flags
voidchange_persons_selected_statusThing* t_thing, ULONG select_flag, ULONG flags
voidperson_look_at_angleThing* t_thing, UWORD angle
voidset_person_draw_info_ptaiThing* t_thing, SWORD ptai, bool reset_frame_counts
voidset_person_draw_info_by_animThing* t_thing, SWORD anim_info_idx

Storage​

Storage buffer allows users to store and retrieve data between scripts. The stored data is not serialized and will reset when reopening the game, but it will persist across different levels. Supported types include int, bool, string - replace type with one of the available keywords.

ReturnFunctionParametersDescription
voidresizesize_t val
voidpush_backtype val
typegetsize_t idx
typesetsize_t idx, type val
voidclear
voidpop_back

Spells​

ReturnFunctionParametersDescription
voidset_player_can_castSLONG index, SLONG player_num, UBYTE one_off_flag
voidset_player_cannot_castSLONG index, SLONG player_num
voidset_player_can_cast_tempSLONG index, SLONG player_num, UBYTE one_off_flag
voidset_number_of_one_shots_of_a_spell_player_hasSLONG player_num, SLONG model, SLONG num
SLONG how_many_one_shots_of_a_spell_does_player_haveSLONG player_num, SLONG model
voidset_special_guest_spell_modelSLONG spell_model
voidset_player_spell_switched_onSLONG player_num, SLONG spell_model
voidset_player_spell_switched_offSLONG player_num, SLONG spell_model
SLONG is_spell_switched_onSLONG player_num, SLONG spell_model
voidreduce_number_of_shots_from_a_headSLONG player_num, SLONG model
SLONG how_many_one_shots_from_a_head_does_player_haveSLONG player_num, SLONG model
SLONG player_can_castSLONG index, SLONG player_numReturns 0 (AVAILABLE_NOT) if the spell is not available to cast. Returns a positive number (depending on the availability type) if the spell can be cast. This can include temporary shots (e.g. from Stoneheads).
UBYTE player_has_spell_unlockedUBYTE pn, UBYTE modelReturn 1 if the player has the spell permanently unlocked, otherwise 0.
SBYTE GetSelectedSpellReturns -1 if no spell is selected.
voidSelectSpellULONG spell_typeSet spell_type to -1 to deselect.

Shapes​

ReturnFunctionParametersDescription
voidprocess_shape_map_elementsULONG map_cell_data, UBYTE bldg_model, UBYTE orient, SBYTE player_num, UBYTE modePossible mode values.
UBYTEis_shape_valid_at_map_posULONG map_cell_data, UBYTE bldg_model, UBYTE orient, SBYTE player_num

Skins​

ReturnFunctionParametersDescription
voidSkinUBYTE real_pn, UBYTE skin_as_pnReskins a tribe to a different color.
voidset_object_skinThing* t_thing, SBYTE pnSets the tribe skin of an object.
voidset_object_hspr_bankThing* t_thing, SBYTE bankSets the bank of a sprite object.
voidset_object_blocks_bankThing* t_thing, SBYTE bankSets the BLOCKS bank of a 3D object.
voidset_object_8p_bankThing* t_thingSets the object bank of a 3D object to the reserved 8 players tribes bank.
voidset_object_8p_blocks_bankThing* t_thingSets the object bank of a sprite object to the reserved 8 players tribes bank.
voidset_building_object_idxThing* t_thingSets the drawing object index of a 3D object.

Serialization​

ReturnFunctionParametersDescription
boolSaveTablestring globalname, UWORD slotSaves the contents of a Lua table. View the OnSave event for more information.
boolLoadTablestring globalname, UWORD slotLoads a previously saved Lua table. View the OnLoad event for more information.
std::stringDumpTablestring table_nameDump the contents of a table to a string.
boolLoadDumpstring dump, string to_tableLoads a string table dump back to a Lua object table.

The following methods are accessible through the reserved IniReader object.

ReturnFunctionParametersDescription
voidSetPathstring name
intReadIntegerstring szSection, string szKey, int iDefaultValue
floatReadFloatstring szSection, string szKey, float fltDefaultValue
doubleReadDoublestring szSection, string szKey, double dblDefaultValue
boolReadBooleanstring szSection, string szKey, bool bolDefaultValue
stringReadStringstring szSection, string szKey,
char*
szDefaultValue

The following methods are accessible through the reserved IniWriter object.

ReturnFunctionParametersDescription
voidSetPathstring name
voidWriteDWORDstring szSection, string szKey, DWORD nValue
voidWriteIntegerstring szSection, string szKey, int iValue
voidWriteFloatstring szSection, string szKey, float fltValue
voidWriteDoublestring szSection, string szKey, double dblValue
voidWriteBooleanstring szSection, string szKey, bool bolValue
voidWriteStringstring szSection, string szKey,
char*
szValue

Sound​

ReturnFunctionParametersDescription
SampleEntry*play_sound_eventThing* t_thing, UWORD event_id, UWORD flagsPlays a sound from Bullfrog's sound bank.
SLONG stop_sound_eventThing* t_thing, UWORD event_id
voidset_player_sound_alignmentbool human, bool evilChanges the sound samples of Shamans and Preachers being played by a player of type human or AI.

The following methods are accessible through the reserved Sound object.

ReturnFunctionParametersDescription
voidedit_entryUWORD Index, UWORD BaseSample, UWORD SFBaseSample, SBYTE AnimFrame, UBYTE Randomness, UBYTE SFRandomness, UBYTE Priority, UBYTE PitchVary, UBYTE MaxVolume, UBYTE BankIndex, string nameEdits a sound entry from Bullfrog's sound bank. You may change existing entries, or customize empty ones in order to add custom sounds. You can add up to 60 custom sounds.
voidset_ambient_sound_typeUBYTE typeSets the current level ambient music type.
UBYTEnumber_playingUWORD index

Play sounds through the updated audio engine, akin to the Music and Narrator systems. Note that playing sounds will not be serialized, meaning they will not continue playing when loading a saved game.

ReturnFunctionParametersDescription
voidPlaystring filename
voidPlay3Dstring filename, float nx, float ny, float nz
voidPlayWhilePausedbool state
voidSetListenerPosfloat x1, float y1, float z1, float x2, float y2, float z2
voidClear
voidSetVolumeULONG volume
voidGetVolume

Music​

The following methods are accessible through the reserved Music object.

ReturnFunctionParametersDescription
voidPlaystring filename, bool loopedPlay a .wav file from the Sound directory. The looped parameter decides whether the music should restart playing once it has finished. Do not include the file extension in the filename. Music.Play("bgm1", true);
voidStopStops any playing music.
voidPause
voidResume
voidSetAutoResumebool state
boolIsPlayingReturns whether any music is currently playing.
voidSetStatusbool statusToggle whether the music option is enabled or disabled.
voidSetVolumeUBYTE volumeSets the current music volume from 0 to 127.
UBYTEGetVolumeReturns current music volume from 0 to 127.
intGetPlayPositionGets current playback progress.
intGetPlayLengthGets current music duration.
stringGetPlayingNameGets current name of the playing music.
voidsetMaxBGMsuint16_t entriesSets the maximum amount of BGMs.
voidCreateQueuesol::variadic_args vaCreates a music track queue that plays in order.
voidPlayQueueint indexPlays the music queue starting from a specific index.
voidClearQueueClears any queued tracks.

Narrator​

The following methods are accessible through the reserved Narrator object.

ReturnFunctionParametersDescription
boolInitbool is_modInitializes the Narrator. Only one global instance is currently possible. If the Narrator is already in use, it will return false.
voidPlaystring filename, bool loopedPlay a .wav file from the Sound directory. The looped parameter decides whether the sound should restart playing once it has finished. Do not include the file extension in the filename.
ULONGGetVolume
voidSetVolumeULONG volume
voidPause
voidResume
voidStopStops any playing sounds.
voidSetAutoResumebool state
voidSetPlayPausedbool stateAllow or disallow (default) the Narrator to speak whilst the game is paused.
boolIsPlayingReturns whether any sound is currently playing.
intGetPlayPositionGets current playback progress.
intGetPlayLengthGets current sound duration.
stringGetPlayingNameGets current name of the playing sound.
size_tLinkSoundToMsgUWORD index, string file, bool allow_open, bool on_receive, bool on_close, bool delete_on_closeLinks a message box dialog index to a specific wav file. When that message dialog appears on screen, the wav file starts playing automatically.
boolRemoveSoundLinkAtPosUWORD indexRemove a linked message box index at a specific position.
voidClearMsgLookupClears all linked message dialogs.
voidCreateQueuesol::variadic_args vaCreates a sound queue that plays in order.
voidPlayQueueint indexPlays the sound queue starting from a specific index.
voidResetResets the Narrator. Clears any queues, playing sounds, etc.

Things​

ReturnFunctionParametersDescription
Thing*CREATE_THING_WITH_PARAMS4Thing* rt, UBYTE type, UBYTE model, UBYTE owner, Coord3D* pos, ULONG u1, ULONG u2, ULONG u3, ULONG u4
Thing*create_thingUBYTE type, UBYTE model, UBYTE owner, Coord3D* posCreates a game object. create_thing(T_PERSON, M_PERSON_SPY, TRIBE_BLUE, Mouse.getWorldX(), Mouse.getWorldZ())
Thing*create_thingUBYTE type, UBYTE model, UBYTE owner, Coord2D* posCreates a game object.
Thing*create_thingUBYTE type, UBYTE model, UBYTE owner, int x, int zCreates a game object.
Thing*create_thingUBYTE type, UBYTE model, UBYTE owner, UWORD posCreates a game object.
Thing*create_local_thingUBYTE type, UBYTE model, UBYTE owner, Coord3D*Creates a local game object.
Thing*THING_IDX_2_PTRUWORD idx
UWORD THING_PTR_2_IDXThing* t_thing
ThingInfo*THING_PTR_2_THINGSINFO_PTRThing* t
ThingInfo*THING_IDX_2_THINGSINFO_PTRUWORD idx
boolProcessThingsListUBYTE list, UBYTE pn, std::function<bool( Thing*)>
boolProcessThingsListModelUBYTE list, UBYTE model, UBYTE pn, std::function<bool( Thing*
boolProcessThingsListSpecialstd::function<bool( Thing*)>
voiddelete_thing_typeThing* t_thing
voiddelete_thing_from_mapwhoThing* t_thing
voiduninit_thingThing* t_thing
voidset_thing_draw_infoDrawInfo* di, UBYTE table_idx, SWORD draw_num
SLONG move_thing_within_mapwhoThing* t_thing, Coord3D* new_pos
voidadd_thing_to_mapwhoThing* t_thing, Coord3D* pos
voidlook_at_myplayers_cameraThing* t_thing
voidtrigger_trigger_thing_at_map_posUWORD map_idx
voidcheck_object_thing_blast_affectedThing* t_thing, UWORD map_idx
Thing*valid_thing_idx_to_ptrUWORD thing_numChecks whether the ThingNum idx given is valid. If a valid object cannot be found, it will return nil, else the Thing* object.
Thing*create_shotULONG model, ULONG owner, Coord3D* pos, ULONG c, Thing* shooter, Thing* target, bool use_target_coord, Coord3D* target_coord

Timer​

The following methods are accessible through the reserved Timer object.

ReturnFunctionParametersDescription
voidStartStarts a timer measuring time elapsed.
doubleStopStops the timer and returns time elapsed in ms.

PopScript AI​

New​

ReturnFunctionParametersDescription
voidcomputer_defend_with_any_warr_nowUBYTE pn
voidSET_CP_STATEUBYTE pn, UBYTE flag, bool enable
voidSET_ATTR_AWAY_PEOPLEUBYTE pn, UBYTE shaman, UBYTE braves, UBYTE warriors, UBYTE firewarriors, UBYTE preachers, UBYTE spies
SLONG get_num_free_entries_in_action_tableUBYTE pn
voidshaman_defend_base_posUBYTE pn, UBYTE x, UBYTE z
voidshaman_defend_base_posUBYTE pn, UBYTE marker
voidshaman_defend_base_posUBYTE pn, Coord2D c2d
UWORD computer_give_me_base_site_posPlayer* t_player
SLONG computer_count_number_of_people_guardingPlayer* t_player
voidcomputer_set_base_posUBYTE pn, UBYTE x, UBYTE z
voidcomputer_set_startsite_posUBYTE pn, UBYTE x, UBYTE z
SLONG check_nav_path_for_script_queryUBYTE pn, UWORD pos, UWORD pos
SLONG is_one_of_my_preachers_preaching_on_this_map_idxUBYTE pn, UWORD map_idx, SLONG full_check
SLONG computer_housing_availableUBYTE pn
UBYTE READ_BUCKET_REFILL_RATE_FOR_SPELLSLONG pn, SLONG spell
UWORD READ_BUCKET_COUNT_FOR_SPELLSLONG pn, SLONG spell
SLONGcomputer_num_of_building_typePlayer* t_player, SLONG model
tablefind_me_a_number_of_spare_peoplePlayer* t_player, SLONG model1, SLONG model2, SLONG bldg, SLONG where, SLONG pos, ULONG flags, SLONG num_people, UBYTE ghoul_okPossible flags values. They can be combined.
SLONGcomputer_find_training_building_that_can_be_used_for_training_nowPlayer* t_player, SLONG b_modelReturns the ThingNum of a suitable training building. It will first try to find a building without queued people.
SLONGcomputer_how_many_people_are_training_to_bePlayer* t_player, SLONG b_model, SLONG entry
void computer_set_base_bucket_rateUBYTE pn, UBYTE rateThis controls how quickly the AI can "re-charge" their spells.
SLONGcomputer_get_persons_attack_groupThing* t_thing
voidcomputer_cast_spell_on_pos_targetedUBYTE player_num, UBYTE spell, UWORD pos, UWORD target_thing_num
voidcomputer_cast_spell_on_posPlayer* t_player, UBYTE spell, UWORD pos
SLONGcomputer_can_medicine_man_cast_at_posThing* shaman, UWORD pos, SLONG spell_model
SLONGcomputer_check_spell_bucket_usageThing* shaman, SLONG spell_model
SLONGcomputer_is_map_elem_in_cps_basePlayer* t_player, MapElement* me
SLONGis_med_man_in_valid_state_to_cast_a_spellThing* shaman

PopScript​

ReturnFunctionParametersDescription
voidSET_PANEL_STATESLONG id, UBYTE state
voidFLASH_BUTTONbool on, int spell_model
SLONG NAV_CHECKSLONG pn, SLONG pn_opponent, SLONG target_type, SLONG target_model, SLONG remember
voidBUILD_ATUBYTE pn, SLONG x, SLONG z, SLONG bldg_model
SLONG COUNT_PEOPLE_IN_MARKERUBYTE pn, SLONG opponent, SLONG marker, SLONG radius
voidSET_BUCKET_USAGEUBYTE pn, UBYTE status
voidFLYBY_OPEN_DIALOGSWORD string_idx, SWORD start_tens_secs
voidKILL_TEAM_IN_AREASLONG x, SLONG z, SLONG rad
voidCLEAR_ALL_MSG
voidSET_MSG_IDSWORD user_def_id
SLONG MSG_ID
voidTRIGGER_LEVEL_LOST
voidTRIGGER_LEVEL_WON
voidENABLE_USER_INPUTS
voidDISABLE_USER_INPUTS
voidOPEN_DIALOGSLONG index
voidZOOM_TOSLONG x, SLONG z, SWORD angle
voidAUTO_MESSAGESSLONG on
voidCLEAR_SHAMAN_LEFT_CLICKSLONG pn
voidCLEAR_SHAMAN_RIGHT_CLICKSLONG pn
UBYTE IS_SHAMAN_ICON_LEFT_CLICKEDSLONG pn
UBYTE IS_SHAMAN_ICON_RIGHT_CLICKEDSLONG pn
voidTRACK_TO_MARKERSLONG idx
SLONG IS_PRISON_ON_LEVEL
voidGIVE_ONE_SHOTSLONG spell, SLONG pn
voidRESET_BASE_MARKERSLONG pn
voidSET_BASE_MARKERSLONG pn, SLONG marker
voidTURN_PUSHSLONG on
SLONG HAS_TIMER_REACHED_ZERO
voidSET_TIMER_GOINGSLONG time, SLONG decrement
voidREMOVE_TIMER
voidKILL_ALL_MSG_IDSLONG msgid
voidDELETE_SMOKE_STUFFSLONG x, SLONG z, SLONG rad
voidFORCE_TOOLTIPSLONG x, SLONG z, SLONG code, SLONG duration
SLONGIS_SHAMAN_IN_AREASLONG pn, SLONG marker, SLONG radius
SWORDCOUNT_ANGELSSLONG pn
SLONGGET_NUM_PEOPLE_CONVERTEDSLONG pn
voidCREATE_MSG_NARRATIVESLONG index
voidCREATE_MSG_OBJECTIVESLONG index
voidCREATE_MSG_INFORMATIONSLONG index
voidCREATE_MSG_INFORMATION_ZOOMSLONG index, SLONG x, SLONG z, SLONG angle
voidSET_MSG_ZOOMSLONG x, SLONG z, SLONG angle
voidSET_MSG_TIMEOUTSLONG time
voidSET_MSG_DELETE_ON_OK
voidSET_MSG_RETURN_ON_OK
voidSET_MSG_DELETE_ON_RMB_ZOOM
voidSET_MSG_OPEN_DLG_ON_RMB_ZOOM
voidSET_MSG_CREATE_RETURN_MSG_ON_RMB_ZOOM
voidSET_MSG_OPEN_DLG_ON_RMB_DELETE
voidSET_MSG_ZOOM_ON_LMB_OPEN_DLG
voidFIX_WILD_IN_AREASLONG x, SLONG z, SLONG rad
voidSET_MSG_OK_SAVE_EXIT_DLG
voidSET_SPECIAL_NO_BLDG_PANELSLONG on
voidSET_MSG_AUTO_OPEN_DLG
voidREMOVE_HEAD_AT_POSSLONG x, SLONG z
SLONG GET_NUM_PEOPLE_BEING_PREACHEDSLONG pn
voidREMOVE_PLAYER_THINGSLONG pn, SLONG thing
voidDONT_HOUSE_SPECIALISTSSLONG on
voidSET_AUTO_HOUSESLONG on
voidSTOP_CAMERA_ROTATION
voidTRIGGER_THINGSLONG idx
voidGIVE_PLAYER_SPELLSLONG pn, SLONG thing
voidTURN_PANEL_ONSLONG idx
voidDESELECT_ALL_PEOPLESLONG pn
voidSET_AUTO_BUILDSLONG on
voidGIVE_MANA_TO_PLAYERSLONG pn, SLONG mana
SLONG GET_HEAD_TRIGGER_COUNTSLONG x, SLONG z
SLONG COUNT_GUARD_POSTSSLONG x, SLONG z, SLONG rad
voidGET_HEIGHT_AT_POSSLONG marker
SLONG GET_MSG_ID
UBYTE IS_PLAYER_IN_WORLD_VIEW
voidGIVE_UP_AND_SULKSLONG pn, SLONG on
voidDELAY_MAIN_DRUM_TOWERSLONG on, SLONG pn
SLONG COUNT_PEOPLE_IN_HOUSESSLONG pn
voidSTART_REINC_NOWSLONG pn
SLONG ATTACKUBYTE pn, UBYTE opponent, SLONG people, SLONG target_type, SLONG target_model, SLONG damage, SLONG spell, SLONG spell, SLONG spell, SLONG attack_type, SLONG look_after, SLONG marker, SBYTE marker, SBYTE direction
voidSET_MARKER_ENTRYSLONG pn, SLONG entry, SLONG marker, SLONG marker, SLONG num_braves, SLONG num_warriors, SLONG num_swarriors, SLONG num_preachers
voidSET_SPELL_ENTRYSLONG pn, SLONG entry, SLONG spell, SLONG min_mana, SLONG frequency, SLONG min_people, SLONG base_spell
voidMARKER_ENTRIESSLONG pn, SLONG entry, SLONG entry, SLONG entry, SLONG entry
voidCAMERA_ROTATIONSLONG pn, SLONG angle
voidCALL_TO_ARMSSLONG pn
voidMARVELLOUS_HOUSE_DEATHSLONG pn
voidSET_DEFENCE_RADIUSSLONG pn, SLONG rad
voidSET_NO_REINCSLONG pn
voidSET_BUCKET_USAGESLONG pn, SLONG on
voidEXTRA_WOOD_COLLECTIONSLONG on, SLONG pn
voidSET_WOOD_COLLECTION_RADIISLONG pn, SLONG min, SLONG max, SLONG x, SLONG z
voidSET_BUCKET_COUNT_FOR_SPELLSLONG pn, SLONG spell, SLONG multiplier
voidSET_REINCARNATIONSLONG on, SLONG pn
voidTARGET_PLAYER_DT_AND_SSLONG pn, SLONG target
SLONG COUNT_WITH_BUILD_COMMANDSLONG pn
voidCLEAR_HOUSE_INFO_FLAGSLONG pn
SLONG COUNT_SHAPESSLONG pn
UBYTE IS_SHAMAN_SELECTEDSLONG pn
UBYTE HAS_PLAYER_BEEN_IN_ENCYCSLONG pn
voidSEND_PEOPLE_TO_MARKERSLONG pn, SLONG marker
voidPARTIAL_BUILDING_COUNTSLONG pn
SLONG IS_SHAMAN_AVAILABLE_FOR_ATTACKSLONG pn
voidTRACK_SHAMAN_EXTRA_BOLLOCKSSLONG pn, SLONG angle
voidTRACK_SHAMAN_TO_ANGLESLONG pn, SLONG angle
voidMOVE_SHAMAN_TO_MARKERSLONG pn, SLONG marker
UBYTE OH_LOOK_PLAYER_HAS_JUST_KILLED_HIS_FIRST_GHOSTSLONG pn
voidONLY_STAND_AT_MARKERSSLONG pn
voidCLEAR_STANDING_PEOPLESLONG pn
voidCLEAR_GUARDING_FROMSLONG pn, SLONG entry, SLONG entry, SLONG entry, SLONG entry
SLONG IS_BUILDING_NEARSLONG pn, SLONG bldg_model, SLONG x, SLONG z, SLONG radius
voidDEFEND_SHAMENSLONG pn, SLONG num_people
voidSEND_SHAMEN_DEFENDERS_HOMESLONG pn
voidBOAT_PATROLSLONG pn, SLONG num_people, SLONG marker, SLONG marker, SLONG marker, SLONG marker, SLONG vehicle_type
voidPRAY_AT_HEADSLONG pn, SLONG num_people, SLONG marker
SLONG I_HAVE_ONE_SHOTSLONG pn, SLONG type, SLONG model
voidPUT_PERSON_IN_DTSLONG pn, SLONG person_type, SLONG x, SLONG z
voidTRAIN_PEOPLE_NOWSLONG pn, SLONG num_people, SLONG people_type
voidSET_BUILDING_DIRECTIONSLONG pn, SLONG dir
voidSET_BASE_RADIUSSLONG pn, SLONG radius
SLONG COUNT_PEOPLE_IN_MARKERSLONG pn, SLONG opponent, SLONG marker, SLONG radius
voidSET_DRUM_TOWER_POSSLONG pn, SLONG x, SLONG z
voidCONVERT_AT_MARKERSLONG pn, SLONG marker
voidPREACH_AT_MARKERSLONG pn, SLONG marker
UBYTE GET_SPELLS_CASTSLONG pn, SLONG spell
SLONG GET_NUM_ONE_OFF_SPELLSSLONG pn, SLONG spell
voidSEND_ALL_PEOPLE_TO_MARKERSLONG pn, SLONG marker
voidGUARD_BETWEEN_MARKERSSLONG pn, SLONG marker, SLONG marker, SLONG num_braves, SLONG num_warriors, SLONG num_swarriors, SLONG num_preachers, SLONG type
voidBUILD_DRUM_TOWERSLONG pn, SLONG x, SLONG z
voidSET_ATTACK_VARIABLESLONG pn, SLONG var
voidSEND_GHOST_PEOPLESLONG pn, SLONG num
voidSPELL_ATTACKSLONG pn, SLONG spell_num, SLONG marker, SLONG direction
voidSTATE_SETSLONG pn, SLONG on, SLONG flag
voidSHAMAN_DEFENDSLONG pn, SLONG x, SLONG z, SLONG on
UBYTE HAS_HOUSE_INFO_BEEN_SHOWNSLONG pn
voidDONT_TARGET_BLUE_DRUM_TOWERSSLONG pn
voidTARGET_BLUE_DRUM_TOWERSSLONG pn
voidTARGET_BLUE_SHAMANSLONG pn
voidDONT_TARGET_BLUE_SHAMANSLONG pn
voidDONT_TARGET_S_WARRIORSSLONG pn
voidTARGET_S_WARRIORSSLONG pn
UBYTE READ_CP_ATTRIBUBYTE pn, UWORD attrib
voidWRITE_CP_ATTRIBUBYTE pn, UWORD attrib, SLONG value
SWORD PLAYERS_BUILDING_OF_TYPEUBYTE pn, UBYTE model
SWORD PLAYERS_ALL_BUILDING_OF_TYPEUBYTE pn, UBYTE model
SWORD PLAYERS_PEOPLE_OF_TYPEUBYTE pn, UBYTE model
SWORD PLAYERS_VEHICLE_OF_TYPEUBYTE pn, UBYTE model
boolEVERY_2_POWSLONG amount
boolEVERY_2_TURNS
boolEVERY_4_TURNS
boolEVERY_8_TURNS
boolEVERY_16_TURNS
boolEVERY_32_TURNS
boolEVERY_64_TURNS
boolEVERY_128_TURNS
boolEVERY_256_TURNS
boolEVERY_512_TURNS
boolEVERY_1024_TURNS
boolEVERY_2048_TURNS
boolEVERY_2_POW_PNSLONG amount, UBYTE player_num

Quest Manager​

The following methods are accessible through the reserved QuestManager object.

ReturnFunctionParametersDescription
voidInitialize
intProcessULONG gameTurn
voidAddQuestUWORD nQuestID, UINT onTurn, UBYTE delay, string engine, string title, string message
voidAddTaskUWORD nQuestID, ULONG goal_value, string variable, string messagenQuestID is the quest it belongs to.

goal_value is the value required for the task to be marked as "complete". You may provide the parameter goal_value a value of -1 for tasks that have a goal value of 0 for progression, then the task variable should be initialized to a default positive value. i.e useful for a task that requires the player to pray at an Obelisk.

variable is the variable tracking the value.
voidsetCompleteUWORD nQuestID
voidsetActiveUWORD nQuestID
boolisTaskCompleteUWORD nQuestID, SINT nTaskID
voidsetTaskCompleteUWORD nQuestID, SINT nTaskID, bool bComplete
boolisQuestCompleteUWORD nQuestID
boolisQuestActiveUWORD nQuestID
intgetTotalTasksUWORD nQuestID
voidsetFontBankUBYTE text_type, UBYTE bankSets the text font bank the Quest Manager should use to draw its text. See the enum page for possible text_type values.
voidsetFontUBYTE text_type, UBYTE bankSets the text font type. See the enum page for possible text_type values.
voidsetDrawXYSWORD x, SWORD yDraw coordinates of the Quest Manager text in screen space. Set to -1 to use the default settings.
voidClear

Misc​

ReturnFunctionParametersDescription
voidtoggle_viewUBYTE direct
voidtoggle_panelSBYTE state
voidtoggle_pause
intis_the_level_complete
voidswitch_world_to_normal_views_directUBYTE to_world_view
voidset_new_scenery_resource_sizeThing* t_thing
voidset_creature_new_stateThing* t_thing, UBYTE state
voidchange_game_control_modeSWORD mode, Player* t_player
voidstart_levelSLONG slot
SLONGsave_gameSLONG slot
SLONGload_gameSLONG slot