Difference between revisions of "Script/Creature"

From SF3
Jump to: navigation, search
(class Creature)
Line 1: Line 1:
==class Building==
+
==class Creature==
Represents a reference to a building in the game world.
+
Represents a reference to a creature in the game world.
An instance of this class acts like a weak pointer to an existing building in the game world and provides an interface to interact
+
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.
 
with it.
Before interacting with the building, you should call Exists() in order to check if the building actually (still) exists.
+
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 building for later reference, store the id
+
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 building from the LevelReference class by calling GetBuildingById.   
+
obtained by GetId instead. You can then later retrieve the creature from the LevelReference class by calling GetCreatureById.   
  
 
'''Inherits from:''' [[../Entity|Entity]]
 
'''Inherits from:''' [[../Entity|Entity]]
Line 15: Line 15:
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''get building description name''
+
| style = 'color: #505050; line-height: 0.5;' |''get creature description name''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|string]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|string]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''GetBuildingType''' () const
+
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCreatureType''' () const
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''get building type name''
+
| style = 'color: #505050; line-height: 0.5;' |''get creature type name''
 
|-
 
|-
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|string]]  
+
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|int]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''GetStage''' () const
+
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCurrentHP''' () const
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''get current building stage name''
+
| style = 'color: #505050; line-height: 0.5;' |''get current creature health''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|int]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|int]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''GetCurrentHP''' () const
+
| style='color: black; width: 90%; line-height: 0.8;' | '''GetMaxHP''' () const
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''get current building health''
+
| style = 'color: #505050; line-height: 0.5;' |''get maximum creature health''
 
|-
 
|-
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|int]]  
+
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''GetMaxHP''' () const
+
| style='color: black; width: 90%; line-height: 0.8;' | '''IsPlayerControllable''' () const
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''get maximum building health''
+
| style = 'color: #505050; line-height: 0.5;' |''can the creature be given commands by the player?''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''Charge''' (const [[../BasicDataTypes|int]] ''_iChargePoints'')
+
| style='color: black; width: 90%; line-height: 0.8;' | '''SetPlayerControllable''' (const [[../BasicDataTypes|bool]] ''_bControllable'')
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''modify charge value of a charge type building''
+
| style = 'color: #505050; line-height: 0.5;' |''set whether the creature can be controlled by the player''
 
|-
 
|-
 
| 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: 0.8;' | '''IsActive''' () const
+
| style='color: black; width: 90%; line-height: 0.8;' | '''IsImmovable''' () const
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''is the building currently active? (assignments can be given by the player)''
+
| style = 'color: #505050; line-height: 0.5;' |''can the creature be pushed around by others while idle?''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''SetActive''' (const [[../BasicDataTypes|bool]] ''_bActive'')
+
| style='color: black; width: 90%; line-height: 0.8;' | '''SetImmovable''' (const [[../BasicDataTypes|bool]] ''_bImmovable'')
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''set whether the player can give assignments to the building''
+
| style = 'color: #505050; line-height: 0.5;' |''set whether the creature can be pushed around by others while idle (only valid until the creature gets another command).''
 
|-
 
|-
 
| 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]]  
Line 63: Line 63:
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''damage the building for _uAmount HP of the given damage type, returns true if destroyed''
+
| style = 'color: #505050; line-height: 0.5;' |''damage the creature for _uAmount HP of the given damage type, returns true if killed''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''Kill''' ()
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''immediately kill the creature''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''Stop''' ([[../LevelReference|LevelReference@]] ''_Level'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''stop the creature dead in its tracks immediately. cancels any pending orders.''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''FollowPath''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../BasicDataTypes|string]]&in ''_sPathName'', const [[../BasicDataTypes|bool]] ''_bForward'', const [[../BasicDataTypes|bool]] ''_bQueued'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''make the creature walk along the given path''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''GoTo''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../Entity|Entity]]&in ''_Target'', const [[../BasicDataTypes|uint]] ''_uMinDistance'', const [[../BasicDataTypes|uint]] ''_uMaxDistance'', const [[../BasicDataTypes|bool]] ''_bQueued'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''make the creature walk to the given target''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''Interact''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../Entity|Entity]]&in ''_Target'', const [[../BasicDataTypes|bool]] ''_bQueued'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''make the creature interact with the given target''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''Talk''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../Entity|Entity]]&in ''_Target'', const [[../BasicDataTypes|string]]&in ''_sContainerName'', const [[../BasicDataTypes|string]]&in ''_sTopicName'', const [[../BasicDataTypes|bool]] ''_bQueued'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''make the creature talk to the given target''
 +
|-
 +
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|bool]]
 +
| style='color: black; width: 90%; line-height: 0.8;' | '''Shoutout''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../BasicDataTypes|string]]&in ''_sContainerName'', const [[../BasicDataTypes|string]]&in ''_sTopicName'', const [[../BasicDataTypes|bool]] ''_bQueued'')
 +
|-
 +
|
 +
| style = 'color: #505050; line-height: 0.5;' |''make the creature talk to itself.''
 
|-
 
|-
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
 
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../BasicDataTypes|void]]  
| style='color: black; width: 90%; line-height: 0.8;' | '''Destroy''' ()
+
| style='color: black; width: 90%; line-height: 0.8;' | '''DropItem''' ([[../LevelReference|LevelReference@]] ''_Level'', const [[../BasicDataTypes|string]]&in ''_sItemName'', const [[../BasicDataTypes|uint]] ''_uAmount'')
 
|-
 
|-
 
|
 
|
| style = 'color: #505050; line-height: 0.5;' |''immediately destroy the building''
+
| style = 'color: #505050; line-height: 0.5;' |''drop the given item at the creature's feet''
 
|-
 
|-
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../Building|Building]]&  
+
| style='color: blue; width: 10%; text-align:right;line-height: 0.8;' | [[../Creature|Creature]]&  
| style='color: black; width: 90%; line-height: 0.8;' | '''operator=''' (const [[../Building|Building]]&in)
+
| style='color: black; width: 90%; line-height: 0.8;' | '''operator=''' (const [[../Creature|Creature]]&in)
 
|-
 
|-
 
|-
 
|-
 
| 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: 0.8;' | '''operator==''' (const [[../Building|Building]]&in)
+
| style='color: black; width: 90%; line-height: 0.8;' | '''operator==''' (const [[../Creature|Creature]]&in)
 
|-
 
|-
 
|-
 
|-

Revision as of 08:52, 1 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
string GetCreatureType () const
get creature type name
int GetCurrentHP () const
get current creature health
int GetMaxHP () const
get maximum creature health
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 Damage (const string&in _sDamageTypeName, 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 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 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)
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)
make the creature talk to the given target
bool Shoutout (LevelReference@ _Level, const string&in _sContainerName, const string&in _sTopicName, const bool _bQueued)
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
string GetEntityType () const
get entity type name
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 CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked
Entity opImplConv () const

class Building

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

Inherits from: Entity

Class Methods

string GetDescriptionName () const
get building description name
string GetBuildingType () const
get building type name
string GetStage () const
get current building stage name
int GetCurrentHP () const
get current building health
int GetMaxHP () const
get maximum building health
void Charge (const int _iChargePoints)
modify charge value of a charge type building
bool IsActive () const
is the building currently active? (assignments can be given by the player)
void SetActive (const bool _bActive)
set whether the player can give assignments to the building
bool Damage (const string&in _sDamageTypeName, const uint _uAmount)
damage the building for _uAmount HP of the given damage type, returns true if destroyed
void Destroy ()
immediately destroy the building
Building& operator= (const Building&in)
bool operator== (const Building&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
string GetEntityType () const
get entity type name
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 CanBeAttacked () const
can the entity be attacked?
void SetAttackable (const bool _bAttackable)
set whether the entity can be attacked
Entity opImplConv () const