Difference between revisions of "Script/Creature"

From SF3
Jump to: navigation, search
(Class Methods)
Line 96: Line 96:
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
| style='color: black; width: 90%; line-height: 1.0;' | '''GetEquipment''' (const [[../BasicDataTypes|EItemSlot]] ''_Slot'', [[../BasicDataTypes|string]]&out ''_sOutItemName'') const
+
| style='color: black; width: 90%; line-height: 1.0;' | '''GetEquipment''' (const [[../LogicEnums#EItemSlot|EItemSlot]] ''_Slot'', [[../BasicDataTypes|string]]&out ''_sOutItemName'') const
 
|-
 
|-
 
|
 
|
Line 102: Line 102:
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
| style='color: black; width: 90%; line-height: 1.0;' | '''Equip''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../BasicDataTypes|EItemSlot]] ''_Slot'', const [[../BasicDataTypes|string]]&in ''_sItemName'', const [[../BasicDataTypes|ECreatureEquipMode]] ''_Mode'')
+
| style='color: black; width: 90%; line-height: 1.0;' | '''Equip''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../LogicEnums#EItemSlot|EItemSlot]] ''_Slot'', const [[../BasicDataTypes|string]]&in ''_sItemName'', const [[../LogicEnums#ECreatureEquipMode|ECreatureEquipMode]] ''_Mode'')
 
|-
 
|-
 
|
 
|
Line 108: Line 108:
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
| style='color: black; width: 90%; line-height: 1.0;' | '''Unequip''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../BasicDataTypes|EItemSlot]] ''_Slot'', const [[../BasicDataTypes|ECreatureUnequipMode]] ''_Mode'')
+
| style='color: black; width: 90%; line-height: 1.0;' | '''Unequip''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../LogicEnums#EItemSlot|EItemSlot]] ''_Slot'', const [[../LogicEnums#ECreatureUnequipMode|ECreatureUnequipMode]] ''_Mode'')
 
|-
 
|-
 
|
 
|

Revision as of 15:15, 29 September 2016

class Creature

Represents a reference to a creature in the game world. An instance of this class acts like a weak pointer to an existing creature in the game world and provides an interface to interact with it. Before interacting with the creature, you should call Exists() in order to check if the creature actually (still) exists. IMPORTANT: This class must NOT be stored as a class member. If you want to store the creature for later reference, store the id obtained by GetId instead. You can then later retrieve the creature from the LevelReference class by calling GetCreatureById.

Inherits from: Entity

Class Methods

string GetDescriptionName () const
get creature description name
ECreatureType GetCreatureType () const
get creature type
int GetCurrentHP () const
get current creature health
int GetMaxHP () const
get maximum creature health
void Heal (const uint _uHP)
heal the creature for _uHP health points
bool CanVisitPOIs () const
can the creature visit POIs?
bool IsPOIVisitingBehaviorEnabled () const
is the creature's POI visiting behavior currently enabled?
void EnablePOIVisitingBehavior (const bool _bEnable)
enable or disable POI visiting behavior (only works for creatures where CanVisitPOIs is true)
bool IsPlayerControllable () const
can the creature be given commands by the player?
void SetPlayerControllable (const bool _bControllable)
set whether the creature can be controlled by the player
bool IsImmovable () const
can the creature be pushed around by others while idle?
void SetImmovable (const bool _bImmovable)
set whether the creature can be pushed around by others while idle (only valid until the creature gets another command).
bool AreAttacksAllowed () const
can the creature perform attacks?
void AllowAttacks (const bool _bAllow)
set whether the creature can perform attacks
bool GetEquipment (const EItemSlot _Slot, string&out _sOutItemName) const
get the item currently equipped in the given slot of the creature. returns false if there was no item in the given slot.
bool Equip (LevelReference@ _Level, const EItemSlot _Slot, const string&in _sItemName, const ECreatureEquipMode _Mode)
equip the given item in the given slot. returns true if successful.
bool Unequip (LevelReference@ _Level, const EItemSlot _Slot, const ECreatureUnequipMode _Mode)
unequip the item currently in the given slot. returns false if there was no item in the given slot.
bool Damage (const EDamageType _DamageType, const uint _uAmount)
damage the creature for _uAmount HP of the given damage type, returns true if killed
void Kill ()
immediately kill the creature
void Revive ()
revive the creature if it's dead and refill its health
void Stop (LevelReference@ _Level)
stop the creature dead in its tracks immediately. cancels any pending orders.
void FollowPath (LevelReference@ _Level, const string&in _sPathName, const bool _bForward, const bool _bQueued)
make the creature walk along the given path
void FollowCreature (LevelReference@ _Level, const Creature&in _Target, const uint _uMinDistance, const uint _uMaxDistance, const bool _bQueued)
make the creature follow another creature
void GoTo (LevelReference@ _Level, const Entity&in _Target, const uint _uMinDistance, const uint _uMaxDistance, const bool _bQueued)
make the creature walk to the given target
bool Interact (LevelReference@ _Level, const Entity&in _Target, const bool _bQueued, const uint8 _uFaction = kMaxFactions, const uint8 _uControlIndex = 0)
make the creature interact with the given target
bool Talk (LevelReference@ _Level, const Entity&in _Target, const string&in _sContainerName, const string&in _sTopicName, const bool _bQueued, const uint8 _uFaction = kMaxFactions, const uint8 _uControlIndex = 0)
make the creature talk to the given target
bool Shoutout (LevelReference@ _Level, const string&in _sContainerName, const string&in _sTopicName, const bool _bQueued, const uint8 _uFaction = kMaxFactions, const uint8 _uControlIndex = 0)
make the creature talk to itself.
void DropItem (LevelReference@ _Level, const string&in _sItemName, const uint _uAmount)
drop the given item at the creature's feet
Creature& operator= (const Creature&in)
bool operator== (const Creature&in)
bool operator== (const Entity&in)
bool Exists () const
does the entity actually exist? (always check this before doing anything with the entity!)
uint GetId () const
get persistent entity id, use this to save the entity for later reference.
uint8 GetFaction () const
get owner faction
void SetFaction (const uint8 _Faction)
set owner faction
EEntityType GetEntityType () const
get entity type
bool IsEnabled () const
whether the entity is currently enabled (i.e. is visible in the game world)
void Enable (const bool _bEnabled)
enabled or disable the entity
bool IsInteractive () const
can the entity be interacted with?
void SetInteractive (const bool _bInteractive)
set whether the entity can be interacted with
bool IsBusy () const
is the entity currently marked as busy?
void SetBusy (const bool _bBusy)
mark the entity as busy
bool CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked
Entity opImplConv () const