Functions
Scripting API Reference documenting the methods and functions available in Multiverse.
Return | Function | Parameters | Description |
---|---|---|---|
void | Log | const char* pcFmt, ... | Logs a message to the console. The console can be enabled from the launcher's settings. |
void | AddScript | string scriptName | Loads and runs a script in the Child mode. This script will be removed when switching levels. View the OnScript event for more information. |
string | get_script_dir | Returns the current running script directory path. | |
void | exit_script | The 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | allowSaveLoad | bool state | Setting state to false will completely disable the save & load functionality. |
string | getCampaignName | Returns the current loaded campaign name as a string. | |
SWORD | getLevel | Returns the current level being played. | |
ULONG | getTurn | Returns 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. | |
ULONG | getTurnSecond | Returns 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 | getLastOpenMsgIdx | Returns the ID of the last opened message box. | |
ULONG | getGameMode | ||
void | setGameMode | ULONG mode | |
void | quit |
Example
local currentLevel = Game.getLevel()
Log(string.format("Current level: %i", currentLevel))
Globals​
You can use these functions to get and cache global objects.
Return | Function | Parameters | Description |
---|---|---|---|
SpellsTypeInfo* | getSTI | UBYTE model | |
SpellsTypeInfo* | get_spells_type_info | UBYTE model | |
SceneryTypeInfo* | get_scenery_type_info | UBYTE model | |
BuildingTypeInfo* | get_building_type_info | UBYTE model | |
VehicleTypeInfo* | get_vehicle_type_info | UBYTE model | |
PeopleTypeInfo* | get_people_type_info | UBYTE model | |
ThingMoveInfo* | get_thing_move_info | UBYTE model |
Example
blast_sti = get_spells_type_info(M_SPELL_BLAST)
blast_sti.Cost = 1000
Return | Function | Parameters |
---|---|---|
GlobalSaveItems | gsi | |
GlobalNonSaveItems | gnsi | |
GlobalSaveMultiverseItems | gsmi | |
PlayersInfo | player_info | |
WorldInfo | world_info | |
P3Constants | constants | |
ModsList | MVMod | |
Player2 | getPlayer2 | UBYTE 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | SetCount | int count | Set the total count of Achievements added. This tells the launcher how many achievements to look for. |
void | Add | int index, string title, string description, string image, string glow, bool unlocked, int value, int targetValue | To 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). |
void | UpdateValue | int index, int value | Update the "value" field of an achievement. |
void | UpdateUnlocked | int index, bool unlocked | Update the "unlocked" field of an achievement. |
void | UpdateUnlockedValue | int index, bool unlocked, int value | Update the "value" and "unlocked" fields of an achievement. |
bool | GetUnlocked | int index, bool dflt | Retrieves the "unlocked" status of an achievement. |
int | GetTarget | int index, int dflt | Retrieves the "target" field value of an achievement. An achievement should be considered unlocked when it reaches the "target" value. |
int | GetValue | int index, int dflt | Retrieves the "value" field value. You may use this to keep track of the acheivement's progress. |
void | Reset | Deletes the achievement file. |
Buildings​
Return | Function | Parameters | Description |
---|---|---|---|
void | set_building_on_fire | Thing* t_thing, SBYTE damaging_player | Sets a building on fire. |
Thing* | get_me_a_random_building | UBYTE pn | Get a random building, can return nil if it cannot find a building. |
void | create_building_explode_things | Thing* 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_smoke | Create a building exploding effect (many building pieces flying around). |
void | get_building_entrance_coord | Thing* t_thing, Coord2D* tc | Get the buidling's entrace coordinates. |
Thing* | remove_person_from_building_dwellers | Thing* t_thing, Thing* specific_thing | Remove 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. |
void | set_building_sprog_time | UBYTE pn, SWORD m1, SWORD m2, SWORD m3 | Controls 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. |
void | set_building_max_sprogging_population | UBYTE pn, SWORD m1, SWORD m2, SWORD m3 | Adjust 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. |
void | set_training_min_frames | UBYTE pn, UBYTE val | Adjusts the max. amount of mana drained by training troops. Use a lower value for more mana usage which means faster training. |
void | init_archer_hut | UBYTE model | Initialize a building model to act as an Archer Training hut. |
Camera​
The following methods are accessible through the reserved Camera
object.
Return | Function | Parameters | Description |
---|---|---|---|
Coord3D | getCoords | Gets the current coordinates of the camera view. | |
void | setCoords | Coord3D c3d | Set the current coordinates of the camera view. |
SWORD | getZoomLevel | Gets the current zoom level of the camera. | |
SWORD | getAngle | Gets the current angle of the camera. | |
void | setAngle | SWORD angle | Set the current angle of the camera. |
Commands​
Return | Function | Parameters | Description |
---|---|---|---|
void | add_player_command_entry | Player* t_player, UBYTE cmd_type, UWORD data, UWORD map_pos | |
void | command_person_go_to_coord2d | Thing* t_thing, Coord2D* cd | Command the person to go somewhere. |
SLONG | command_person_go_into_building | Thing* t_thing, Thing* b_thing | Command the person to enter a building. |
SLONG | command_person_build_building | Thing* t_thing, Thing* b_thing | Command the person to help construct a building. |
SLONG | command_person_follow_person_idx | Thing* t_thing, SLONG person_idx | Command the person to follow another person. |
SLONG | command_person_enter_vehicle | Thing* t_thing, Thing* v_thing | Command the person to enter a vehicle. |
SLONG | command_person_sabotage_bldg_ptr | Thing* t_thing, Thing* b_thing | Command the person to burn a building. |
SLONG | person_has_command_left | Thing* t_thing | Does the person have any commands left? Returns 1 or 0. |
void | set_persons_current_command_complete | Thing* t_thing | Marks the current person command as complete. |
UBYTE | get_cmd_curr_target_coord | Commands* cptr, Coord2D* tc | Returns 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 | ||
void | add_persons_command | Thing* t_thing, UWORD cmd_list_idx, SBYTE cmd_idx | |
UBYTE | is_person_at_cmd_point_dest | Thing* t_thing, Commands* cptr | Has the person reached the command's target coord destination? |
void | remove_all_persons_commands | Thing* t_thing | |
SLONG | command_person_attack_map_idx | Thing* t_thing, UWORD map_idx | |
void | update_cmd_list_entry | SWORD cmd_idx, UBYTE cmd_type, CmdTargetInfo* cti, UBYTE input_flags | |
Commands* | get_thing_curr_cmd_list_ptr | Thing* t_thing |
Counter​
Return | Function | Parameters | Description |
---|---|---|---|
void | counter_init | SLONG value, SLONG decrement | Starts a counter countdown in the top right corner. |
void | counter_resume | SLONG inc_by, SLONG decrement_speed | |
void | counter_stop | ||
void | counter_pause | ||
SLONG | counter_have_i_reached_zero | ||
bool | counter_going | ||
SLONG | counter_get_time |
Difficulty​
The following methods are accessible through the reserved Difficulty
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | Lock | Locks the difficulty to the current grade. It may no longer be changed from the in-game options menu. | |
void | Process | bool state | Toggle 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 | get | Gets the current difficulty grade. | |
void | set | UBYTE diff | Sets the difficulty grade – assuming it's not locked. |
Drawing​
Return | Function | Parameters | Description |
---|---|---|---|
void | PlayCutscene | string fileName | fileName 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 | ||
void | PopSetFont | UBYTE font, UBYTE bank | Sets the text font bank. This should be called before DrawTextStr , as the font will constantly change whenever the game draws different text. |
void | DrawTextStr | int x, int y, string s | Draws text to the screen. |
UBYTE | COLOUR | UBYTE clr | Retrieves a color. DrawBox(0, 0, 100, 100, COLOUR(CLR_RED) . View this for additional CLR ids. |
void | DrawBox | int x, int y, int w, int h, int c | Draws a filled rectangle to the screen. |
void | DrawBoxOutline | int x, int y, int w, int h, int c | Draw a rectangle outline to the screen. |
void | LbDraw_Rectangle | TbRect x, UBYTE clr | Draws a rectangle. |
void | LbDraw_RectangleOutline | TbRect x, UBYTE clr | Draws a filled rectangle. |
void | LbDraw_Circle | SLONG x, SLONG y, SLONG rad, UBYTE colour, SLONG type | Draws a filled circle to the screen. |
void | LbDraw_CircleOutline | SINT x, SINT y, UINT Radius, UBYTE clr | Draws a circle outline to the screen. |
void | LbDraw_Triangle | SINT x, SINT y, SINT x, SINT y, SINT x, SINT y, UBYTE clr | Draws a triangle to the screen. |
void | LbDraw_Line | SINT x, SINT y, SINT x, SINT y, UBYTE clr | Draws a line to the screen. |
void | LbDraw_Pixel | SINT x, SINT y, UBYTE clr | Draws a single pixel to the screen. |
TbSprite* | get_hspr_sprite | UBYTE bank, ULONG num | Gets 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_sprite | ULONG num | Gets 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_sprite | ULONG num | Gets a sprite pointer from the mvhfx.dat bank. You may pass this pointer as a parameter to LbDraw_Sprite or LbDraw_ScaledSprite . |
void | LbDraw_Sprite | SINT x, SINT y, TbSprite* lpSprite | Draw a sprite to the screen. |
void | LbDraw_ScaledSprite | SINT x, SINT y, TbSprite* lpSprite, UINT nDestWidth, UINT nDestHeight | Draw a sprite to the screen. |
void | LbDraw_SpriteEx | SINT x, SINT y, TbSprite* lpSprite | Draw a sprite to the screen. Ex method permits the use of negative screen coords. |
void | LbDraw_ScaledSpriteEx | SINT x, SINT y, TbSprite* lpSprite, UINT nDestWidth, UINT nDestHeight | Draw a sprite to the screen. Ex method permits the use of negative screen coords. |
SLONG | string_width | string str | Gets the width of a string. |
SLONG | CharHeight | UBYTE character | Gets the height of a text character. |
SLONG | CharWidth | UBYTE c | Gets the width of a text character. |
UBYTE | LbPalette_FindColour | UBYTE r, UBYTE g, UBYTE b | |
void | LbDraw_SetGhostTable | DWORD address | |
void | LbDraw_SetAlphaTable | UBYTE table_idx | |
void | LbDraw_SetFlagsOn | ULONG fMask | |
void | LbDraw_SetFlagsOff | ULONG fMask | |
SLVec2* | get_scaled_sprite_dest_w_and_h | SLONG bucket_idx, SLONG retw, SLONG reth | |
void | draw_tiled_background | SWORD x, SWORD y, SWORD nx, SWORD ny | |
void | set_clipping_window | UBYTE* screen, SLONG window_width, SLONG window_height, SLONG screen_width | |
void | draw_menu_object2_at_screen_pos | ObjectDrawInfo* odi | |
TbPaletteRGB* | get_pal_entry_rgb | UBYTE index | |
void | DrawStretchyButtonBox | TbRect* t_rect, BorderLayout* t_layout | |
void | set_pal_entry_rgb | UBYTE index, UBYTE r, UBYTE g, UBYTE b | |
void | sky_color | int type, bool force | |
void | set_level_type | SBYTE leveltype | Sets the level texture bank. |
void | flash_player_msg_on | string str, int duration, int player_num, int attributes | Write text on the bottom right corner. Note: does not have to be called every frame. |
void | load_palette | string filename | |
void | LbDraw_SetClipRect | TbRect rect | |
void | LbDraw_ReleaseClipRect | ||
void | LbDraw_SetViewPort | TbRect rect | |
void | LbDraw_ReleaseViewPort | ||
void | gui_draw_me_a_person_ex | Thing* t_thing, SLONG sx, SLONG sy, ULONG flags, ULONG scale_type |
Fog of War​
The following methods are accessible through the reserved FoW
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | setViewRange | UBYTE model, int range | Sets the fog reveal range of units persons. |
void | Uncover | Coord3D cd, int duration, int radius | Reveals fog around the area. Set duration to -1 for a permanent reveal. |
void | UncoverAll | int duration | Reveals the whole map. Set duration to -1 for a permanent reveal. |
void | Fow.UncoverReincSite | bool state | |
void | Cover | Coord3D cd, int radius, bool dark | Covers the area in fog. |
void | Clear |
Example
FoW.setViewRange(M_PERSON_SPY, 15)
Flyby​
Return | Function | Parameters | Description |
---|---|---|---|
void | flyby_start | ||
void | flyby_stop | ||
bool | flyby_in_progress | ||
void | flyby_create_new | ||
void | flyby_set_interuptable | UBYTE setflag | If setflag is 0, then the flyby cannot be cancelled with the SPACE key. |
void | flyby_set_event_pos | UBYTE x, UBYTE z, SWORD start_tens_secs, SWORD duration_tens_secs | |
void | flyby_set_event_angle | SWORD angle, SWORD start_tens_secs, SWORD duration_tens_secs | |
void | flyby_set_event_zoom | SWORD zoom_level, SWORD start_tens_secs, SWORD duration_tens_secs | |
void | flyby_set_event_interest_point | UBYTE x, UBYTE z, SWORD start_tens_secs, SWORD duration_tens_secs | |
void | flyby_set_event_tooltip | UBYTE x, UBYTE z, UBYTE forced_type, SWORD start_tens_secs, SWORD duration_tens_secs | |
void | flyby_open_dialog | SWORD string_idx, SWORD start_tens_secs | |
void | flyby_set_end_target | UBYTE x, UBYTE z, SWORD angle, SWORD zoom_level |
Fight​
Return | Function | Parameters | Description |
---|---|---|---|
UBYTE | is_person_in_fight_proper | Thing* t_thing | |
UBYTE | does_cell_area_contain_attackable_enemy | Thing* t_thing, UWORD map_idx, SLONG vrad1, SLONG vrad2, UBYTE check_bldgs, UBYTE allow_full_fights | |
UBYTE | does_cell_area_contain_attackable_enemy_super | Thing* 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | hideTutorial | Hides the "Tutorial" button from the Main Menu screen. | |
void | hideNewGame | Hides the "New Game" button from the Main Menu screen. | |
void | startLevel | ULONG idx | |
void | setMenu | SLONG menu | |
SLONG | getCurrentMenu | ||
void | setBackground | SLONG idx |
GUI​
Return | Function | Parameters | Description |
---|---|---|---|
void | GFSetSpellMenuOn | ||
void | GFSetBuildingMenuOn | ||
void | GFSetPeopleMenuOn | ||
void | set_buildings_button | int idx, int type, int data | |
SLONG | GFGetGuiWidth | Gets the width of the People/Spells/Buildings panel on the left. | |
SLONG | KillMenuId | int id |
Input​
Visit the Events. page for additional Input API reference.
Return | Function | Parameters | Description |
---|---|---|---|
void | disable_inputs | ULONG type_flags | Disables user input. Possible type_flags. |
void | enable_inputs | ULONG type_flags | Enables user input. Possible type_flags. |
Mouse​
The following methods are accessible through the reserved Mouse
object.
Return | Function | Parameters | Description |
---|---|---|---|
SINT | getScreenX | Get the mouse X position in screen space. | |
SINT | getScreenY | Get the mouse Y position in screen space. | |
UBYTE | getMapX | Get the mouse X position in world space (PosAsXZ). | |
UBYTE | getMapZ | Get the mouse Z position in world space (PosAsXZ). | |
UWORD | getWorldX | Get the mouse X position in world space (Coord). | |
UWORD | getWorldZ | Get the mouse Z position in world space (Coord). | |
UWORD | getPointedThingIdx | If the mouse is hovering over a Thing*, it will return that object's ThingNum. Note: this does not work for all Thing* types. | |
UWORD | getPointedObjThingIdx | If the mouse is hovering over a (3D) Thing*, it will return that object's ThingNum. Note: this does not work for all Thing* types. | |
bool | isPointValid | Is 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​
Return | Function | Parameters | Description |
---|---|---|---|
UWORD | MARKER_IDX_2_MAP_XZ | UBYTE idx | |
MapElement* | MAP_ELEM_IDX_2_PTR | UWORD idx | |
MapElement* | MAP_ELEM_RIDX_2_PTR | UWORD idx | |
ULONG | MAP_ELEM_PTR_2_IDX | MapElement* me | |
MapElement2* | MAP_ELEM2_IDX_2_PTR | UWORD idx | |
MapElement2* | MAP_ELEM2_RIDX_2_PTR | UWORD idx | |
ULONG | MAP_ELEM2_PTR_2_IDX | MapElement2* me | |
bool | ProcessMap | UBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement*)> f | |
bool | ProcessMap2 | UBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement2*)> f | |
bool | ProcessMapXZ | UBYTE type, SWORD anglexz, UBYTE startradius, UBYTE endradius, UWORD pos, std::function<bool(MapElement*, MapPosXZ&)> | |
bool | ProcessMapWho | MapElement* me, std::function<bool(Thing*)> | |
void | mark_reincarnation_site_mes | Coord3D* rscoord, SBYTE owner, UBYTE mode | |
Coord3D | marker_to_coord3d | UWORD markeridx | |
Coord2D | marker_to_coord2d | UWORD markeridx | |
void | set_square_map_params | UWORD mapidx, SWORD radius, UBYTE update | |
void | update_sub_cell_collide_data | UWORD mapidx, SWORD radius | |
void | update_texture_page | UWORD map_idx, SWORD radius | |
SLONG | count_people_of_type_in_area | int x, int z, int type, int opponent, int radius | |
UBYTE | is_map_point_land | Coord2D* t_coord | |
SLONG | get_dist_xz_cell_quick | UWORD map_idx, UWORD map_idx | |
SLONG | get_world_dist_xyz | Coord3D* t, Coord3D* t | |
SLONG | get_coastline_point | Coord2D* upd_tc, MapElement* me, UWORD m_pos | |
SWORD | point_altitude | SWORD wx, SWORD wz | |
UBYTE | is_map_cell_near_coast | UWORD map_idx, SWORD cell_radius | |
UBYTE | are_surround_cells_all_land | UWORD map_idx | |
UBYTE | is_thing_on_ground | Thing* t_thing | |
void | affect_mapwho_area_by_player | UBYTE affect_code, UWORD map_idx, SWORD radius, SBYTE damaging_player | |
void | affect_mapwho_area | UBYTE affect_code, UWORD map_idx, SWORD radius | |
UBYTE | are_coords_on_same_map_cell | Coord2D* tc, Coord2D* tc | |
void | ensure_point_on_ground | Coord3D* tc | |
void | map_idx_to_world_coord3d_centre_no_alt | UWORD map_idx, Coord3D& tcd | |
void | centre_coord3d_on_block | Coord3D* t_coord | |
void | ensure_thing_on_ground | Thing* t_thing | |
UBYTE | is_map_point_sea | Coord2D* t_coord | |
UBYTE | get_map_elem_owner | MapElement* me | |
void | map_idx_sub_cell_to_world_coord2d_centre | uword map_idx, Coord2D* t_coord | |
void | map_idx_to_world_coord3d_no_alt | UWORD map_idx, Coord3D* t_coord | |
void | map_idx_to_world_coord3d | UWORD map_idx, Coord3D& tcd | |
UBYTE | is_building_on_map_cell | UWORD map_idx | |
void | map_ptr_to_world_coord2d | MapElement* me, Coord2D* t_coord | |
void | map_ptr_to_world_coord3d | MapElement* me, Coord3D* t_coord | |
void | map_ptr_to_world_coord2d_centre | MapElement* me, Coord2D* t_coord | |
void | map_idx_to_world_coord2d_centre | UWORD map_idx, Coord2D* t_coord | |
void | map_idx_to_world_coord3d_centre | UWORD map_idx, Coord3D& t_coord | |
void | map_idx_to_world_coord2d | UWORD mapidx, Coord2D* t_coord | |
UWORD | world_coord3d_to_map_idx | Coord3D* t_coord | |
UWORD | world_coord2d_to_map_idx | Coord2D* t_coord | |
MapElement2* | world_coord2d_to_map2_ptr | Coord2D* t_coord | |
MapElement2* | world_coord3d_to_map2_ptr | Coord3D* t_coord | |
MapElement* | world_coord2d_to_map_ptr | Coord2D* t_coord | |
MapElement* | world_coord3d_to_map_ptr | Coord3D* t_coord | |
UBYTE | is_map_elem_all_grass | MapElement* me | |
UBYTE | are_surround_cells_too_steep_for_building | UWORD map_idx, SWORD bldg_model | |
UBYTE | does_cell_contain_shape_obstacle | UWORD mapidx | |
UBYTE | is_map_elem_all_sea | MapElement* me | |
UBYTE | is_map_elem_all_land | MapElement* me | |
UBYTE | is_map_elem_coast | MapElement* me | |
UBYTE | move_in_direction_mapposxz | MapPosXZ* m, UBYTE direction, UBYTE x_inc, UBYTE z_inc | |
SLONG | get_world_dist_xz_cell | UWORD map_idx, uword map_idx | |
SLONG | get_world_dist_xz | Coord2D* t1, Coord2D* t2 | |
SLONG | get_world_dist_xz_quick | Coord2D* t1 Coord2D* t2 | |
Thing* | utils_is_swamp_on_map_pos | UWORD pos, SLONG pn | |
void | coord2D_to_coord3D | Coord2D* c2, Coord3D* c3 | |
void | coord3D_to_coord2D | Coord3D* c3, Coord2D* c2 | |
void | set_map_elem_object_shadow | MapElement* me, SLONG shadow_val |
Math​
Return | Function | Parameters | Description |
---|---|---|---|
SLONG | G_RANDOM | ULONG mod | Returns a random number (mod not included). i.e G_RANDOM(3) possible returns are 0, 1, 2. |
SLONG | G_RANDOM_QUICK | ULONG mod | Same as G_RANDOM , but less "random" at the cost of better performance speed. |
UWORD | DEGREES | UWORD deg | |
SWORD | ROUND_ANGLE | SWORD angle | |
ULONG | Pack32 UWORD n1, UWORD n2 |
Move​
Return | Function | Parameters | Description |
---|---|---|---|
void | set_person_look_at_target_angles | Thing* thing, Thing* target | |
void | set_moving_thing_dest_angle | Thing* thing, UWORD angle | |
UWORD | get_angle_xz | Coord2D* p1, Coord2D* p2 | |
void | move_xz | Coord3D* position, UWORD angle_xz, SWORD speed | |
void | apply_speed_to_velocity | General3D* v, Coord3D* tc, SLONG speed, SLONG angle | |
SWORD | is_valid_jnav_path | Thing* t_thing, Coord2D* start_c2d, Coord2D* end_c2d |
Mods​
The following methods are accessible through the reserved Mods
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | Lock | ||
SBYTE | replace_bank_hspr | SBYTE target_idx, UBYTE load_bank_num | |
SBYTE | replace_bank_blocks | SBYTE target_idx, UBYTE load_bank_num | |
void | remove_bank_replacement_hspr | UWORD identifier | |
void | remove_bank_replacement_blocks | UWORD identifier | |
bool | is_blocks_bank_snowy | SBYTE bank | |
bool | is_bank_hspr_replaced | SBYTE bank | |
bool | is_bank_blocks_replaced | SBYTE bank | |
bool | load_alpha_table | string path, UBYTE level_type | |
void | generate_8_players_alpha_table | ||
void | setBetaTribe | UBYTE pn, bool is_beta | |
void | setBadgeBeta | UBYTE pn, bool is_beta | |
void | setBadgeDrawAs | UBYTE pn, signed char draw_as | |
void | setBadgeDraw | UBYTE pn, bool draw | |
void | setBetaTribeBank | UBYTE pn, signed char bank | |
void | setDisguiseBeta | UBYTE pn, bool state | |
TbSprite* | create_spr_bank | string name | |
TbSprite* | get_sprite_from_bank | TbSprite* sprite, ULONG num | |
std::vector<string> | get_loaded_mods_list |
Players​
Return | Function | Parameters | Description |
---|---|---|---|
Player* | PLAYER_IDX_2_PTR | UBYTE idx | Converts a player index (0, 1, 2, 3) to a pointer. |
Player* | getPlayer | UBYTE pn | Gets a player pointer. |
void | set_players_shaman_initial_command | Player* t_player | |
ULONG | is_player_in_submit_mode | Player* t_player | Returns whether the AI player is in sulk mode (giving up). |
void | set_level_failed_or_complete | UBYTE complete_flag | Sets the level state to won (1) or lost (0). |
void | set_players_allied | SBYTE player1, SBYTE ally_num | Allies player1 with player2 .Note: For the alliance to go both ways, a second call is required for player2 . |
void | set_players_enemies | SBYTE player1, SBYTE ally_num | Breaks an alliance between two players. |
void | adjust_players_mana | Player* t_player, SLONG amt, UBYTE mode | Give the player a specifc amount of mana. amount can be a negative value – removing mana from the player. mode is unused. |
UBYTE | are_players_allied | SBYTE player1, SBYTE player2 | Returns 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. |
void | level_load_in_level_details_and_computer_player_info | SLONG level_num | Initializes a computer player using the level header info (attributes, scripts, etc.). |
SLONG | set_player_can_build | SLONG index, SLONG player_num | Unlocks a building model for the player specified. index is a M_BUILDING define. |
void | set_player_cannot_build | SLONG index, SLONG player_num | Removes a building model for the player specified. index is a M_BUILDING define. |
SLONG | player_can_build | SLONG index, SLONG player_num | Returns whether the player has the index building unlocked as an availability type. |
void | SET_PLAYER2_FLAG | UBYTE pn, ULONG flag, bool state | |
bool | is_player_alive | ULONG pn | |
void | set_player_name | ULONG pn, string str |
People​
Return | Function | Parameters | Description |
---|---|---|---|
Thing* | get_me_a_random_person | UBYTE pn | Returns a person at random or nil if none is found. |
Thing* | getShaman | UBYTE pn | Returns a pointer to the Shaman or nil if not found. |
void | change_thing_state_and_init | Thing* t_thing, UBYTE state | |
void | set_top_state_for_players_people_in_state | Player* t_player, SBYTE state | |
UBYTE | set_person_new_state | Thing* t_thing, UBYTE state | |
void | person_upgrade_subclass | Thing* t_thing | |
bool | is_person_subclass | Thing* t_thing | |
bool | is_person_archer | Thing* t_thing | |
bool | is_person_melee_ghoul | Thing* t_thing | |
bool | is_person_ranged_ghoul | Thing* t_thing | |
bool | is_person_neutral_tribe | Thing* t_thing | |
void | set_person_neutral | Thing* t_thing | |
void | revert_person_neutral | Thing* t_thing | |
SLONG | get_spy_disguise_owner | Thing* t | |
UWORD | is_valid_thing_idx | Thing* t_thing | |
void | set_person_varied_stand_or_cheer_anim | Thing* t_thing, SLONG chance_of_cheer | |
void | set_person_draw_info_from_state | Thing* t_thing | |
void | damage_person | Thing* victim, SBYTE damaging_player, SLONG damage_value, UBYTE ignore_shield | |
UBYTE | is_person_in_airship | Thing* t_thing | |
UBYTE | is_person_driver_in_any_vehicle | Thing* t_thing | |
UBYTE | is_person_in_boat | Thing* t_thing | |
UBYTE | set_person_jumping_anim | Thing* t_thing | |
UBYTE | is_person_preaching | Thing* t | |
void | set_person_working_anim | Thing* t_thing | |
void | person_look_at_building_centre | Thing* t_thing, Thing* b_thing | |
SLONG | is_person_in_a_fight | Thing* t_thing | |
UBYTE | is_person_on_a_shape | Thing* t_thing | |
UBYTE | is_person_on_a_building | Thing* t_thing | |
SLONG | has_person_failed_navigation | Thing* t_thing | |
void | init_person_hspr_bank | UBYTE model, UBYTE owner, SBYTE bank | |
void | deselect_person | Thing* t_thing | |
bool | is_person_selected | Thing* t_thing | |
void | set_archer_fire_arrows | Thing* t_thing, UWORD count | |
UWORD | get_archer_fire_arrows | Thing* t_thing | |
void | change_single_persons_selected_status | Thing* t_thing, ULONG select_flag, ULONG flags | |
void | change_persons_selected_status | Thing* t_thing, ULONG select_flag, ULONG flags | |
void | person_look_at_angle | Thing* t_thing, UWORD angle | |
void | set_person_draw_info_ptai | Thing* t_thing, SWORD ptai, bool reset_frame_counts | |
void | set_person_draw_info_by_anim | Thing* 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | resize | size_t val | |
void | push_back | type val | |
type | get | size_t idx | |
type | set | size_t idx, type val | |
void | clear | ||
void | pop_back |
Spells​
Return | Function | Parameters | Description |
---|---|---|---|
void | set_player_can_cast | SLONG index, SLONG player_num, UBYTE one_off_flag | |
void | set_player_cannot_cast | SLONG index, SLONG player_num | |
void | set_player_can_cast_temp | SLONG index, SLONG player_num, UBYTE one_off_flag | |
void | set_number_of_one_shots_of_a_spell_player_has | SLONG player_num, SLONG model, SLONG num | |
SLONG | how_many_one_shots_of_a_spell_does_player_have | SLONG player_num, SLONG model | |
void | set_special_guest_spell_model | SLONG spell_model | |
void | set_player_spell_switched_on | SLONG player_num, SLONG spell_model | |
void | set_player_spell_switched_off | SLONG player_num, SLONG spell_model | |
SLONG | is_spell_switched_on | SLONG player_num, SLONG spell_model | |
void | reduce_number_of_shots_from_a_head | SLONG player_num, SLONG model | |
SLONG | how_many_one_shots_from_a_head_does_player_have | SLONG player_num, SLONG model | |
SLONG | player_can_cast | SLONG index, SLONG player_num | Returns 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_unlocked | UBYTE pn, UBYTE model | Return 1 if the player has the spell permanently unlocked, otherwise 0. |
SBYTE | GetSelectedSpell | Returns -1 if no spell is selected. | |
void | SelectSpell | ULONG spell_type | Set spell_type to -1 to deselect. |
Shapes​
Return | Function | Parameters | Description |
---|---|---|---|
void | process_shape_map_elements | ULONG map_cell_data, UBYTE bldg_model, UBYTE orient, SBYTE player_num, UBYTE mode | Possible mode values. |
UBYTE | is_shape_valid_at_map_pos | ULONG map_cell_data, UBYTE bldg_model, UBYTE orient, SBYTE player_num |
Skins​
Return | Function | Parameters | Description |
---|---|---|---|
void | Skin | UBYTE real_pn, UBYTE skin_as_pn | Reskins a tribe to a different color. |
void | set_object_skin | Thing* t_thing, SBYTE pn | Sets the tribe skin of an object. |
void | set_object_hspr_bank | Thing* t_thing, SBYTE bank | Sets the bank of a sprite object. |
void | set_object_blocks_bank | Thing* t_thing, SBYTE bank | Sets the BLOCKS bank of a 3D object. |
void | set_object_8p_bank | Thing* t_thing | Sets the object bank of a 3D object to the reserved 8 players tribes bank. |
void | set_object_8p_blocks_bank | Thing* t_thing | Sets the object bank of a sprite object to the reserved 8 players tribes bank. |
void | set_building_object_idx | Thing* t_thing | Sets the drawing object index of a 3D object. |
Serialization​
Return | Function | Parameters | Description |
---|---|---|---|
bool | SaveTable | string globalname, UWORD slot | Saves the contents of a Lua table. View the OnSave event for more information. |
bool | LoadTable | string globalname, UWORD slot | Loads a previously saved Lua table. View the OnLoad event for more information. |
std::string | DumpTable | string table_name | Dump the contents of a table to a string. |
bool | LoadDump | string dump, string to_table | Loads a string table dump back to a Lua object table. |
The following methods are accessible through the reserved IniReader
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | SetPath | string name | |
int | ReadInteger | string szSection, string szKey, int iDefaultValue | |
float | ReadFloat | string szSection, string szKey, float fltDefaultValue | |
double | ReadDouble | string szSection, string szKey, double dblDefaultValue | |
bool | ReadBoolean | string szSection, string szKey, bool bolDefaultValue | |
string | ReadString | string szSection, string szKey, char* szDefaultValue |
The following methods are accessible through the reserved IniWriter
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | SetPath | string name | |
void | WriteDWORD | string szSection, string szKey, DWORD nValue | |
void | WriteInteger | string szSection, string szKey, int iValue | |
void | WriteFloat | string szSection, string szKey, float fltValue | |
void | WriteDouble | string szSection, string szKey, double dblValue | |
void | WriteBoolean | string szSection, string szKey, bool bolValue | |
void | WriteString | string szSection, string szKey, char* szValue |
Sound​
Return | Function | Parameters | Description |
---|---|---|---|
SampleEntry* | play_sound_event | Thing* t_thing, UWORD event_id, UWORD flags | Plays a sound from Bullfrog's sound bank. |
SLONG | stop_sound_event | Thing* t_thing, UWORD event_id | |
void | set_player_sound_alignment | bool human, bool evil | Changes 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | edit_entry | UWORD Index, UWORD BaseSample, UWORD SFBaseSample, SBYTE AnimFrame, UBYTE Randomness, UBYTE SFRandomness, UBYTE Priority, UBYTE PitchVary, UBYTE MaxVolume, UBYTE BankIndex, string name | Edits 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. |
void | set_ambient_sound_type | UBYTE type | Sets the current level ambient music type. |
UBYTE | number_playing | UWORD 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | Play | string filename | |
void | Play3D | string filename, float nx, float ny, float nz | |
void | PlayWhilePaused | bool state | |
void | SetListenerPos | float x1, float y1, float z1, float x2, float y2, float z2 | |
void | Clear | ||
void | SetVolume | ULONG volume | |
void | GetVolume |
Music​
The following methods are accessible through the reserved Music
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | Play | string filename, bool looped | Play 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); |
void | Stop | Stops any playing music. | |
void | Pause | ||
void | Resume | ||
void | SetAutoResume | bool state | |
bool | IsPlaying | Returns whether any music is currently playing. | |
void | SetStatus | bool status | Toggle whether the music option is enabled or disabled. |
void | SetVolume | UBYTE volume | Sets the current music volume from 0 to 127. |
UBYTE | GetVolume | Returns current music volume from 0 to 127. | |
int | GetPlayPosition | Gets current playback progress. | |
int | GetPlayLength | Gets current music duration. | |
string | GetPlayingName | Gets current name of the playing music. | |
void | setMaxBGMs | uint16_t entries | Sets the maximum amount of BGMs. |
void | CreateQueue | sol::variadic_args va | Creates a music track queue that plays in order. |
void | PlayQueue | int index | Plays the music queue starting from a specific index. |
void | ClearQueue | Clears any queued tracks. |
Narrator​
The following methods are accessible through the reserved Narrator
object.
Return | Function | Parameters | Description |
---|---|---|---|
bool | Init | bool is_mod | Initializes the Narrator. Only one global instance is currently possible. If the Narrator is already in use, it will return false . |
void | Play | string filename, bool looped | Play 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 . |
ULONG | GetVolume | ||
void | SetVolume | ULONG volume | |
void | Pause | ||
void | Resume | ||
void | Stop | Stops any playing sounds. | |
void | SetAutoResume | bool state | |
void | SetPlayPaused | bool state | Allow or disallow (default) the Narrator to speak whilst the game is paused. |
bool | IsPlaying | Returns whether any sound is currently playing. | |
int | GetPlayPosition | Gets current playback progress. | |
int | GetPlayLength | Gets current sound duration. | |
string | GetPlayingName | Gets current name of the playing sound. | |
size_t | LinkSoundToMsg | UWORD index, string file, bool allow_open, bool on_receive, bool on_close, bool delete_on_close | Links a message box dialog index to a specific wav file. When that message dialog appears on screen, the wav file starts playing automatically. |
bool | RemoveSoundLinkAtPos | UWORD index | Remove a linked message box index at a specific position. |
void | ClearMsgLookup | Clears all linked message dialogs. | |
void | CreateQueue | sol::variadic_args va | Creates a sound queue that plays in order. |
void | PlayQueue | int index | Plays the sound queue starting from a specific index. |
void | Reset | Resets the Narrator. Clears any queues, playing sounds, etc. |
Things​
Return | Function | Parameters | Description |
---|---|---|---|
Thing* | CREATE_THING_WITH_PARAMS4 | Thing* rt, UBYTE type, UBYTE model, UBYTE owner, Coord3D* pos, ULONG u1, ULONG u2, ULONG u3, ULONG u4 | |
Thing* | create_thing | UBYTE type, UBYTE model, UBYTE owner, Coord3D* pos | Creates a game object. create_thing(T_PERSON, M_PERSON_SPY, TRIBE_BLUE, Mouse.getWorldX(), Mouse.getWorldZ()) |
Thing* | create_thing | UBYTE type, UBYTE model, UBYTE owner, Coord2D* pos | Creates a game object. |
Thing* | create_thing | UBYTE type, UBYTE model, UBYTE owner, int x, int z | Creates a game object. |
Thing* | create_thing | UBYTE type, UBYTE model, UBYTE owner, UWORD pos | Creates a game object. |
Thing* | create_local_thing | UBYTE type, UBYTE model, UBYTE owner, Coord3D* | Creates a local game object. |
Thing* | THING_IDX_2_PTR | UWORD idx | |
UWORD | THING_PTR_2_IDX | Thing* t_thing | |
ThingInfo* | THING_PTR_2_THINGSINFO_PTR | Thing* t | |
ThingInfo* | THING_IDX_2_THINGSINFO_PTR | UWORD idx | |
bool | ProcessThingsList | UBYTE list, UBYTE pn, std::function<bool( Thing*)> | |
bool | ProcessThingsListModel | UBYTE list, UBYTE model, UBYTE pn, std::function<bool( Thing* | |
bool | ProcessThingsListSpecial | std::function<bool( Thing*)> | |
void | delete_thing_type | Thing* t_thing | |
void | delete_thing_from_mapwho | Thing* t_thing | |
void | uninit_thing | Thing* t_thing | |
void | set_thing_draw_info | DrawInfo* di, UBYTE table_idx, SWORD draw_num | |
SLONG | move_thing_within_mapwho | Thing* t_thing, Coord3D* new_pos | |
void | add_thing_to_mapwho | Thing* t_thing, Coord3D* pos | |
void | look_at_myplayers_camera | Thing* t_thing | |
void | trigger_trigger_thing_at_map_pos | UWORD map_idx | |
void | check_object_thing_blast_affected | Thing* t_thing, UWORD map_idx | |
Thing* | valid_thing_idx_to_ptr | UWORD thing_num | Checks whether the ThingNum idx given is valid. If a valid object cannot be found, it will return nil, else the Thing* object. |
Thing* | create_shot | ULONG 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.
Return | Function | Parameters | Description |
---|---|---|---|
void | Start | Starts a timer measuring time elapsed. | |
double | Stop | Stops the timer and returns time elapsed in ms. |
PopScript AI​
New​
Return | Function | Parameters | Description |
---|---|---|---|
void | computer_defend_with_any_warr_now | UBYTE pn | |
void | SET_CP_STATE | UBYTE pn, UBYTE flag, bool enable | |
void | SET_ATTR_AWAY_PEOPLE | UBYTE pn, UBYTE shaman, UBYTE braves, UBYTE warriors, UBYTE firewarriors, UBYTE preachers, UBYTE spies | |
SLONG | get_num_free_entries_in_action_table | UBYTE pn | |
void | shaman_defend_base_pos | UBYTE pn, UBYTE x, UBYTE z | |
void | shaman_defend_base_pos | UBYTE pn, UBYTE marker | |
void | shaman_defend_base_pos | UBYTE pn, Coord2D c2d | |
UWORD | computer_give_me_base_site_pos | Player* t_player | |
SLONG | computer_count_number_of_people_guarding | Player* t_player | |
void | computer_set_base_pos | UBYTE pn, UBYTE x, UBYTE z | |
void | computer_set_startsite_pos | UBYTE pn, UBYTE x, UBYTE z | |
SLONG | check_nav_path_for_script_query | UBYTE pn, UWORD pos, UWORD pos | |
SLONG | is_one_of_my_preachers_preaching_on_this_map_idx | UBYTE pn, UWORD map_idx, SLONG full_check | |
SLONG | computer_housing_available | UBYTE pn | |
UBYTE | READ_BUCKET_REFILL_RATE_FOR_SPELL | SLONG pn, SLONG spell | |
UWORD | READ_BUCKET_COUNT_FOR_SPELL | SLONG pn, SLONG spell | |
SLONG | computer_num_of_building_type | Player* t_player, SLONG model | |
table | find_me_a_number_of_spare_people | Player* t_player, SLONG model1, SLONG model2, SLONG bldg, SLONG where, SLONG pos, ULONG flags, SLONG num_people, UBYTE ghoul_ok | Possible flags values. They can be combined. |
SLONG | computer_find_training_building_that_can_be_used_for_training_now | Player* t_player, SLONG b_model | Returns the ThingNum of a suitable training building. It will first try to find a building without queued people. |
SLONG | computer_how_many_people_are_training_to_be | Player* t_player, SLONG b_model, SLONG entry | |
void | computer_set_base_bucket_rate | UBYTE pn, UBYTE rate | This controls how quickly the AI can "re-charge" their spells. |
SLONG | computer_get_persons_attack_group | Thing* t_thing | |
void | computer_cast_spell_on_pos_targeted | UBYTE player_num, UBYTE spell, UWORD pos, UWORD target_thing_num | |
void | computer_cast_spell_on_pos | Player* t_player, UBYTE spell, UWORD pos | |
SLONG | computer_can_medicine_man_cast_at_pos | Thing* shaman, UWORD pos, SLONG spell_model | |
SLONG | computer_check_spell_bucket_usage | Thing* shaman, SLONG spell_model | |
SLONG | computer_is_map_elem_in_cps_base | Player* t_player, MapElement* me | |
SLONG | is_med_man_in_valid_state_to_cast_a_spell | Thing* shaman |
PopScript​
Return | Function | Parameters | Description |
---|---|---|---|
void | SET_PANEL_STATE | SLONG id, UBYTE state | |
void | FLASH_BUTTON | bool on, int spell_model | |
SLONG | NAV_CHECK | SLONG pn, SLONG pn_opponent, SLONG target_type, SLONG target_model, SLONG remember | |
void | BUILD_AT | UBYTE pn, SLONG x, SLONG z, SLONG bldg_model | |
SLONG | COUNT_PEOPLE_IN_MARKER | UBYTE pn, SLONG opponent, SLONG marker, SLONG radius | |
void | SET_BUCKET_USAGE | UBYTE pn, UBYTE status | |
void | FLYBY_OPEN_DIALOG | SWORD string_idx, SWORD start_tens_secs | |
void | KILL_TEAM_IN_AREA | SLONG x, SLONG z, SLONG rad | |
void | CLEAR_ALL_MSG | ||
void | SET_MSG_ID | SWORD user_def_id | |
SLONG | MSG_ID | ||
void | TRIGGER_LEVEL_LOST | ||
void | TRIGGER_LEVEL_WON | ||
void | ENABLE_USER_INPUTS | ||
void | DISABLE_USER_INPUTS | ||
void | OPEN_DIALOG | SLONG index | |
void | ZOOM_TO | SLONG x, SLONG z, SWORD angle | |
void | AUTO_MESSAGES | SLONG on | |
void | CLEAR_SHAMAN_LEFT_CLICK | SLONG pn | |
void | CLEAR_SHAMAN_RIGHT_CLICK | SLONG pn | |
UBYTE | IS_SHAMAN_ICON_LEFT_CLICKED | SLONG pn | |
UBYTE | IS_SHAMAN_ICON_RIGHT_CLICKED | SLONG pn | |
void | TRACK_TO_MARKER | SLONG idx | |
SLONG | IS_PRISON_ON_LEVEL | ||
void | GIVE_ONE_SHOT | SLONG spell, SLONG pn | |
void | RESET_BASE_MARKER | SLONG pn | |
void | SET_BASE_MARKER | SLONG pn, SLONG marker | |
void | TURN_PUSH | SLONG on | |
SLONG | HAS_TIMER_REACHED_ZERO | ||
void | SET_TIMER_GOING | SLONG time, SLONG decrement | |
void | REMOVE_TIMER | ||
void | KILL_ALL_MSG_ID | SLONG msgid | |
void | DELETE_SMOKE_STUFF | SLONG x, SLONG z, SLONG rad | |
void | FORCE_TOOLTIP | SLONG x, SLONG z, SLONG code, SLONG duration | |
SLONG | IS_SHAMAN_IN_AREA | SLONG pn, SLONG marker, SLONG radius | |
SWORD | COUNT_ANGELS | SLONG pn | |
SLONG | GET_NUM_PEOPLE_CONVERTED | SLONG pn | |
void | CREATE_MSG_NARRATIVE | SLONG index | |
void | CREATE_MSG_OBJECTIVE | SLONG index | |
void | CREATE_MSG_INFORMATION | SLONG index | |
void | CREATE_MSG_INFORMATION_ZOOM | SLONG index, SLONG x, SLONG z, SLONG angle | |
void | SET_MSG_ZOOM | SLONG x, SLONG z, SLONG angle | |
void | SET_MSG_TIMEOUT | SLONG time | |
void | SET_MSG_DELETE_ON_OK | ||
void | SET_MSG_RETURN_ON_OK | ||
void | SET_MSG_DELETE_ON_RMB_ZOOM | ||
void | SET_MSG_OPEN_DLG_ON_RMB_ZOOM | ||
void | SET_MSG_CREATE_RETURN_MSG_ON_RMB_ZOOM | ||
void | SET_MSG_OPEN_DLG_ON_RMB_DELETE | ||
void | SET_MSG_ZOOM_ON_LMB_OPEN_DLG | ||
void | FIX_WILD_IN_AREA | SLONG x, SLONG z, SLONG rad | |
void | SET_MSG_OK_SAVE_EXIT_DLG | ||
void | SET_SPECIAL_NO_BLDG_PANEL | SLONG on | |
void | SET_MSG_AUTO_OPEN_DLG | ||
void | REMOVE_HEAD_AT_POS | SLONG x, SLONG z | |
SLONG | GET_NUM_PEOPLE_BEING_PREACHED | SLONG pn | |
void | REMOVE_PLAYER_THING | SLONG pn, SLONG thing | |
void | DONT_HOUSE_SPECIALISTS | SLONG on | |
void | SET_AUTO_HOUSE | SLONG on | |
void | STOP_CAMERA_ROTATION | ||
void | TRIGGER_THING | SLONG idx | |
void | GIVE_PLAYER_SPELL | SLONG pn, SLONG thing | |
void | TURN_PANEL_ON | SLONG idx | |
void | DESELECT_ALL_PEOPLE | SLONG pn | |
void | SET_AUTO_BUILD | SLONG on | |
void | GIVE_MANA_TO_PLAYER | SLONG pn, SLONG mana | |
SLONG | GET_HEAD_TRIGGER_COUNT | SLONG x, SLONG z | |
SLONG | COUNT_GUARD_POSTS | SLONG x, SLONG z, SLONG rad | |
void | GET_HEIGHT_AT_POS | SLONG marker | |
SLONG | GET_MSG_ID | ||
UBYTE | IS_PLAYER_IN_WORLD_VIEW | ||
void | GIVE_UP_AND_SULK | SLONG pn, SLONG on | |
void | DELAY_MAIN_DRUM_TOWER | SLONG on, SLONG pn | |
SLONG | COUNT_PEOPLE_IN_HOUSES | SLONG pn | |
void | START_REINC_NOW | SLONG pn | |
SLONG | ATTACK | UBYTE 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 | |
void | SET_MARKER_ENTRY | SLONG pn, SLONG entry, SLONG marker, SLONG marker, SLONG num_braves, SLONG num_warriors, SLONG num_swarriors, SLONG num_preachers | |
void | SET_SPELL_ENTRY | SLONG pn, SLONG entry, SLONG spell, SLONG min_mana, SLONG frequency, SLONG min_people, SLONG base_spell | |
void | MARKER_ENTRIES | SLONG pn, SLONG entry, SLONG entry, SLONG entry, SLONG entry | |
void | CAMERA_ROTATION | SLONG pn, SLONG angle | |
void | CALL_TO_ARMS | SLONG pn | |
void | MARVELLOUS_HOUSE_DEATH | SLONG pn | |
void | SET_DEFENCE_RADIUS | SLONG pn, SLONG rad | |
void | SET_NO_REINC | SLONG pn | |
void | SET_BUCKET_USAGE | SLONG pn, SLONG on | |
void | EXTRA_WOOD_COLLECTION | SLONG on, SLONG pn | |
void | SET_WOOD_COLLECTION_RADII | SLONG pn, SLONG min, SLONG max, SLONG x, SLONG z | |
void | SET_BUCKET_COUNT_FOR_SPELL | SLONG pn, SLONG spell, SLONG multiplier | |
void | SET_REINCARNATION | SLONG on, SLONG pn | |
void | TARGET_PLAYER_DT_AND_S | SLONG pn, SLONG target | |
SLONG | COUNT_WITH_BUILD_COMMAND | SLONG pn | |
void | CLEAR_HOUSE_INFO_FLAG | SLONG pn | |
SLONG | COUNT_SHAPES | SLONG pn | |
UBYTE | IS_SHAMAN_SELECTED | SLONG pn | |
UBYTE | HAS_PLAYER_BEEN_IN_ENCYC | SLONG pn | |
void | SEND_PEOPLE_TO_MARKER | SLONG pn, SLONG marker | |
void | PARTIAL_BUILDING_COUNT | SLONG pn | |
SLONG | IS_SHAMAN_AVAILABLE_FOR_ATTACK | SLONG pn | |
void | TRACK_SHAMAN_EXTRA_BOLLOCKS | SLONG pn, SLONG angle | |
void | TRACK_SHAMAN_TO_ANGLE | SLONG pn, SLONG angle | |
void | MOVE_SHAMAN_TO_MARKER | SLONG pn, SLONG marker | |
UBYTE | OH_LOOK_PLAYER_HAS_JUST_KILLED_HIS_FIRST_GHOST | SLONG pn | |
void | ONLY_STAND_AT_MARKERS | SLONG pn | |
void | CLEAR_STANDING_PEOPLE | SLONG pn | |
void | CLEAR_GUARDING_FROM | SLONG pn, SLONG entry, SLONG entry, SLONG entry, SLONG entry | |
SLONG | IS_BUILDING_NEAR | SLONG pn, SLONG bldg_model, SLONG x, SLONG z, SLONG radius | |
void | DEFEND_SHAMEN | SLONG pn, SLONG num_people | |
void | SEND_SHAMEN_DEFENDERS_HOME | SLONG pn | |
void | BOAT_PATROL | SLONG pn, SLONG num_people, SLONG marker, SLONG marker, SLONG marker, SLONG marker, SLONG vehicle_type | |
void | PRAY_AT_HEAD | SLONG pn, SLONG num_people, SLONG marker | |
SLONG | I_HAVE_ONE_SHOT | SLONG pn, SLONG type, SLONG model | |
void | PUT_PERSON_IN_DT | SLONG pn, SLONG person_type, SLONG x, SLONG z | |
void | TRAIN_PEOPLE_NOW | SLONG pn, SLONG num_people, SLONG people_type | |
void | SET_BUILDING_DIRECTION | SLONG pn, SLONG dir | |
void | SET_BASE_RADIUS | SLONG pn, SLONG radius | |
SLONG | COUNT_PEOPLE_IN_MARKER | SLONG pn, SLONG opponent, SLONG marker, SLONG radius | |
void | SET_DRUM_TOWER_POS | SLONG pn, SLONG x, SLONG z | |
void | CONVERT_AT_MARKER | SLONG pn, SLONG marker | |
void | PREACH_AT_MARKER | SLONG pn, SLONG marker | |
UBYTE | GET_SPELLS_CAST | SLONG pn, SLONG spell | |
SLONG | GET_NUM_ONE_OFF_SPELLS | SLONG pn, SLONG spell | |
void | SEND_ALL_PEOPLE_TO_MARKER | SLONG pn, SLONG marker | |
void | GUARD_BETWEEN_MARKERS | SLONG pn, SLONG marker, SLONG marker, SLONG num_braves, SLONG num_warriors, SLONG num_swarriors, SLONG num_preachers, SLONG type | |
void | BUILD_DRUM_TOWER | SLONG pn, SLONG x, SLONG z | |
void | SET_ATTACK_VARIABLE | SLONG pn, SLONG var | |
void | SEND_GHOST_PEOPLE | SLONG pn, SLONG num | |
void | SPELL_ATTACK | SLONG pn, SLONG spell_num, SLONG marker, SLONG direction | |
void | STATE_SET | SLONG pn, SLONG on, SLONG flag | |
void | SHAMAN_DEFEND | SLONG pn, SLONG x, SLONG z, SLONG on | |
UBYTE | HAS_HOUSE_INFO_BEEN_SHOWN | SLONG pn | |
void | DONT_TARGET_BLUE_DRUM_TOWERS | SLONG pn | |
void | TARGET_BLUE_DRUM_TOWERS | SLONG pn | |
void | TARGET_BLUE_SHAMAN | SLONG pn | |
void | DONT_TARGET_BLUE_SHAMAN | SLONG pn | |
void | DONT_TARGET_S_WARRIORS | SLONG pn | |
void | TARGET_S_WARRIORS | SLONG pn | |
UBYTE | READ_CP_ATTRIB | UBYTE pn, UWORD attrib | |
void | WRITE_CP_ATTRIB | UBYTE pn, UWORD attrib, SLONG value | |
SWORD | PLAYERS_BUILDING_OF_TYPE | UBYTE pn, UBYTE model | |
SWORD | PLAYERS_ALL_BUILDING_OF_TYPE | UBYTE pn, UBYTE model | |
SWORD | PLAYERS_PEOPLE_OF_TYPE | UBYTE pn, UBYTE model | |
SWORD | PLAYERS_VEHICLE_OF_TYPE | UBYTE pn, UBYTE model | |
bool | EVERY_2_POW | SLONG amount | |
bool | EVERY_2_TURNS | ||
bool | EVERY_4_TURNS | ||
bool | EVERY_8_TURNS | ||
bool | EVERY_16_TURNS | ||
bool | EVERY_32_TURNS | ||
bool | EVERY_64_TURNS | ||
bool | EVERY_128_TURNS | ||
bool | EVERY_256_TURNS | ||
bool | EVERY_512_TURNS | ||
bool | EVERY_1024_TURNS | ||
bool | EVERY_2048_TURNS | ||
bool | EVERY_2_POW_PN | SLONG amount, UBYTE player_num |
Quest Manager​
The following methods are accessible through the reserved QuestManager
object.
Return | Function | Parameters | Description |
---|---|---|---|
void | Initialize | ||
int | Process | ULONG gameTurn | |
void | AddQuest | UWORD nQuestID, UINT onTurn, UBYTE delay, string engine, string title, string message | |
void | AddTask | UWORD nQuestID, ULONG goal_value, string variable, string message | nQuestID 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. |
void | setComplete | UWORD nQuestID | |
void | setActive | UWORD nQuestID | |
bool | isTaskComplete | UWORD nQuestID, SINT nTaskID | |
void | setTaskComplete | UWORD nQuestID, SINT nTaskID, bool bComplete | |
bool | isQuestComplete | UWORD nQuestID | |
bool | isQuestActive | UWORD nQuestID | |
int | getTotalTasks | UWORD nQuestID | |
void | setFontBank | UBYTE text_type, UBYTE bank | Sets the text font bank the Quest Manager should use to draw its text. See the enum page for possible text_type values. |
void | setFont | UBYTE text_type, UBYTE bank | Sets the text font type. See the enum page for possible text_type values. |
void | setDrawXY | SWORD x, SWORD y | Draw coordinates of the Quest Manager text in screen space. Set to -1 to use the default settings. |
void | Clear |
Misc​
Return | Function | Parameters | Description |
---|---|---|---|
void | toggle_view | UBYTE direct | |
void | toggle_panel | SBYTE state | |
void | toggle_pause | ||
int | is_the_level_complete | ||
void | switch_world_to_normal_views_direct | UBYTE to_world_view | |
void | set_new_scenery_resource_size | Thing* t_thing | |
void | set_creature_new_state | Thing* t_thing, UBYTE state | |
void | change_game_control_mode | SWORD mode, Player* t_player | |
void | start_level | SLONG slot | |
SLONG | save_game | SLONG slot | |
SLONG | load_game | SLONG slot |