![]() |
DI-Guy SDK Documentation
13.5
|
The portion of the API focused on dynamic agents. More...
Classes | |
| class | diguyAgentParams |
| The class that represents what parameters an agent is currently using to carry out their base behavior. More... | |
| class | diguyCrowd |
| The class that represents a DI-Guy Crowd, DI-Guy AI agents can be given orders at an individual level or via the entire group that they associate with. More... | |
| class | diguyCrowdProfile |
| The class that represents the makeup and base params of a diguyCrowd. More... | |
| class | diguyRegion |
| A two-and-a-half-dimensional surface that represents either a navigation mesh or an area that's been painted by hand with the crowd painter. More... | |
Callback Functions | |
Unless otherwise specified, callable from:
| |
| enum | { diguyCrowd::CALLBACK_ID_CREATE = 1, diguyCrowd::CALLBACK_ID_DESTROY, diguyCrowd::CALLBACK_ID_CROWD_MEMBER_KILLED, diguyCrowd::CALLBACK_ID_CROWD_MEMBER_IMPACT, diguyCrowd::CALLBACK_ID_NEARBY_SCENE_OBJECT_IMPACT, diguyCrowd::CALLBACK_ID_NEARBY_WEAPON_FIRED, diguyCrowd::CALLBACK_ID_SETPUBLISHED } |
| This is an enumeration of the different callbacks that can be registered with add_callback() and add_callback_script(). More... | |
| diguyCharacter * | diguyCrowd::get_callback_character () |
| Many of the diguyCrowd callbacks set a callback character which represents if there was a particular character that the callback relates to. More... | |
| diguyImpact * | diguyCrowd::get_callback_impact () |
| Many of the diguyCrowd callbacks set a callback impact which represents if there was impact that the callback relates to. More... | |
| int | diguyCrowd::add_callback (int callback_id, diguyCrowdCallback *callback, void *callback_params=0, void *callback_user_data=0) |
| This function adds a user callback. More... | |
| int | diguyCrowd::remove_callback (int callback_id, diguyCrowdCallback *callback) |
| This function removes a user callback. More... | |
| int | diguyCrowd::remove_callback_with_user_data (int callback_id, void *callback_user_data) |
| This function removes a user callback. More... | |
| int | diguyCrowd::add_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function adds a user callback script. More... | |
| int | diguyCrowd::remove_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| This function removes a user callback script previously added with add_callback_script(). More... | |
| void | diguyCrowd::all_members_add_character_callback (int callback_id, diguyCharacterCallback *callback, void *callback_params=NULL, void *callback_user_data=NULL) |
| Equivalent to calling diguyCharacter::add_callback() for all members of the crowd. More... | |
| void | diguyCrowd::all_members_remove_character_callback (int callback_id, diguyCharacterCallback *callback) |
| Equivalent to calling diguyCharacter::remove_callback() for all members of the crowd. More... | |
| void | diguyCrowd::all_members_remove_character_callback_with_user_data (int callback_id, void *callback_user_data) |
| Equivalent to calling diguyCharacter::remove_callback_with_user_data() for all members of the crowd. More... | |
| void | diguyCrowd::all_members_add_character_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| Equivalent to calling diguyCharacter::add_callback_script() for all members of the crowd. More... | |
| void | diguyCrowd::all_members_remove_character_callback_script (int callback_id, const char *callback_script, const char *callback_script_type=NULL) |
| Equivalent to calling diguyCharacter::remove_callback_script() for all members of the crowd. More... | |
The portion of the API focused on dynamic agents.
| anonymous enum |
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. - The callback character is the crowd member that was killed. - The callback impact contains the impact information.
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. - The callback character is the crowd member that was hit. - The callback impact contains the impact information.
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.
- The callback character is the character that caused the
detonation.
- The callback impact contains the impact information.
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. - The callback character is the character that fired the weapon.
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:
| diguyCharacter* diguyCrowd::get_callback_character | ( | ) |
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
| diguyImpact* diguyCrowd::get_callback_impact | ( | ) |
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
| int diguyCrowd::add_callback | ( | int | callback_id, |
| diguyCrowdCallback * | callback, | ||
| void * | callback_params = 0, |
||
| void * | callback_user_data = 0 |
||
| ) |
This function adds a user callback.
Callbacks can be removed with remove_callback() or remove_callback_with_user_data().
| callback | pointer to function with prototype diguyCrowdRegionCallback (typedefed above) |
| callback_id | integer id of when this callback is to be called |
| callback_params | not currently used; pass NULL |
| callback_user_data | pointer 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:
| int diguyCrowd::remove_callback | ( | int | callback_id, |
| diguyCrowdCallback * | callback | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback function will be removed.
| 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
| int diguyCrowd::remove_callback_with_user_data | ( | int | callback_id, |
| void * | callback_user_data | ||
| ) |
This function removes a user callback.
All callbacks matching the specified callback_id and callback_user_data pointer will be removed.
| callback_id | integer id of when this callback is to be called |
| callback_user_data | pointer for user's own use |
Returns:
0 on success, -1 on failure
| int diguyCrowd::add_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
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.
| callback_id | integer id of the callback |
| callback_script | script text of callback to be added |
| callback_script_type | the 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
| int diguyCrowd::remove_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
This function removes a user callback script previously added with add_callback_script().
See diguyCharacter::remove_callback_script() for an example of use.
| callback_id | integer id of the callback |
| callback_script | script text of callback previously added |
| callback_script_type | the 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
| void diguyCrowd::all_members_add_character_callback | ( | int | callback_id, |
| diguyCharacterCallback * | callback, | ||
| void * | callback_params = NULL, |
||
| void * | callback_user_data = NULL |
||
| ) |
Equivalent to calling diguyCharacter::add_callback() for all members of the crowd.
Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.
Callable From:
| void diguyCrowd::all_members_remove_character_callback | ( | int | callback_id, |
| diguyCharacterCallback * | callback | ||
| ) |
Equivalent to calling diguyCharacter::remove_callback() for all members of the crowd.
Note: callback_id should be a diguyCharacter id, not a diguyCrowd id.
Callable From:
| void diguyCrowd::all_members_remove_character_callback_with_user_data | ( | int | callback_id, |
| void * | callback_user_data | ||
| ) |
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.
Callable From:
| void diguyCrowd::all_members_add_character_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
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.
| void diguyCrowd::all_members_remove_character_callback_script | ( | int | callback_id, |
| const char * | callback_script, | ||
| const char * | callback_script_type = NULL |
||
| ) |
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.