Objects and scripts
Functions
- dialog_obj
- get_flags
- get_object_data
- get_script
- loot_obj
- obj_is_carrying_obj
- obj_under_cursor
- real_dude_obj
- remove_script
- set_dude_obj
- set_flags
- set_object_data
- set_script
- set_self
- set_unique_id
dialog_obj
sfall.h
ObjectPtr dialog_obj()
+ Objects and scripts - sfall Objects and scripts | sfall Objects and scripts
Functions
- dialog_obj
- get_flags
- get_object_data
- get_script
- loot_obj
- obj_is_carrying_obj
- obj_under_cursor
- real_dude_obj
- remove_script
- set_dude_obj
- set_flags
- set_object_data
- set_scr_name
- set_script
- set_self
- set_unique_id
dialog_obj
sfall.h
ObjectPtr dialog_obj()
Returns a pointer to the object (critter) the player is having a conversation or bartering with.
get_flags
sfall.h
int get_flags(ObjectPtr obj)
Gets the current value of object flags (see define_extra.h for available flags).
get_object_data
sfall.h
get_object_data(ObjectPtr object, int offset)
Returns the data at the specified offset of an object (see OBJ_DATA_* constants in define_extra.h for offsets).
get_script
int get_script(ObjectPtr)
@@ -10,7 +10,8 @@
Accepts a pointer to an object and will remove the script from that object.
set_dude_obj
sfall.h
void set_dude_obj(ObjectPtr critter)
Take control of a given critter. Passing value 0 will reset control back to “real” dude.
set_flags
sfall.h
void set_flags(ObjectPtr obj, int flags)
Sets the current flags of an object. All flags are rewritten with given integer, so first get current flags with get_flags and use bwor/bwand to set/remove specific flag.
set_object_data
sfall.h
set_object_data(ObjectPtr object, int offset, int data)
-
Sets the data at the specified offset of an object.
set_script
void set_script(ObjectPtr, int scriptid)
+
Sets the data at the specified offset of an object.
set_scr_name
sfall.h
void set_scr_name(string name)
+
Overrides the name of the script object that was set from scrname.msg.
- The changed name will be reset each time the player leaves the map or reloads the game
- Passing an empty string (“”) to the
name argument or omitting it will allow the game to get the name for the object from pro_*.msg files - NOTE: this function is intended for use in normal game scripts
set_script
void set_script(ObjectPtr, int scriptid)
Accepts a pointer to an object and scriptID, and applies the given script to an object (scriptID accept the same values as create_object_sid from sfall 3.6). If used on an object that is already scripted, it will remove the existing script first; you cannot have multiple scripts attached to a single object. Calling set_script on self_obj will have all sorts of wacky side effects, and should be avoided. If you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
set_self
void set_self(ObjectPtr)
Overrides the script’s self_obj for the next function call.
- It is primarily used to allow the calling of functions which take an implicit
self_obj parameter (e.g. drop_obj) from global scripts, but it can also be used from normal scripts. - Will revert back to its original value after the next function call.
- Calling
self_obj(0) will also revert self_obj to original value. It is recommended to call this after each use of set_self in normal scripts in order to avoid unforeseen side effects. source_obj, target_obj, and similar functions will not work if preceded by set_self. - NOTE: for
use_obj, use_obj_on_obj vanilla functions to work correctly, it is required to call set_self twice.
set_unique_id
sfall.h
int set_unique_id(ObjectPtr object, int flag)
Assigns a unique ID number to the object and returns it. If a unique ID number has already been assigned to an object, then ID number is returned without reassignment. flag is optional.
- items with unique IDs will not stack with other items of the same type in the inventory
- to just get the current ID number of an object, use
get_object_data(object, OBJ_DATA_ID) - unique ID numbers are saved in your savegame, and have a range from 0x10000000 to 0x7FFFFFFF
- there is also a unique ID number range for the player and party members from 18000 to 83535
- to assign a new ID number generated by the engine to the object (i.e. unassign a unique ID), call the function with two arguments and pass -1 for the flag argument