diguyCrowd

Generated from diguyCrowd.h

DI-Guy API Version 12.5.1

This file was automatically generated from diguyCrowd.h. Do not edit this file directly; the changes will be lost.
Includes: diguyMotionSpeedType.h | declspec_diguy.h

Contents:

Alphabetical Index

class diguyCrowd

class BDI_DECLSPEC_diguy diguyCrowd
{
public:
    const char* get_name();
    int set_name(const char* name);
    const char* get_ui_name();
    int set_ui_name(const char* ui_name);
    const char* get_type_name();
    int set_enabled(int enabled);
    int get_enabled();
    void set_all_members_enabled(int enabled);
    float get_awareness_radius();
    int set_awareness_radius(float radius);
    int add_member(diguyCharacter* character);
    int add_all_characters_in_group(diguyCharacterGroup* group);
    int remove_member(diguyCharacter* character);
    int remove_all_members();
    int is_member(diguyCharacter* character);
    int get_num_members();
    diguyCharacter* get_member_at_index(int index);
    int get_index_of_member(diguyCharacter* member);
    diguyCharacterGroup* get_associated_group();
    int agents_attack_character(const char* character_name);
    int agents_attack_group(const char* group_name);
    int agents_flee_character(const char* character_name,
        float distance,
        int danger_level = 50);
    int agents_flee_group(const char* group_name,
        float distance,
        int danger_level = 50);
    int agents_flee_crowd(const char* crowd_name,
        float distance,
        int danger_level = 50);
    int agents_flee_location(float x, float y, float z,
        float distance,
        int danger_level = 50);
    void agents_remove_all_flee_objects();
    int agents_mingle_in_region(const char* region_name = NULL,
        const char* subregion = NULL);
    int agents_pursue_character(const char* character_name);
    int agents_pursue_group(const char* group_name);
    int agents_chain_pursue(const char* leader_name);
    int agents_travel_behavior_path(const char* direction = NULL,
        const char* at_end = NULL,
        int waypoint_index = -1,
        float offset_y = 0.5f);
    int agents_travel_path_shape(const char* path_shape_name,
        const char* direction = NULL,
        const char* at_end = NULL,
        int waypoint_index = -1,
        float offset_y = 0.5f);
    int agents_travel_region_border(const char* region_name,
        const char* subregion = NULL);
    int agents_wander_region(const char* region_name = NULL,  // NULL -> populate region
        const char* subregion = NULL);
    int agents_stop_behavior();
    int set_current_behavior(const char* behavior_name);
    const char* get_current_behavior(int member_index = 0);
    int set_current_behavior_path_shape(const char* behavior_path_shape_name,
        float max_time_until_move_on = 0.0f);
    int set_current_behavior_region(const char* behavior_region_name,
        const char* subregion = NULL,
        float max_time_until_move_on = 0.0f);
    int set_current_focus_character(const char* focus_character_name);
    int set_current_focus_group(const char* focus_group_name);
    int set_current_params_from_profile(const char* profile_name,
        int retain_focus_objects = 1,
        int retain_navigation_values = 1);
    void set_current_behavior_region_border_is_solid(int is_solid);
    void set_current_postures(diguyMotionPosture posture);
    void set_current_variants(diguyMotionVariant variant);
    int set_initial_params_from_profile(const char* profile_name);
    int is_current_behavior(const char* behavior_name,
        float threshold = 0.5f);
    int is_current_behavior_and_focus_character(const char* behavior_name,
        const char* focus_character_name,
        float threshold = 0.5f);
    int is_current_behavior_and_focus_group(const char* behavior_name,
        const char* group_name,
        float threshold = 0.5f);
    int is_crowd_dead(float threshold = 0.5f);
    int add_companion_crowd(diguyCrowd* companion_crowd);
    int remove_companion_crowd(diguyCrowd* companion_crowd);
    void set_dynamic_object_avoidance_method(diguyDynamicAvoidanceMethod method);
    diguyDynamicAvoidanceMethod get_dynamic_object_avoidance_method();
    void set_static_object_avoidance_method(diguyStaticAvoidanceMethod method);
    diguyStaticAvoidanceMethod get_static_object_avoidance_method();
    diguyCharacter* get_callback_character();
    diguyImpact* get_callback_impact();
    enum {
        CALLBACK_ID_CREATE = 1,
        CALLBACK_ID_DESTROY,
        CALLBACK_ID_CROWD_MEMBER_KILLED,
        CALLBACK_ID_CROWD_MEMBER_IMPACT,
        CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT,
        CALLBACK_ID_NEARBY_WEAPON_FIRED,
    };
#ifdef CPLUSPLUS_ONLY
    int add_callback(int callback_id,
        diguyCrowdCallback* callback,
        void* callback_params = 0,
        void* callback_user_data = 0);
    int remove_callback(int callback_id,
        diguyCrowdCallback* callback);
    int remove_callback_with_user_data(int callback_id,
        void* callback_user_data);
#endif
    int add_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    int remove_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
#ifdef CPLUSPLUS_ONLY
    void all_members_add_character_callback(int callback_id,
        diguyCharacterCallback* callback,
        void* callback_params = NULL,
        void* callback_user_data = NULL);
    void all_members_remove_character_callback(int callback_id,
        diguyCharacterCallback* callback);
    void all_members_remove_character_callback_with_user_data(int callback_id,
        void* callback_user_data);
#endif
    void all_members_add_character_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    void all_members_remove_character_callback_script(int callback_id,
        const char* callback_script,
        const char* callback_script_type = NULL);
    int map_event_handler_to_callback_id(int callback_id,
        const char* handler_name);
    int unmap_event_handler_from_callback_id(int callback_id,
        const char* handler_name,
        int unmap_all_matches = 0);
    diguyRegion* find_or_create_region();
    diguyRegion* get_region();
    void send_message_to_all_members(const char* message_type,
        const char* message,
        const char* message_params = NULL);
    void                 set_unit_type(diguyTacticsUnitType tut);
    diguyTacticsUnitType get_unit_type();
    int                  set_unit_leader(diguyCharacter* leader);
    diguyCharacter*      get_unit_leader();

function diguyCrowd::get_name

Prototype:

const char* get_name();
Returns:

name of this object; this value will never be NULL

Callable From:

function diguyCrowd::set_name

Prototype:

int set_name(const char* name);
Description:

This function sets the name of this object.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_ui_name

Prototype:

const char* get_ui_name();
Returns:

UI name of this object; this value will never be NULL

Callable From:

function diguyCrowd::set_ui_name

Prototype:

int set_ui_name(const char* ui_name);
Description:

This function sets the UI name of this object. The UI name is what shows up in user interface windows that show information about this crowd.

For example, the crowd name may be "crowd_squad1", the UI name may be "Squad 1".

By default the UI name matches the internal name.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_type_name

Prototype:

const char* get_type_name();
Description:

Returns the type name of the object. This pointer will never be NULL.

Returns:

type name of the object

Callable From:

function diguyCrowd::set_enabled

Prototype:

int set_enabled(int enabled);
Description:

This function enables or disables the crowd.

Disabling a crowd does not disable or hide the members of the crowd. It does turn off any effects the crowd may have on agent actions, position, orientation, etc. To enable or disable all agents in the crowd, use set_all_members_enabled() instead.

Disabled crowds also will not interact with companion crowds.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_enabled

Prototype:

int get_enabled();
Returns:

1 if enabled, 0 if not

Callable From:

function diguyCrowd::set_all_members_enabled

Prototype:

void set_all_members_enabled(int enabled);
Description:

This function enables or disables all agents in the crowd. This is the equivalent to calling diguyCharacter::set_enabled() for all members of the crowd.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_awareness_radius

Prototype:

float get_awareness_radius();
Returns:

The size of the radius around the crowd's character that certain callbacks will be triggered within. Callbacks such as: CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT, and CALLBACK_ID_NEARBY_WEAPON_FIRED, are affected by this value.

Callable From:

function diguyCrowd::set_awareness_radius

Prototype:

int set_awareness_radius(float radius);
Description:

Sets the crowd awareness radius. See get_awareness_radius().

Returns:

0 on success, -1 on failure

Callable From:

Crowd Member Functions

function diguyCrowd::add_member

Prototype:

int add_member(diguyCharacter* character);
Description:

Adds the passed character to the crowd if not already in it.

Returns:

0 if the character is now a part of the crowd; -1 if not

Callable From:

function diguyCrowd::add_all_characters_in_group

Prototype:

int add_all_characters_in_group(diguyCharacterGroup* group);
Description:

Adds all characters of the group as members of the crowd.

Returns:

Always return 0.

Callable From:

function diguyCrowd::remove_member

Prototype:

int remove_member(diguyCharacter* character);
Description:

Removes the passed character from the crowd if it is a member.

Returns:

0 if the character was part of the crowd and removed; -1 if not

Callable From:

function diguyCrowd::remove_all_members

Prototype:

int remove_all_members();
Description:

Removes all members of the crowd.

Returns:

Always return 0.

Callable From:

function diguyCrowd::is_member

Prototype:

int is_member(diguyCharacter* character);
Returns:

1 if the passed character is a member of the crowd; 0 if not

Callable From:

function diguyCrowd::get_num_members

Prototype:

int get_num_members();
Returns:

number of member characters in crowd

Callable From:

function diguyCrowd::get_member_at_index

Prototype:

diguyCharacter* get_member_at_index(int index);
Returns:

crowd member at specified index; NULL if no character at specified index

Callable From:

function diguyCrowd::get_index_of_member

Prototype:

int get_index_of_member(diguyCharacter* member);
Returns:

index of crowd member; -1 if not a member of the crowd

Callable From:

function diguyCrowd::get_associated_group

Prototype:

diguyCharacterGroup* get_associated_group();
Returns:

diguyCharacterGroup associated with the crowd

Behavior Functions
Attack Functions

function diguyCrowd::agents_attack_character

Prototype:

int agents_attack_character(const char* character_name);
Description:

This is a shortcut for calling diguyCharacter::agent_attack_character() for all members of the crowd.

This function will implicitly put agents into the attack behavior.

The current focus character will be set the specified character. Pass NULL or the empty string ("") to not change the focus character, but still change to the pursue behavior.

The current focus group will be un-set.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_attack_group

Prototype:

int agents_attack_group(const char* group_name);
Description:

This is a shortcut for calling diguyCharacter::agent_attack_group() for all members of the crowd.

This function will implicitly put agents into the attack behavior.

The current focus group will be set the specified group. Pass NULL or the empty string ("") to not change the focus group, but still change to the pursue behavior.

The current focus character will be un-set.

Returns:

0 on success, -1 on failure

Callable From:

Flee Functions

function diguyCrowd::agents_flee_character

Prototype:

int agents_flee_character(const char* character_name,
    float distance,
    int danger_level = 50);
Description:

This is a shortcut for calling diguyCharacter::agent_flee_character() for all members of the crowd.

This function will implicitly put agents into the flee behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_flee_group

Prototype:

int agents_flee_group(const char* group_name,
    float distance,
    int danger_level = 50);
Description:

This is a shortcut for calling diguyCharacter::agent_flee_group() for all members of the crowd.

This function will implicitly put agents into the flee behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_flee_crowd

Prototype:

int agents_flee_crowd(const char* crowd_name,
    float distance,
    int danger_level = 50);
Description:

This is a shortcut for calling diguyCharacter::agent_flee_crowd() for all members of the crowd.

This function will implicitly put agents into the flee behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_flee_location

Prototype:

int agents_flee_location(float x, float y, float z,
    float distance,
    int danger_level = 50);
Description:

This is a shortcut for calling diguyCharacter::agent_flee_location() for all members of the crowd.

This function will implicitly put agents into the flee behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_remove_all_flee_objects

Prototype:

void agents_remove_all_flee_objects();
Description:

This is a shortcut for calling diguyCharacter::agent_remove_all_flee_objects() for all members of the crowd.

Returns:

0 on success, -1 on failure

Callable From:

Mingle Functions

function diguyCrowd::agents_mingle_in_region

Prototype:

int agents_mingle_in_region(const char* region_name = NULL,
    const char* subregion = NULL);
Description:

This is a shortcut for calling diguyCharacter::agent_mingle_in_region() for all members of the crowd.

This function will implicitly put agents into the mingle behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

Pursue Functions

function diguyCrowd::agents_pursue_character

Prototype:

int agents_pursue_character(const char* character_name);
Description:

This is a shortcut for calling diguyCharacter::agent_pursue_character() for all members of the crowd.

This function will implicitly put agents into the pursue behavior.

The current focus character will be set the specified character. Pass NULL or the empty string ("") to not change the focus character, but still change to the pursue behavior.

The current focus group will be un-set.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_pursue_group

Prototype:

int agents_pursue_group(const char* group_name);
Description:

This is a shortcut for calling diguyCharacter::agent_pursue_group() for all members of the crowd.

This function will implicitly put agents into the pursue behavior.

The current focus group will be set to the specified group. Pass NULL or the empty string ("") to not change the focus group, but still change to the pursue behavior.

The current focus character will be un-set.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_chain_pursue

Prototype:

int agents_chain_pursue(const char* leader_name);
Description:

This causes all members of the crowd to start pursuing the individual that is closer to the leader then they are.

This function will implicitly put all agents except the leader into the pursue behavior.

The current focus character will be set to the next nearest character.

Returns:

0 on success, -1 on failure

Callable From:

Travel Functions

function diguyCrowd::agents_travel_behavior_path

Prototype:

int agents_travel_behavior_path(const char* direction = NULL,
    const char* at_end = NULL,
    int waypoint_index = -1,
    float offset_y = 0.5f);
Description:

This is a shortcut for calling diguyCharacter::agent_travel_behavior_path() for all members of the crowd.

This function will implicitly put agents into the travel behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_travel_path_shape

Prototype:

int agents_travel_path_shape(const char* path_shape_name,
    const char* direction = NULL,
    const char* at_end = NULL,
    int waypoint_index = -1,
    float offset_y = 0.5f);
Description:

This is a shortcut for calling diguyCharacter::agent_travel_path_shape() for all members of the crowd.

This function will implicitly put agents into the travel behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::agents_travel_region_border

Prototype:

int agents_travel_region_border(const char* region_name,
    const char* subregion = NULL);
Description:

This is a shortcut for calling diguyCharacter::agent_travel_region_border() for all members of the crowd.

This function will implicitly put agents into the travel behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

Wander Functions

function diguyCrowd::agents_wander_region

Prototype:

int agents_wander_region(const char* region_name = NULL,  // NULL -> populate region
    const char* subregion = NULL);
Description:

This is a shortcut for calling diguyCharacter::agent_wander_region() for all members of the crowd.

This function will implicitly put agents into the wander behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

Other Behavior Functions

function diguyCrowd::agents_stop_behavior

Prototype:

int agents_stop_behavior();
Description:

This is a shortcut for calling diguyCharacter::agent_stop_behavior() for all members of the crowd.

This function will implicitly put agents into the none behavior.

Neither the current focus character nor group will be changed by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_behavior

Prototype:

int set_current_behavior(const char* behavior_name);
Description:

This is a shortcut for calling diguyCharacter::set_current_behavior() for all members of the crowd.

It's recommended that one of the higher level functions above that set behavior, for example agent_wander_region(), is used. These functions allow for setting the most common parameters that affect the behavior in one function call.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_current_behavior

Prototype:

const char* get_current_behavior(int member_index = 0);
Description:

Returns the current behavior used by crowd, expressed as a string (e.g. "travel").

Returns:

string describing current crowd behavior, NULL on error

Callable From:

function diguyCrowd::set_current_behavior_path_shape

Prototype:

int set_current_behavior_path_shape(const char* behavior_path_shape_name,
    float max_time_until_move_on = 0.0f);
Description:

Similar to diguyAgentParams::set_behavior_path_shape(). This is a shortcut for setting the current behavior path shape for all characters in the crowd.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_behavior_region

Prototype:

int set_current_behavior_region(const char* behavior_region_name,
    const char* subregion = NULL,
    float max_time_until_move_on = 0.0f);
Description:

Similar to diguyAgentParams::set_behavior_region(). This is a shortcut for setting the current behavior region for all characters in the crowd.

This function does take an additional argument, max_time_until_move_on. Setting this to 0 will cause all agents that occasionally pause their movement (for example, characters in the wander behavior) to move on to the new behavior region immediately. Passing a higher number will allow agents to finish their "natural" wait interval before moving on to the new region.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_focus_character

Prototype:

int set_current_focus_character(const char* focus_character_name);
Description:

Similar to diguyAgentParams::set_focus_character(). This is a shortcut for setting the current focus character for all characters in the crowd.

The current focus group will not be affected by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_focus_group

Prototype:

int set_current_focus_group(const char* focus_group_name);
Description:

Similar to diguyAgentParams::set_focus_group(). This is a shortcut for setting the current focus group for all characters in the crowd.

The current focus character will not be affected by this function.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_params_from_profile

Prototype:

int set_current_params_from_profile(const char* profile_name,
    int retain_focus_objects = 1,
    int retain_navigation_values = 1);
Description:

This is a shortcut for calling diguyCharacter::agent_set_current_params_from_profile() for all members of the crowd.

This will affect most of the parameters of agents in this crowd, including behavior, posture and variant, etc. Focus character and group by default are changed, but can be left alone by passing 0 for retain_focus_objects.

Arguments:

profile_namename of crowd profile whose default parameters should be used
retain_focus_objectspass 1 to change focus objects to those of the named profile, 0 to retain existing settings
retain_navigation_valuesDocumentation Pending
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::set_current_behavior_region_border_is_solid

Prototype:

void set_current_behavior_region_border_is_solid(int is_solid);
Description:

This is a shortcut for calling diguyCharacter::agent_set_current_behavior_region_border_is_solid() for all members of the crowd.

Sets whether the walls of the region the agent is in are solid. If they are, the agent will treat the walls as if they are solid walls in the environment. If not, the agent is free to walk through them.

Pass 1 to make border walls solid, 0 to make them freely passable.

Callable From:

function diguyCrowd::set_current_postures

Prototype:

void set_current_postures(diguyMotionPosture posture);
Description:

Sets the posture of all members of the crowd and restarts their behaviors.

function diguyCrowd::set_current_variants

Prototype:

void set_current_variants(diguyMotionVariant variant);
Description:

Sets the variant of all members of the crowd and restarts their behaviors.

function diguyCrowd::set_initial_params_from_profile

Prototype:

int set_initial_params_from_profile(const char* profile_name);
Description:

This function is similar to set_current_params_from_profile(), but instead sets initial params.

Arguments:

profile_namename of crowd profile whose default parameters should be used
Returns:

0 on success, -1 on failure

Callable From:

Query Functions

function diguyCrowd::is_current_behavior

Prototype:

int is_current_behavior(const char* behavior_name,
    float threshold = 0.5f);
Description:

This is a query function meant to allow for flexible behavior when dealing with a crowd. If more than threshold ratio are doing behavior_name then the function will return 1. The default 0.5 yields a simple majority check.

Returns:

1 if true, 0 if false

Callable From:

function diguyCrowd::is_current_behavior_and_focus_character

Prototype:

int is_current_behavior_and_focus_character(const char* behavior_name,
    const char* focus_character_name,
    float threshold = 0.5f);
Description:

Similar to is_current_behavior(), but checks both behavior and focus character.

function diguyCrowd::is_current_behavior_and_focus_group

Prototype:

int is_current_behavior_and_focus_group(const char* behavior_name,
    const char* group_name,
    float threshold = 0.5f);
Description:

Similar to is_current_behavior(), but checks both behavior and focus group.

function diguyCrowd::is_crowd_dead

Prototype:

int is_crowd_dead(float threshold = 0.5f);
Description:

Similar to is_current_behavior(), but checks whether characters are dead.

Companion Crowd Functions

function diguyCrowd::add_companion_crowd

Prototype:

int add_companion_crowd(diguyCrowd* companion_crowd);
Description:

This function makes the specified crowd a "companion crowd" of this crowd. Crowd members of companion crowds know about each other and will attempt to avoid each other.

If two crowds are not companions, their respective crowd members will make no attempt to avoid each other.

Arguments:

companion_crowdname of crowd to become a companion
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::remove_companion_crowd

Prototype:

int remove_companion_crowd(diguyCrowd* companion_crowd);
Description:

This function removes the specified crowd as a companion crowd.

Arguments:

companion_crowdname of former companion
Returns:

0 on success, -1 on failure

Callable From:

Avoidance Method Functions

function diguyCrowd::set_dynamic_object_avoidance_method

Prototype:

void set_dynamic_object_avoidance_method(diguyDynamicAvoidanceMethod method);
Description:

This function sets the dynamic avoidance method that members of this crowd will use to avoid each other. Dynamic objects are objects that are moving around; these are almost always characters.

The enumeration is defined in diguy_constants.h.

Arguments:

methodavoidance method to use
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_dynamic_object_avoidance_method

Prototype:

diguyDynamicAvoidanceMethod get_dynamic_object_avoidance_method();
Returns:

current dynamic object avoidance method; see set_dynamic_object_avoidance_method()

Callable From:

function diguyCrowd::set_static_object_avoidance_method

Prototype:

void set_static_object_avoidance_method(diguyStaticAvoidanceMethod method);
Description:

This function sets the static avoidance method that members of this crowd will use to avoid walking through fixed walls and objects. Usually these are scene objects and fixed props.

The enumeration is defined in diguy_constants.h.

Arguments:

methodavoidance method to use
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::get_static_object_avoidance_method

Prototype:

diguyStaticAvoidanceMethod get_static_object_avoidance_method();
Returns:

current static object avoidance method; see set_static_object_avoidance_method()

Callable From:

Callback Functions

function diguyCrowd::get_callback_character

Prototype:

diguyCharacter* get_callback_character();
Description:

Many of the diguyCrowd callbacks set a callback character which represents if there was a particular character that the callback relates to. A few of the callbacks do not set this value.

Returns:

pointer of type diguyCharacter; NULL if there was no associated character

Callable From:

function diguyCrowd::get_callback_impact

Prototype:

diguyImpact* get_callback_impact();
Description:

Many of the diguyCrowd callbacks set a callback impact which represents if there was impact that the callback relates to. A few of the callbacks do not set this value.

Returns:

pointer of type diguyImpact; NULL if there was no associated impact

Callable From:

enumeration

	enum {
		CALLBACK_ID_CREATE = 1,
		CALLBACK_ID_DESTROY,
		CALLBACK_ID_CROWD_MEMBER_KILLED,
		CALLBACK_ID_CROWD_MEMBER_IMPACT,
		CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT,
		CALLBACK_ID_NEARBY_WEAPON_FIRED,

	};
Description:

This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script().

CALLBACK_ID_CREATE

This callback will be called when a new crowd is created.

Note that this callback can only be added by calling diguyScenario::add_default_crowd_callback(); adding it with diguyCrowd::add_callback() will have no effect, as by that time the crowd has already been created. There is no associated callback character.

CALLBACK_ID_DESTROY

This callback will be called when a crowd is destroyed. There is no associated callback character.

CALLBACK_ID_CROWD_MEMBER_KILLED

This callback will be called when a member of the crowd is killed.

CALLBACK_ID_CROWD_MEMBER_IMPACT

Similar to diguyCharacter::CALLBACK_ID_IMPACT, this callback will be called when a member of the crowd is hit by a detonation. If this callback isn't present the impacted character automatically will die. Handling this callback allows for the implementation of custom damage models at a crowd level.

CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT

This callback will be called when a detonation occurs within the awareness radius (as set by set_awareness_radius()) of the crowd's current bounds.

CALLBACK_ID_NEARBY_WEAPON_FIRED

This callback will be called when a weapon is fired within the awareness radius (as set by set_awareness_radius()) of the crowd's current bounds.

Callbacks return a value of type diguyCallbackReturn, which will be DIGUY_CALLBACK_STOP or DIGUY_CALLBACK_CONTINUE. If the callback returns DIGUY_CALLBACK_STOP, the default handler of the function will not be called; the callback is asserting that it has done everything necessary for the function call. If the callback returns DIGUY_CALLBACK_CONTINUE, the default handler for the function will be called after the callback.

Usable From:

function diguyCrowd::add_callback

Prototype:

int add_callback(int callback_id,
    diguyCrowdCallback* callback,
    void* callback_params = 0,
    void* callback_user_data = 0);
Description:

This function adds a user callback. Callbacks can be removed with remove_callback() or remove_callback_with_user_data().

Arguments:

callback pointer to function with prototype diguyCrowdRegionCallback (typedefed above)
callback_id integer id of when this callback is to be called
callback_paramsnot currently used; pass NULL
callback_user_datapointer for user's own use; DI-Guy will do nothing to the contents of this pointer beyond passing it back when the callback is invoked
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::remove_callback

Prototype:

int remove_callback(int callback_id,
    diguyCrowdCallback* callback);
Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback function will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback pointer to function with prototype diguyCrowdCallback (typedefed above)
Returns:

0 on success, -1 on failure

function diguyCrowd::remove_callback_with_user_data

Prototype:

int remove_callback_with_user_data(int callback_id,
    void* callback_user_data);
Description:

This function removes a user callback. All callbacks matching the specified callback_id and callback_user_data pointer will be removed.

Arguments:

callback_id integer id of when this callback is to be called
callback_user_datapointer for user's own use
Returns:

0 on success, -1 on failure

function diguyCrowd::add_callback_script

Prototype:

int add_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

This function adds a user callback script. Callback scripts can be removed with remove_callback_script().

See diguyCharacter::add_callback_script() for an example of use.

Arguments:

callback_id integer id of the callback
callback_script script text of callback to be added
callback_script_typethe type of script contained in callback_script
If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

lua specific:

When the script is called, the object for which it is being called will be in the callback_object global.

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::remove_callback_script

Prototype:

int remove_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

This function removes a user callback script previously added with add_callback_script().

See diguyCharacter::remove_callback_script() for an example of use.

Arguments:

callback_id integer id of the callback
callback_script script text of callback previously added
callback_script_typethe type of script contained in callback_script
If NULL is passed for callback_script, all callback scripts whose ids match callback_id and whose types match callback_script_type will be removed.

If NULL is passed for callback_script_type, a default script type will be derived based on the default script interpreter of the scenario.

lua specific:

To pass NULL when calling from a lua script, use nil.

Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::all_members_add_character_callback

Prototype:

void all_members_add_character_callback(int callback_id,
    diguyCharacterCallback* callback,
    void* callback_params = NULL,
    void* callback_user_data = NULL);
Description:

Equivalent to calling diguyCharacter::add_callback() for all members of the crowd.

Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.

function diguyCrowd::all_members_remove_character_callback

Prototype:

void all_members_remove_character_callback(int callback_id,
    diguyCharacterCallback* callback);
Description:

Equivalent to calling diguyCharacter::remove_callback() for all members of the crowd.

Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.

function diguyCrowd::all_members_remove_character_callback_with_user_data

Prototype:

void all_members_remove_character_callback_with_user_data(int callback_id,
    void* callback_user_data);
Description:

Equivalent to calling diguyCharacter::remove_callback_with_user_data() for all members of the crowd.

Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.

function diguyCrowd::all_members_add_character_callback_script

Prototype:

void all_members_add_character_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

Equivalent to calling diguyCharacter::add_callback_script() for all members of the crowd.

Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.

function diguyCrowd::all_members_remove_character_callback_script

Prototype:

void all_members_remove_character_callback_script(int callback_id,
    const char* callback_script,
    const char* callback_script_type = NULL);
Description:

Equivalent to calling diguyCharacter::remove_callback_script() for all members of the crowd.

Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.

Event Handler Functions

function diguyCrowd::map_event_handler_to_callback_id

Prototype:

int map_event_handler_to_callback_id(int callback_id,
    const char* handler_name);
Description:

This function maps the event handler with the given name to a callback id. This mapping will be saved in the .dss file and restored when the .dss file is loaded.

Mappings can also be made via the DI-Guy Scenario UI.

The event handler is one of the following:

Arguments:

callback_id integer id of callback
handler_name name of the event handler to map
Returns:

0 on success, -1 on failure

Callable From:

function diguyCrowd::unmap_event_handler_from_callback_id

Prototype:

int unmap_event_handler_from_callback_id(int callback_id,
    const char* handler_name,
    int unmap_all_matches = 0);
Description:

This function unmaps the event handler with the given name from a callback id.

Arguments:

callback_id integer id of callback
handler_name name of the event handler to map
unmap_all_matches pass 0 to unmap only the first match, pass 1 to unmap all matches
Returns:

0 on success, -1 on failure

Callable From:

Region Functions

function diguyCrowd::find_or_create_region

Prototype:

diguyRegion* find_or_create_region();
Returns:

diguyRegion associated with the crowd; will be created if it doesn't currently exist

function diguyCrowd::get_region

Prototype:

diguyRegion* get_region();
Returns:

diguyRegion associated with the crowd; may be NULL

Message Functions

function diguyCrowd::send_message_to_all_members

Prototype:

void send_message_to_all_members(const char* message_type,
    const char* message,
    const char* message_params = NULL);
Description:

Equivalent to calling diguyCharacter::agent_accept_message() for all members of the crowd.

Arguments:

message_type what type of message is being sent
message the message string
message_paramsoptional parameter string
Callable From:

Unit Functions

function diguyCrowd::set_unit_type

Prototype:

void                 set_unit_type(diguyTacticsUnitType tut);

function diguyCrowd::get_unit_type

Prototype:

diguyTacticsUnitType get_unit_type();

function diguyCrowd::set_unit_leader

Prototype:

int                  set_unit_leader(diguyCharacter* leader);

function diguyCrowd::get_unit_leader

Prototype:

diguyCharacter*      get_unit_leader();
Experimental Functions
The following functions are experimental and may change or disappear with no warning.


Alphabetical Index




Copyright (C) 1992-2012 Boston Dynamics

ALL RIGHTS RESERVED.

These coded instructions, statements, and computer programs contain unpublished proprietary information of Boston Dynamics and are protected by Copyright Laws of the United States. They may not be used, duplicated, or disclosed in any form, in whole or in part, without the prior written consent from Boston Dynamics.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the government is subject to restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Sofware clause at DFARS 252.227-7013 and/or in similar or successor clauses in the FAR, or the DOD or NASA FAR Supplement, or to subparagraphs (c)(1) and (c)(2) of the Commercial Computer Software--Restricted Rights at 48 CFR 52.227-19, as applicable. Unpublished-rights reserved under the Copyright Laws of the United States.

Contractor/Manufacturer is:

Boston Dynamics/78 Fourth Avenue/Waltham MA 02451.