Class Objects.Creature
A derivative of the Objects.Moveable class that represents the AI and behavior state of an enemy creature in the game.
Functions
| Creature(moveable) | Create creature info for the provided moveable. |
| GetMood() | Gets the current mood of the creature. |
| SetMood(mood) | Sets the mood of the creature. |
| GetTarget() | Gets the current target of the creature. |
| SetTarget(mov) | Sets a new target for the creature. |
| GetTargetPosition() | Gets the current target position of the creature. |
| GetAlerted() | Gets the creature's alerted state. |
| SetAlerted(enabled) | Sets the creature's alerted state. |
| GetFriendly() | Gets the creature's friendly state. |
| SetFriendly(enabled) | Sets the creature's friendly state. |
| GetHurtByPlayer() | Gets whether the creature has been hurt by the player. |
| SetHurtByPlayer(enabled) | Sets whether the creature has been hurt by the player. |
| GetPoisoned() | Gets the creature's poisoned state. |
| SetPoisoned(enabled) | Sets the creature's poisoned state. |
| GetAtGoal() | Gets whether the creature has reached its goal. |
| SetAtGoal(enabled) | Sets whether the creature has reached its goal. |
| GetLocationAI() | Get the OCB of the AI object that the enemy is currently trying to reach. |
| SetLocationAI(value) | Updates the AI object OCB that the creature should try to reach. |
| GetJumping() | Gets whether the creature's pathfinding currently involves a jump. |
| GetMonkeying() | Gets whether the creature's pathfinding currently involves monkey-swinging. |
| GetValid() | Checks if the underlying creature data is still valid. |
Functions
- Creature(moveable)
-
Create creature info for the provided moveable.
Parameters:
- moveable Moveable Moveable object to fetch creature from. Must be an active enemy.
Returns:
-
Creature
Creature info for the moveable.
- GetMood()
-
Gets the current mood of the creature.
Returns:
-
MoodType
The current mood of the creature. Never returns Objects.MoodType.AUTO,
because underlying mood is always resolved to another value by the AI. If creature is invalid, returns
nil. - SetMood(mood)
-
Sets the mood of the creature.
Overrides the automatic mood management and forces the creature's mood to the specified value.
Setting the mood to Objects.MoodType.AUTO will clear any mood override and allow the creature
to automatically manage the mood according to the AI.
Parameters:
- mood MoodType The mood to set.
- GetTarget()
-
Gets the current target of the creature.
Returns:
-
Moveable
The moveable object representing the target. If creature is invalid or target is not set, returns
nil. - SetTarget(mov)
-
Sets a new target for the creature.
Parameters:
- mov
Moveable
The moveable object to set as the target. Set to
nilto clear the target.
- mov
Moveable
The moveable object to set as the target. Set to
- GetTargetPosition()
-
Gets the current target position of the creature.
Target position may differ from the actual enemy position if predictionFactor is set.
If no enemy is currently set or mood is set to bored or stalk, returns the position where the creature is currently heading to.
Returns:
-
Vec3
The position of the creature's target. If creature is invalid, returns
nil. - GetAlerted()
-
Gets the creature's alerted state.
Returns:
-
bool
trueif creature is alerted,falseif not alerted. If creature is invalid, returnsnil. - SetAlerted(enabled)
-
Sets the creature's alerted state.
Parameters:
- enabled
bool
truesets creature as alerted,falseclears the alert state.
- enabled
bool
- GetFriendly()
-
Gets the creature's friendly state.
If creature was attacked by player, friendly state alone is not enough to know whether a creature is violent. For such cases,
Objects.Creature.GetHurtByPlayer must also be used in combination with this method.
Returns:
-
bool
trueif the creature is marked as friendly,falseif it is marked as not friendly. If creature is invalid, returnsnil. - SetFriendly(enabled)
-
Sets the creature's friendly state.
Friendly creatures will not attack the player unless player attacks them first, except special cases when behavior is hardcoded.
If a friendly creature was attacked by player, Objects.Creature.SetHurtByPlayer must be set to
falseas well to stop them attacking player.Parameters:
- enabled
bool
truesets creature as friendly,falsesets it as hostile.
- enabled
bool
- GetHurtByPlayer()
-
Gets whether the creature has been hurt by the player.
Returns:
-
bool
truemeans that creature was hurt by player,falsemeans it was not hurt by player. If creature is invalid, returnsnil. - SetHurtByPlayer(enabled)
-
Sets whether the creature has been hurt by the player. This flag influences
creature mood toward escape behavior.
Parameters:
- enabled
bool
truemarks the creature as hurt by player,falseclears hurt state.
- enabled
bool
- GetPoisoned()
-
Gets the creature's poisoned state.
Returns:
-
bool
truemeans the creature is poisoned,falsemeans it's not poisoned. If creature is invalid, returnsnil. - SetPoisoned(enabled)
-
Sets the creature's poisoned state.
Poisoned creatures take periodic damage and may be slowly killed, if killPoisonedEnemies setting is on.
Parameters:
- enabled
bool
truesets creature as poisoned,falseclears poisoned state.
- enabled
bool
- GetAtGoal()
-
Gets whether the creature has reached its goal.
This setting may be used to find out whether a creature that is using AI nullmesh objects has reached its currently specified AI nullmesh.
Returns:
-
bool
truemeans the creature has reached the goal,falsemeans it's not at goal. If creature is invalid, returnsnil. - SetAtGoal(enabled)
-
Sets whether the creature has reached its goal.
This setting may be used to break out the creature from reaching the next specified AI object nullmesh.
Parameters:
- enabled
bool
truemarks the creature as having reached the goal,falseclears goal reached state.
- enabled
bool
- GetLocationAI()
-
Get the OCB of the AI object that the enemy is currently trying to reach. Used by specific enemies for custom waypoint logic:
- Objects.ObjID.SOPHIA_LEIGH_BOSS
- Objects.ObjID.VON_CROY
- Objects.ObjID.GUIDE, only if he has ItemFlags[2] bit 1 set.
Returns:
-
int
The current AI location index. If creature is invalid, returns
nil. - SetLocationAI(value)
-
Updates the AI object OCB that the creature should try to reach. Used by specific enemies for custom waypoint logic:
- Objects.ObjID.SOPHIA_LEIGH_BOSS
- Objects.ObjID.VON_CROY
- Objects.ObjID.GUIDE, only if he has ItemFlags[2] bit 1 set (otherwise, he ignores it and simply look for the next AI object OCB until he reaches the one set by the last call to flipeffect 30).
Parameters:
- value int The AI location index to set.
- GetJumping()
-
Gets whether the creature's pathfinding currently involves a jump.
Only works for enemies that support jumping.
Returns:
-
bool
trueif creature is jumping or about to jump,falseif not jumping. If creature is invalid, returnsnil. - GetMonkeying()
-
Gets whether the creature's pathfinding currently involves monkey-swinging.
Returns:
-
bool
trueif creature is monkey-swinging,falseif not. If creature is invalid, returnsnil. - GetValid()
-
Checks if the underlying creature data is still valid. Returns
falseif the creature was killed or disabled.Returns:
-
bool
trueif creature data is valid,falseif creature was killed or disabled.
