Added docs for new opcodes and scripting functions

This commit is contained in:
phobos2077
2016-11-06 00:14:25 +07:00
parent 6287eefd7c
commit 1595d75f7c
2 changed files with 63 additions and 18 deletions
+43 -7
View File
@@ -159,9 +159,9 @@ get/set_critter_skill_points will get/set the number of additional points a crit
- It is not saved into the save game, so needs to be called once per reload.
- Be careful not to let the player obtain a perk when no perks are available to pick, or the game may crash.
> ObjectPtr get_last_target(objptr)
> Object get_last_target(objptr)
- will return the last critter to be deliberately attacked
> ObjectPtr get_last_attacker(objptr)
> Object get_last_attacker(objptr)
- will return the last critter to deliberately launch an attack against the argument critter.
- If a critter has not launched/recieved an attack, it will return 0. This is only stored for the duration of combat, and outside of combat both functions will always return 0.
@@ -286,12 +286,12 @@ Some utility/math functions are available:
> int tile_light(int elevation, int tileNum)
- returns light intensity at the given tile in range from 0 to 65535
> ObjectPtr obj_blocking_line(ObjectPtr objFrom, int tileTo, int blockingType)
> Object obj_blocking_line(Object objFrom, int tileTo, int blockingType)
- returns first object which blocks direct linear path from objFrom to tileTo using selected blocking function (see BLOCKING_TYPE_* constants in sfall.h)
- if path is clear (no blocker was encountered by selected function) - returns 0
- objFrom is always excluded from calculations, but is required to be a valid object
> ObjectPtr obj_blocking_tile(int tileNum, int elevation, int blockingType)
> Object obj_blocking_tile(int tileNum, int elevation, int blockingType)
- returns first object blocking given tile using given blocking function or 0 if tile is clear
> array tile_get_objs(int tileNum, int elevation)
@@ -301,22 +301,58 @@ Some utility/math functions are available:
> array party_member_list(int includeHidden)
- returns array of all current party members (0 - only critter-type, alive and visible will be returned, 1 - all object, including Trunk, etc.)
> array path_find_to(ObjectPtr objFrom, int tileTo, int blockingType)
> array path_find_to(Object objFrom, int tileTo, int blockingType)
- returns the shortest path to a given tile using given blocking function as an array of tile directions (0..5) to move on each step
- array length equals to a number of steps
- empty array means that specified target cannot be reached
> ObjectPtr create_spatial(int scriptID, int tile, int elevation, int radius)
> Object create_spatial(int scriptID, int tile, int elevation, int radius)
- creates new spatial script with given SID, at given tile, and radius
> int art_exists(int artFID)
- checks if given artFID exists in the game
- useful when you want to check if critter can use specific weapon: art_exists((artFid bwand 0xffff0fff) bwor (weaponAnim * 0x1000))
> int obj_is_carrying_obj(ObjectPtr invenObj, ObjectPtr itemObj)
> int obj_is_carrying_obj(Object invenObj, Object itemObj)
- returns number of itemObj inside invenObj's inventory, note that both arguments are object pointers
- useful when dealing with different stacks of same item (obj_is_carrying_obj_pid just returns total for all stacks of the same PID)
> any sfall_funcX(char* funcName, ...)
- these opcodes allows to use additional scripting functions, that do not require new opcode
- first argument is always function name (string)
- there are 7 versions of this opcode for different number of additional arguments (for convenience)
- opcodes have return value, but it is not neccessary to use it
------------------------------------
------ sfall_funcX functions -------
------------------------------------
> Array sfall_func0("get_metarule_table")
- returns names of all currently available scripting functions (via sfall_funcX)
> int sfall_func1("spatial_radius", Object object)
- return radius of spatial script, associated with given dummy-object (returned by create_spatial)
> Object sfall_func2("critter_inven_obj2" Object invenObj, int type)
- works just like vanilla critter_inven_obj, but correctly reports item in player's inactive hand slot
> void sfall_func0("intface_redraw")
- redraws main game interface
- useful after direct changes to current player weapons or stats to reflect changes
> void sfall_func0("intface_hide")
- hides main interface
> void sfall_func0("intface_show")
- shows main interface
> int sfall_func0("intface_is_hidden")
- returns 1 if interface is currently hidden, 0 otherwise
> void sfall_func0("exec_map_update_scripts")
- executes map_update_p_proc for all objects on map and global/hook scripts as well
------------------------
------ MORE INFO -------
------------------------