PowerQuest  0.15.3
ICharacter Interface Reference

Detailed Description

Characters: Contains functions for manipluating Characters. Usually accessed with the C. prefix. Eg. C.Bob.FaceLeft(); For example:

    C.Barney.Room = R.Current;
    C.Player.WalkTo( P.Tree );
    if ( C.Player.Talking == false )
        C.Player.PlayAnimation("EatPizza");
    C.Bill.Position =  Points.UnderTree;
    C.Barney.SayBG("What's all this then?");
    Dave: Ah... Nothing!
    C.Player.AnimWalk = "Run";
    C.Barney.Description = "A strange looking fellow with a rat-tail";

Inherits IQuestClickableInterface.

Properties

string Description [get, set]
 Gets/Sets the name shown to players. More...
 
string ScriptName [get]
 The name used in scripts. More...
 
MonoBehaviour Instance [get]
 Access to the actual game object component in the scene. More...
 
IRoom Room [get, set]
 The room the character's in. Setting this moves the character to another room. If the player character is moved, the scene will change to the new room. More...
 
IRoom LastRoom [get]
 Returns the last room visited before the current one. More...
 
Vector2 Position [get, set]
 The location of the character. Eg: C.Player.Position = new Vector2(10,20); or C.Dave.Position = Point.UnderTree; More...
 
Vector2 TargetPosition [get]
 The positiont the character is currently at, or walking towards. More...
 
float Baseline [get, set]
 The position of the character's baseline (for sorting) More...
 
Vector2 WalkSpeed [get, set]
 The speed the character walks horizontally and vertically. Eg: C.Player.WalkSpeed = new Vector2(10,20); More...
 
bool TurnBeforeWalking [get, set]
 Whether character turns before walking. More...
 
bool TurnBeforeFacing [get, set]
 Whether character turns before facing (eg: with C.Player.FaceLeft();. More...
 
float TurnSpeedFPS [get, set]
 How fast characters turn (turning-frames-per-second) More...
 
bool AdjustSpeedWithScaling [get, set]
 Whether the walk speed adjusts to match the size of th character when scaled by regions. More...
 
Vector2 SolidSize [get, set]
 Gets/sets the character's blocking width and height. More...
 
bool UseSpriteAsHotspot [get, set]
 Gets/sets whether the character uses it's sprite as it's hotspot, instead of a collider specified in the inspector. More...
 
eFace Facing [get, set]
 The enumerated direction the character is facing. Useful when you want to set a character's face direction without them turning. More...
 
bool Clickable [get, set]
 Gets or Sets whether clicking on the object triggers an event. More...
 
bool Visible [get, set]
 Gets or sets whether the character visible flag is set. More...
 
bool VisibleInRoom [get]
 Gets whether the character is actually visible and in the current room. Same as (C.Fred.Visible && C.Fred.Room != null && C.Fred.Room == R.Current) More...
 
bool Solid [get, set]
 Gets/sets whether the character can be walked through by other characters. If this is set to true, then the character is solid and will block the path of other characters. If this is set to false, then the character acts like a hologram, and other characters can walk straight through him. More...
 
bool Moveable [get, set]
 Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored. More...
 
bool Walking [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is currently walking. More...
 
bool Talking [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is currently talking. More...
 
bool Animating [get]
 Gets a value indicating whether this PowerTools.Quest.ICharacter is playing an animation from PlayAnimation(), or Animation = "someAnim" NOT a regular Idle, walk or Talk anim. More...
 
bool IsPlayer [get]
 Whether this instance is the current player. More...
 
Color TextColour [get, set]
 Gets or sets the text colour for the character's speech text. More...
 
Vector2 TextPositionOverride [get, set]
 Gets or sets the position the player's dialog text will be shown (in world space). If set to zero, the default will be used (Displayed above the character sprite). More...
 
string AnimIdle [get, set]
 Gets or sets the idle animation of the character. More...
 
string AnimWalk [get, set]
 Gets or sets the walk animation of the character. More...
 
string AnimTalk [get, set]
 Gets or sets the talk animation of the character. More...
 
string AnimMouth [get, set]
 Gets or sets the lipsync mouth animation of the character, attached to a node. More...
 
string Cursor [get, set]
 Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used. More...
 
bool UseRegionTinting [get, set]
 Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region tinting. More...
 
bool UseRegionScaling [get, set]
 Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region scaling. More...
 
bool FirstUse [get]
 Returns true the first time the player "uses" the object. More...
 
bool FirstLook [get]
 Returns true the first time the player "looked" at the object. More...
 
int UseCount [get]
 Returns the number of times player has "used" at the object. 0 when it's the first click on the object. More...
 
int LookCount [get]
 Returns the number of times player has "looked" at the object. 0 when it's the first click on the object. More...
 
Vector2 WalkToPoint [get, set]
 Gets or sets the walk to point. More...
 
Vector2 LookAtPoint [get, set]
 Gets or sets the look at point. More...
 
string Animation [get, set]
 Gets or sets an override animation on the character. Until StopAnimation() is called, this will play, and AnimIdle,AnimTalk,AnimWalk will all be ignored. This is the equivalent of calling PlayAnimationBG() with pauseAtEnd set to true. More...
 
string FootstepSound [get, set]
 
int ClickableColliderId [get, set]
 Players can have more than one polygon collider for clicking on. Add them in the Character Component, and set which is active with this function. More...
 
IInventory ActiveInventory [get, set]
 Gets or sets the active inventory (item that's currently selected/being used) More...
 
string ActiveInventoryName [get, set]
 Gets or sets the active inventory (item that's currently selected/being used) More...
 
bool HasActiveInventory [get]
 Returns true if there's any active inventory (item that's currently selected/being used) More...
 
Character Data [get]
 Access to the base class with extra functionality used by the PowerQuest. More...
 

Public Member Functions

void SetPosition (float x, float y, eFace face=eFace.None)
 Set the location of the character, with an optional 'facing' direction. More...
 
void SetPosition (Vector2 position, eFace face=eFace.None)
 Set the location of the character, with an optional 'facing' direction. More...
 
Coroutine WalkTo (float x, float y, bool anywhere=false)
 Make the character walk to a position in game coords. More...
 
Coroutine WalkTo (Vector2 pos, bool anywhere=false)
 Make the character walk to a position in game coords. More...
 
Coroutine WalkTo (IQuestClickableInterface clickable, bool anywhere=false)
 Make the character walk to the walk-to-point of a clickable object. (characters, props, hotspots, etc) More...
 
void WalkToBG (float x, float y, bool anywhere=false, eFace thenFace=eFace.None)
 Make the character walk to a position in game coords without halting the script. More...
 
void WalkToBG (Vector2 pos, bool anywhere=false, eFace thenFace=eFace.None)
 Make the character walk to a position in game coords without halting the script. More...
 
void WalkToBG (IQuestClickableInterface clickable, bool anywhere=false, eFace thenFace=eFace.None)
 Make the character walk to the walk-to-point of a clickable object without halting the script. More...
 
Coroutine WalkToClicked (bool anywhere=false)
 Make the character walk to the walk-to-point of the last object clicked on. In QuestScripts you can use the shortcut WalkToClicked More...
 
Coroutine StopWalking ()
 Stop the character walking or moving. Also clears any waypoints. More...
 
void AddWaypoint (float x, float y, eFace thenFace=eFace.None)
 Tells the character to move to a location directly, after it has finished its current move. Ignores walkable areas. More...
 
void AddWaypoint (Vector2 pos, eFace thenFace=eFace.None)
 Tells the character to walk to a point directly, after it has finished its current move. Ignores walkable areas. More...
 
Coroutine MoveTo (float x, float y, bool anywhere=false)
 Make the character move to a position in game coords without playing their walk animation. More...
 
Coroutine MoveTo (Vector2 pos, bool anywhere=false)
 Make the character move to a position in game coords without playing their walk animation. More...
 
Coroutine MoveTo (IQuestClickableInterface clickable, bool anywhere=false)
 Make the character move to the walk-to-point of a clickable object. Their Walk animation will NOT be played. More...
 
void MoveToBG (float x, float y, bool anywhere=false)
 Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played. More...
 
void MoveToBG (Vector2 pos, bool anywhere=false)
 Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played. More...
 
void MoveToBG (IQuestClickableInterface clickable, bool anywhere=false)
 Make the character move to the walk-to-point of a clickable object without halting the script. Their Walk animation will NOT be played. More...
 
Coroutine ChangeRoom (IRoom room)
 Moves the character to another room. If the player character is moved, the scene will change to the new room and script will wait until after OnEnterRoomAfterFade finishes. More...
 
void ChangeRoomBG (IRoom room)
 Moves the character to another room. If the player character is moved, the scene will change to the new room. More...
 
void Show (bool clickable)
 Obsolete: Set's visible & clickable (Same as Enable(bool clickable)), and changes them to the current room (if they weren't there already) More...
 
void Show (Vector2 pos=new Vector2(), eFace facing=eFace.None)
 Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. More...
 
void Show (float posX, float posy, eFace facing=eFace.None)
 Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. More...
 
void Show (eFace facing)
 Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room. More...
 
void Hide ()
 Hides the character until Show() is called. Saves you setting Visible, Clickable, Solid all to false. (Same as Disable()) More...
 
void Enable ()
 Enables the character again after a call to Disable() or Hide(). Does NOT move them to the current room, or set Visible like Show() does. More...
 
void Enable (bool clickable)
 Obsolete: Set's visible & clickable, and changes them to the current room (if they weren't there already) More...
 
void Disable ()
 Disables the character until Enable() is called. Saves you setting Visible, Clickable, Solid all to false. More...
 
Coroutine Face (eFace direction, bool instant=false)
 Faces character in a direction. Turning, unless instant is false. More...
 
Coroutine Face (IQuestClickable clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot) More...
 
Coroutine Face (IQuestClickableInterface clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot) More...
 
Coroutine FaceDown (bool instant=false)
 Faces character down (towards camera) More...
 
Coroutine FaceUp (bool instant=false)
 Faces character up (away from camera) More...
 
Coroutine FaceLeft (bool instant=false)
 Faces character left. More...
 
Coroutine FaceRight (bool instant=false)
 Faces character right. More...
 
Coroutine FaceUpRight (bool instant=false)
 Faces character a specified direction. More...
 
Coroutine FaceUpLeft (bool instant=false)
 Faces character a specified direction. More...
 
Coroutine FaceDownRight (bool instant=false)
 Faces character a specified direction. More...
 
Coroutine FaceDownLeft (bool instant=false)
 Faces character a specified direction. More...
 
Coroutine Face (float x, float y, bool instant=false)
 Faces character towards a position in on screen coords. More...
 
Coroutine Face (Vector2 location, bool instant=false)
 Faces character towards a position in on screen coords. More...
 
Coroutine FaceClicked (bool instant=false)
 Faces character towards the look-at-point of the last object clicked on. More...
 
Coroutine FaceAway (bool instant=false)
 Faces character in opposite direction to current. More...
 
Coroutine FaceDirection (Vector2 directionV2, bool instant=false)
 Faces character in a direction. More...
 
void FaceBG (eFace direction, bool instant=false)
 Faces character in a direction. Turning, unless instant is false. Does NOT halt script. More...
 
void FaceBG (IQuestClickable clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script. More...
 
void FaceBG (IQuestClickableInterface clickable, bool instant=false)
 Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script. More...
 
void FaceDownBG (bool instant=false)
 Faces character down (towards camera). Does NOT halt script. More...
 
void FaceUpBG (bool instant=false)
 Faces character up (away from camera). Does NOT halt script. More...
 
void FaceLeftBG (bool instant=false)
 Faces character left. Does NOT halt script. More...
 
void FaceRightBG (bool instant=false)
 Faces character right. Does NOT halt script. More...
 
void FaceUpRightBG (bool instant=false)
 Faces character a specified direction. Does NOT halt script. More...
 
void FaceUpLeftBG (bool instant=false)
 Faces character a specified direction. Does NOT halt script. More...
 
void FaceDownRightBG (bool instant=false)
 Faces character a specified direction. Does NOT halt script. More...
 
void FaceDownLeftBG (bool instant=false)
 Faces character a specified direction. Does NOT halt script. More...
 
void FaceBG (float x, float y, bool instant=false)
 Faces character towards a position in on screen coords. Does NOT halt script. More...
 
void FaceBG (Vector2 location, bool instant=false)
 Faces character towards a position in on screen coords. Does NOT halt script. More...
 
void FaceClickedBG (bool instant=false)
 Faces character towards the look-at-point of the last object clicked on. Does NOT halt script. More...
 
void FaceAwayBG (bool instant=false)
 Faces character in opposite direction to current. Does NOT halt script. More...
 
void FaceDirectionBG (Vector2 directionV2, bool instant=false)
 Faces character in a direction. Does NOT halt script. More...
 
void StartFacingCharacter (ICharacter character, float minWaitTime=0.2f, float maxWaitTime=0.4f)
 Causes the character to face another character, and continue to turn to face them if either character moves.

Parameters
characterThe character to face
minWaitTimeThe minimum time delay before they'll turn to face the other character. Default 0.2 seconds.
maxWaitTimeThe maximum time delay before they'll turn to face the other character. Default 0.4 seconds.
More...
 
void StopFacingCharacter ()
 Stops the chracter facing another after a call to StartFacingCharacter() More...
 
Coroutine Say (string dialog, int id=-1)
 Make chracter speak a line of dialog. eg. C.Barney.Say("Hello"); Note that in QuestScript window you can just type Barney: Hello More...
 
Coroutine SayBG (string dialog, int id=-1)
 Make chracter speak a line of dialog, without halting the script. eg. C.Barney.SayBG("Some dialog I'm saying in the background"); More...
 
void CancelSay ()
 Cancel any current dialog the character's speaking. More...
 
Coroutine PlayAnimation (string animName)
 Play an animation on the character. Will return to idle after animation ends. More...
 
void PlayAnimationBG (string animName, bool pauseAtEnd=false)
 Play an animation on the character without halting the script. Will return to idle after animation ends, unless pauseAtEnd is true. More...
 
void PauseAnimation ()
 
void ResumeAnimation ()
 
void StopAnimation ()
 
void AddAnimationTrigger (string triggerName, bool removeAfterTriggering, System.Action action)
 Adds a function to be called on an animation event here. Eg: to play a sound or effect on an animation tag. More...
 
void RemoveAnimationTrigger (string triggerName)
 Removes an existing animation trigger. More...
 
Coroutine WaitForAnimTrigger (string eventName)
 Waits until an Event/Tag in the current animation is reached. More...
 
float GetInventoryItemCount ()
 Returns total number of inventory items that he player has. More...
 
float GetInventoryQuantity (string itemName)
 Gets the number of a particular inventory item the player has More...
 
bool HasInventory (string itemName)
 Returns true if the player has the specified inventory item. More...
 
bool GetEverHadInventory (string itemName)
 Returns true if the player has, or ever had the specified inventory item. More...
 
void AddInventory (string itemName, float quantity=1)
 Adds an item to the player's inventory More...
 
void RemoveInventory (string itemName, float quantity=1)
 Removes an item from the player's inventory. More...
 
float GetInventoryQuantity (IInventory item)
 Gets the number of a particular inventory item the player has More...
 
bool HasInventory (IInventory item)
 Returns true if the player has the specified inventory item. More...
 
bool GetEverHadInventory (IInventory item)
 Returns true if the player has, or ever had the specified inventory item. More...
 
void AddInventory (IInventory item, float quantity=1)
 Adds an item to the player's inventory More...
 
void RemoveInventory (IInventory item, float quantity=1)
 Removes an item from the player's inventory. More...
 
void ClearInventory ()
 Remove all inventory items from the player. More...
 
GetScript< T > ()
 PowerQuest internal function: Access to the specific quest script for the character. Pass the specific character class as the templated parameter so you can access specific members of the script. Eg: GetScript<CharacterBob>().m_saidHi = true;. More...
 

Property Documentation

◆ Description

string Description
getset

Gets/Sets the name shown to players.

◆ ScriptName

string ScriptName
get

The name used in scripts.

◆ Instance

MonoBehaviour Instance
get

Access to the actual game object component in the scene.

◆ Room

IRoom Room
getset

The room the character's in. Setting this moves the character to another room. If the player character is moved, the scene will change to the new room.

See also
ChangeRoom()
ChangeRoomBG()

◆ LastRoom

IRoom LastRoom
get

Returns the last room visited before the current one.

◆ Position

Vector2 Position
getset

The location of the character. Eg: C.Player.Position = new Vector2(10,20); or C.Dave.Position = Point.UnderTree;

◆ TargetPosition

Vector2 TargetPosition
get

The positiont the character is currently at, or walking towards.

◆ Baseline

float Baseline
getset

The position of the character's baseline (for sorting)

◆ WalkSpeed

Vector2 WalkSpeed
getset

The speed the character walks horizontally and vertically. Eg: C.Player.WalkSpeed = new Vector2(10,20);

◆ TurnBeforeWalking

bool TurnBeforeWalking
getset

Whether character turns before walking.

◆ TurnBeforeFacing

bool TurnBeforeFacing
getset

Whether character turns before facing (eg: with C.Player.FaceLeft();.

◆ TurnSpeedFPS

float TurnSpeedFPS
getset

How fast characters turn (turning-frames-per-second)

◆ AdjustSpeedWithScaling

bool AdjustSpeedWithScaling
getset

Whether the walk speed adjusts to match the size of th character when scaled by regions.

◆ SolidSize

Vector2 SolidSize
getset

Gets/sets the character's blocking width and height.

The solid size determines how large of a blocking rectangle the character exerts to stop other characters walking through it. If this is set to 0,0 (the default), then the blocking rectangle is automatically calculated to be the character's width, and 5 pixels high. You can manually change the setting by entering a blocking height in pixels, which is the size of walkable area that the character effectively removes by standing on it.

See also
Solid

◆ UseSpriteAsHotspot

bool UseSpriteAsHotspot
getset

Gets/sets whether the character uses it's sprite as it's hotspot, instead of a collider specified in the inspector.

◆ Facing

eFace Facing
getset

The enumerated direction the character is facing. Useful when you want to set a character's face direction without them turning.

Example:
If Dave is facing right, immediately change him to be facing up-left if ( C.Dave.Facing == eFace.Right ) C.Dave.Facing = eFace.UpLeft;

◆ Clickable

bool Clickable
getset

Gets or Sets whether clicking on the object triggers an event.

◆ Visible

bool Visible
getset

Gets or sets whether the character visible flag is set.

See also
Show()

◆ VisibleInRoom

bool VisibleInRoom
get

Gets whether the character is actually visible and in the current room. Same as (C.Fred.Visible && C.Fred.Room != null && C.Fred.Room == R.Current)

◆ Solid

bool Solid
getset

Gets/sets whether the character can be walked through by other characters. If this is set to true, then the character is solid and will block the path of other characters. If this is set to false, then the character acts like a hologram, and other characters can walk straight through him.

See also
Solid

◆ Moveable

bool Moveable
getset

Gets or sets whether the character can move/walk. If false, WalkTo commands are ignored.

◆ Walking

bool Walking
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is currently walking.

◆ Talking

bool Talking
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is currently talking.

◆ Animating

bool Animating
get

Gets a value indicating whether this PowerTools.Quest.ICharacter is playing an animation from PlayAnimation(), or Animation = "someAnim" NOT a regular Idle, walk or Talk anim.

◆ IsPlayer

bool IsPlayer
get

Whether this instance is the current player.

◆ TextColour

Color TextColour
getset

Gets or sets the text colour for the character's speech text.

◆ TextPositionOverride

Vector2 TextPositionOverride
getset

Gets or sets the position the player's dialog text will be shown (in world space). If set to zero, the default will be used (Displayed above the character sprite).

◆ AnimIdle

string AnimIdle
getset

Gets or sets the idle animation of the character.

◆ AnimWalk

string AnimWalk
getset

Gets or sets the walk animation of the character.

◆ AnimTalk

string AnimTalk
getset

Gets or sets the talk animation of the character.

◆ AnimMouth

string AnimMouth
getset

Gets or sets the lipsync mouth animation of the character, attached to a node.

◆ Cursor

string Cursor
getset

Gets or sets the cursor to show when hovering over the object. If empty, default active cursor will be used.

◆ UseRegionTinting

bool UseRegionTinting
getset

Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region tinting.

true if use region tinting; otherwise, false.

◆ UseRegionScaling

bool UseRegionScaling
getset

Gets or sets a value indicating whether this PowerTools.Quest.ICharacter use region scaling.

true if use region scaling; otherwise, false.

◆ FirstUse

bool FirstUse
get

Returns true the first time the player "uses" the object.

◆ FirstLook

bool FirstLook
get

Returns true the first time the player "looked" at the object.

◆ UseCount

int UseCount
get

Returns the number of times player has "used" at the object. 0 when it's the first click on the object.

◆ LookCount

int LookCount
get

Returns the number of times player has "looked" at the object. 0 when it's the first click on the object.

◆ WalkToPoint

Vector2 WalkToPoint
getset

Gets or sets the walk to point.

Note that this is an offset from the character's position:

  • To get their actual WalkTo point in scene-coordinates, add it like this: Vector2 actualWalkToPos = C.Barney.WalkToPoint + C.Barney.Position;
  • To set their actual WalkTo point from scene-coordinates, subtract it like this: C.Barney.WalkToPoint = Points.BarneyNewWalkTo - C.Barney.Position;

◆ LookAtPoint

Vector2 LookAtPoint
getset

Gets or sets the look at point.

Note that this is an offset from the character's position:

  • To get their actual LookAt point in scene-coordinates, add it like this: Vector2 actualLookAtPos = C.Barney.LookAtPoint + C.Barney.Position;
  • To set their actual LookAt point from scene-coordinates, subtract it like this: C.Barney.LookAtPoint = Points.BarneyNewLookAt - C.Barney.Position;

◆ Animation

string Animation
getset

Gets or sets an override animation on the character. Until StopAnimation() is called, this will play, and AnimIdle,AnimTalk,AnimWalk will all be ignored. This is the equivalent of calling PlayAnimationBG() with pauseAtEnd set to true.

See also
StopAnimation()
AnimIdle
AnimWalk
AnimTalk
PlayAnimation()
PlayAnimationBG()

◆ ClickableColliderId

int ClickableColliderId
getset

Players can have more than one polygon collider for clicking on. Add them in the Character Component, and set which is active with this function.

◆ ActiveInventory

IInventory ActiveInventory
getset

Gets or sets the active inventory (item that's currently selected/being used)

◆ ActiveInventoryName

string ActiveInventoryName
getset

Gets or sets the active inventory (item that's currently selected/being used)

◆ HasActiveInventory

bool HasActiveInventory
get

Returns true if there's any active inventory (item that's currently selected/being used)

◆ Data

Character Data
get

Access to the base class with extra functionality used by the PowerQuest.

Member Function Documentation

◆ SetPosition() [1/2]

void SetPosition ( float  x,
float  y,
eFace  face = eFace.None 
)

Set the location of the character, with an optional 'facing' direction.

Eg C.Dave.SetPosition(12,34); or C.Barney.SetPosition(43,21,eFace.Right);. Tip: Move your cursor over the scene window and press Ctrl+M to copy the coordinates to the clipboard. Then paste them into this function!

See also
Position
Facing

◆ SetPosition() [2/2]

void SetPosition ( Vector2  position,
eFace  face = eFace.None 
)

Set the location of the character, with an optional 'facing' direction.

Eg C.Dave.SetPosition(new Vector2(12,34)); or C.Barney.SetPosition(Points.UnderTree,eFace.Right);

See also
Position
Facing

◆ WalkTo() [1/3]

Coroutine WalkTo ( float  x,
float  y,
bool  anywhere = false 
)

Make the character walk to a position in game coords.

If 'anywhere' is true, the character will ignore walkable areas

There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);, C.Dave.WalkTo(Points.IntoSky, true);,C.Dave.WalkTo(C.Barney);, or the quest script commandWalkToClicked`

See also
WalkToBG()
StopWalking()

◆ WalkTo() [2/3]

Coroutine WalkTo ( Vector2  pos,
bool  anywhere = false 
)

Make the character walk to a position in game coords.

If 'anywhere' is true, the character will ignore walkable areas

There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);, C.Dave.WalkTo(Points.IntoSky, true);,C.Dave.WalkTo(C.Barney);, or the quest script commandWalkToClicked`

See also
WalkToBG()
StopWalking()

◆ WalkTo() [3/3]

Coroutine WalkTo ( IQuestClickableInterface  clickable,
bool  anywhere = false 
)

Make the character walk to the walk-to-point of a clickable object. (characters, props, hotspots, etc)

If 'anywhere' is true, the character will ignore walkable areas

There are a few different WalkTo functions to serve different needs. eg: C.Dave.WalkTo(12,34);, C.Dave.WalkTo(Points.IntoSky, true);,C.Dave.WalkTo(C.Barney);, or the quest script commandWalkToClicked`

See also
WalkToBG()
StopWalking()

◆ WalkToBG() [1/3]

void WalkToBG ( float  x,
float  y,
bool  anywhere = false,
eFace  thenFace = eFace.None 
)

Make the character walk to a position in game coords without halting the script.

eg: C.Dave.WalkToBG(12,34); or C.Barney.WalkToBG(43,21,eFace.Left); If 'anywhere' is true, the character will ignore walkable areas If 'thenFace' is specified, the character will face that direction once they finish walking

See also
WalkTo()
StopWalking()

◆ WalkToBG() [2/3]

void WalkToBG ( Vector2  pos,
bool  anywhere = false,
eFace  thenFace = eFace.None 
)

Make the character walk to a position in game coords without halting the script.

If 'anywhere' is true, the character will ignore walkable areas If 'thenFace' is specified, the character will face that direction once they finish walking

See also
WalkTo()
StopWalking()

◆ WalkToBG() [3/3]

void WalkToBG ( IQuestClickableInterface  clickable,
bool  anywhere = false,
eFace  thenFace = eFace.None 
)

Make the character walk to the walk-to-point of a clickable object without halting the script.

◆ WalkToClicked()

Coroutine WalkToClicked ( bool  anywhere = false)

Make the character walk to the walk-to-point of the last object clicked on. In QuestScripts you can use the shortcut WalkToClicked

◆ StopWalking()

Coroutine StopWalking ( )

Stop the character walking or moving. Also clears any waypoints.

◆ AddWaypoint() [1/2]

void AddWaypoint ( float  x,
float  y,
eFace  thenFace = eFace.None 
)

Tells the character to move to a location directly, after it has finished its current move. Ignores walkable areas.

This function allows you to queue up a series of moves for the character to make, if you want them to take a preset path around the screen. Note that any moves made with this command ignore walkable areas.

This is useful for situations when you might want a townsperson to wander onto the screen from one side, take a preset route around it and leave again.

If thenFace is specified, the character will face that direction once they finish walking

Example:

C.Barney.Walk(160, 100);
C.Barney.AddWaypoint(50, 150);
C.Barney.AddWaypoint(50, 50, eFace.Right);

Tells character Barney to first of all walk to the centre of the screen normally (obeying walkable areas), then move to the bottom left corner and then top left corner afterwards, then face right.

See also
Walk
StopWalking

◆ AddWaypoint() [2/2]

void AddWaypoint ( Vector2  pos,
eFace  thenFace = eFace.None 
)

Tells the character to walk to a point directly, after it has finished its current move. Ignores walkable areas.

This function allows you to queue up a series of moves for the character to make, if you want them to take a preset path around the screen. Note that any moves made with this command ignore walkable areas.

This is useful for situations when you might want a townsperson to wander onto the screen from one side, take a preset route around it and leave again.

If thenFace is specified, the character will face that direction once they finish walking

Example:

C.Barney.Walk(Points.Center);
C.Barney.AddWaypoint(Points.BotLeft);
C.Barney.AddWaypoint(Points.TopLeft, eFace.Right);

Tells character Barney to first of all walk to the centre of the screen normally (obeying walkable areas), then move to the bottom left corner and then top left corner afterwards, Then face right.

See also
Walk
StopWalking

◆ MoveTo() [1/3]

Coroutine MoveTo ( float  x,
float  y,
bool  anywhere = false 
)

Make the character move to a position in game coords without playing their walk animation.

If 'anywhere' is true, the character will ignore walkable areas

This is the same as WalkTo(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()

eg: C.Dave.MoveTo(12,34);, C.Dave.MoveTo(Points.IntoSky, true);.

See also
WalkTo()
MoveToBG()
StopWalking()

◆ MoveTo() [2/3]

Coroutine MoveTo ( Vector2  pos,
bool  anywhere = false 
)

Make the character move to a position in game coords without playing their walk animation.

If 'anywhere' is true, the character will ignore walkable areas

This is the same as WalkTo(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()

eg: C.Dave.MoveToBG(12,34);, C.Dave.MoveToBG(Points.IntoSky, true);.

See also
WalkTo()
MoveToBG()
StopWalking()

◆ MoveTo() [3/3]

Coroutine MoveTo ( IQuestClickableInterface  clickable,
bool  anywhere = false 
)

Make the character move to the walk-to-point of a clickable object. Their Walk animation will NOT be played.

If 'anywhere' is true, the character will ignore walkable areas

This is the same as WalkTo(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo()

eg: C.Dave.MoveToBG(12,34);, C.Dave.MoveToBG(Points.IntoSky, true);.

See also
WalkTo()
MoveToBG()
StopWalking()

◆ MoveToBG() [1/3]

void MoveToBG ( float  x,
float  y,
bool  anywhere = false 
)

Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played.

This is the same as WalkToBG(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo() eg: C.Dave.MoveToBG(12,34);, C.Dave.MoveToBG(Points.IntoSky, true); If 'anywhere' is true, the character will ignore walkable areas

See also
MoveTo()
WalkTo()
StopWalking()

◆ MoveToBG() [2/3]

void MoveToBG ( Vector2  pos,
bool  anywhere = false 
)

Make the character move to a position in game coords without halting the script. Their Walk animation will NOT be played.

This is the same as WalkToBG(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo() If 'anywhere' is true, the character will ignore walkable areas

See also
MoveTo()
WalkTo()
StopWalking()

◆ MoveToBG() [3/3]

void MoveToBG ( IQuestClickableInterface  clickable,
bool  anywhere = false 
)

Make the character move to the walk-to-point of a clickable object without halting the script. Their Walk animation will NOT be played.

This is the same as WalkToBG(), except that the character won't face the direction they're moving, and won't play their walk animation. In the majority of cases you should use WalkTo() If 'anywhere' is true, the character will ignore walkable areas

See also
MoveTo()
WalkTo()
StopWalking()

◆ ChangeRoom()

Coroutine ChangeRoom ( IRoom  room)

Moves the character to another room. If the player character is moved, the scene will change to the new room and script will wait until after OnEnterRoomAfterFade finishes.

See also
IPowerQuest.ChangeRoom
ChangeRoomBG

◆ ChangeRoomBG()

void ChangeRoomBG ( IRoom  room)

Moves the character to another room. If the player character is moved, the scene will change to the new room.

◆ Show() [1/4]

void Show ( bool  clickable)

Obsolete: Set's visible & clickable (Same as Enable(bool clickable)), and changes them to the current room (if they weren't there already)

See also
Hide()

◆ Show() [2/4]

void Show ( Vector2  pos = new Vector2(),
eFace  facing = eFace.None 
)

Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.

See also
Hide()
Disable()
Enable()

◆ Show() [3/4]

void Show ( float  posX,
float  posy,
eFace  facing = eFace.None 
)

Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.

See also
Hide()
Disable()
Enable()

◆ Show() [4/4]

void Show ( eFace  facing)

Shows the character again after a call to Hide(), moving them to current room, and forcing Visible to true. You can optionally pass in a position or face direction. If not passed no change will be made. The Enable() function is similar, but doesn't set Visible to true, or move them to the current room.

See also
Hide()
Disable()
Enable()

◆ Hide()

void Hide ( )

Hides the character until Show() is called. Saves you setting Visible, Clickable, Solid all to false. (Same as Disable())

See also
Show()
Disable()
Enable()

◆ Enable() [1/2]

void Enable ( )

Enables the character again after a call to Disable() or Hide(). Does NOT move them to the current room, or set Visible like Show() does.

See also
Disable()
Hide()
Show()

◆ Enable() [2/2]

void Enable ( bool  clickable)

Obsolete: Set's visible & clickable, and changes them to the current room (if they weren't there already)

◆ Disable()

void Disable ( )

Disables the character until Enable() is called. Saves you setting Visible, Clickable, Solid all to false.

See also
Show()
Hide()
Enable()

◆ Face() [1/5]

Coroutine Face ( eFace  direction,
bool  instant = false 
)

Faces character in a direction. Turning, unless instant is false.

◆ Face() [2/5]

Coroutine Face ( IQuestClickable  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot)

◆ Face() [3/5]

Coroutine Face ( IQuestClickableInterface  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot)

◆ FaceDown()

Coroutine FaceDown ( bool  instant = false)

Faces character down (towards camera)

◆ FaceUp()

Coroutine FaceUp ( bool  instant = false)

Faces character up (away from camera)

◆ FaceLeft()

Coroutine FaceLeft ( bool  instant = false)

Faces character left.

◆ FaceRight()

Coroutine FaceRight ( bool  instant = false)

Faces character right.

◆ FaceUpRight()

Coroutine FaceUpRight ( bool  instant = false)

Faces character a specified direction.

◆ FaceUpLeft()

Coroutine FaceUpLeft ( bool  instant = false)

Faces character a specified direction.

◆ FaceDownRight()

Coroutine FaceDownRight ( bool  instant = false)

Faces character a specified direction.

◆ FaceDownLeft()

Coroutine FaceDownLeft ( bool  instant = false)

Faces character a specified direction.

◆ Face() [4/5]

Coroutine Face ( float  x,
float  y,
bool  instant = false 
)

Faces character towards a position in on screen coords.

◆ Face() [5/5]

Coroutine Face ( Vector2  location,
bool  instant = false 
)

Faces character towards a position in on screen coords.

◆ FaceClicked()

Coroutine FaceClicked ( bool  instant = false)

Faces character towards the look-at-point of the last object clicked on.

◆ FaceAway()

Coroutine FaceAway ( bool  instant = false)

Faces character in opposite direction to current.

◆ FaceDirection()

Coroutine FaceDirection ( Vector2  directionV2,
bool  instant = false 
)

Faces character in a direction.

◆ FaceBG() [1/5]

void FaceBG ( eFace  direction,
bool  instant = false 
)

Faces character in a direction. Turning, unless instant is false. Does NOT halt script.

◆ FaceBG() [2/5]

void FaceBG ( IQuestClickable  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script.

◆ FaceBG() [3/5]

void FaceBG ( IQuestClickableInterface  clickable,
bool  instant = false 
)

Faces character towards the look-at-point of a clickable (character, prop, hotspot). Does NOT halt script.

◆ FaceDownBG()

void FaceDownBG ( bool  instant = false)

Faces character down (towards camera). Does NOT halt script.

◆ FaceUpBG()

void FaceUpBG ( bool  instant = false)

Faces character up (away from camera). Does NOT halt script.

◆ FaceLeftBG()

void FaceLeftBG ( bool  instant = false)

Faces character left. Does NOT halt script.

◆ FaceRightBG()

void FaceRightBG ( bool  instant = false)

Faces character right. Does NOT halt script.

◆ FaceUpRightBG()

void FaceUpRightBG ( bool  instant = false)

Faces character a specified direction. Does NOT halt script.

◆ FaceUpLeftBG()

void FaceUpLeftBG ( bool  instant = false)

Faces character a specified direction. Does NOT halt script.

◆ FaceDownRightBG()

void FaceDownRightBG ( bool  instant = false)

Faces character a specified direction. Does NOT halt script.

◆ FaceDownLeftBG()

void FaceDownLeftBG ( bool  instant = false)

Faces character a specified direction. Does NOT halt script.

◆ FaceBG() [4/5]

void FaceBG ( float  x,
float  y,
bool  instant = false 
)

Faces character towards a position in on screen coords. Does NOT halt script.

◆ FaceBG() [5/5]

void FaceBG ( Vector2  location,
bool  instant = false 
)

Faces character towards a position in on screen coords. Does NOT halt script.

◆ FaceClickedBG()

void FaceClickedBG ( bool  instant = false)

Faces character towards the look-at-point of the last object clicked on. Does NOT halt script.

◆ FaceAwayBG()

void FaceAwayBG ( bool  instant = false)

Faces character in opposite direction to current. Does NOT halt script.

◆ FaceDirectionBG()

void FaceDirectionBG ( Vector2  directionV2,
bool  instant = false 
)

Faces character in a direction. Does NOT halt script.

◆ StartFacingCharacter()

void StartFacingCharacter ( ICharacter  character,
float  minWaitTime = 0.2f,
float  maxWaitTime = 0.4f 
)

Causes the character to face another character, and continue to turn to face them if either character moves.

Parameters
characterThe character to face
minWaitTimeThe minimum time delay before they'll turn to face the other character. Default 0.2 seconds.
maxWaitTimeThe maximum time delay before they'll turn to face the other character. Default 0.4 seconds.

See also
StopFacingCharacter();

◆ StopFacingCharacter()

void StopFacingCharacter ( )

Stops the chracter facing another after a call to StartFacingCharacter()

◆ Say()

Coroutine Say ( string  dialog,
int  id = -1 
)

Make chracter speak a line of dialog. eg. C.Barney.Say("Hello"); Note that in QuestScript window you can just type Barney: Hello

See also
SayBG()
E.Display()

◆ SayBG()

Coroutine SayBG ( string  dialog,
int  id = -1 
)

Make chracter speak a line of dialog, without halting the script. eg. C.Barney.SayBG("Some dialog I'm saying in the background");

See also
Say()
E.DisplayBG()
CancelSay()

◆ CancelSay()

void CancelSay ( )

Cancel any current dialog the character's speaking.

◆ PlayAnimation()

Coroutine PlayAnimation ( string  animName)

Play an animation on the character. Will return to idle after animation ends.

See also
PlayAnimationBG()
Animation
AnimIdle
AnimWalk
AnimTalk

◆ PlayAnimationBG()

void PlayAnimationBG ( string  animName,
bool  pauseAtEnd = false 
)

Play an animation on the character without halting the script. Will return to idle after animation ends, unless pauseAtEnd is true.

If pauseAtEnd is true, the character will stay on the last frame until StopAnimation() is called. Otherwise they will return to idle once the animation has finished playing

See also
Animation
PlayAnimation()
StopAnimation
AnimIdle
AnimWalk
AnimTalk

◆ AddAnimationTrigger()

void AddAnimationTrigger ( string  triggerName,
bool  removeAfterTriggering,
System.Action  action 
)

Adds a function to be called on an animation event here. Eg: to play a sound or effect on an animation tag.

Usage: Add an event to the anim called "Trigger" with a string matching the tag you want (eg: "Shoot") Then call C.Player.AddAnimationTrigger( "Shoot", true, ()=>Audio.PlaySound("Gunshot") );

See also
WaitForAnimationTrigger

◆ RemoveAnimationTrigger()

void RemoveAnimationTrigger ( string  triggerName)

Removes an existing animation trigger.

◆ WaitForAnimTrigger()

Coroutine WaitForAnimTrigger ( string  eventName)

Waits until an Event/Tag in the current animation is reached.

Usage:

  • Add an event to an animation, eg: 'Shoot'.
  • Play the animation in the background
  • Call C.Player.WaitForAnimTrigger("Shoot");.
  • The script will pause until that event is hit before continuing

Example: Using it to play a sound and shake the screen at the time in an animation when the player shoots a gun:

C.Dave.PlayAnimationBG("AimAndFireGun");
C.Dave.WaitForAnimTrigger("Shoot");
Audio.Play("Bang");
Camera.Shake();
Barney: Ouch!
See also
AddAnimationTrigger

◆ GetInventoryItemCount()

float GetInventoryItemCount ( )

Returns total number of inventory items that he player has.

◆ GetInventoryQuantity() [1/2]

float GetInventoryQuantity ( string  itemName)

Gets the number of a particular inventory item the player has

Returns
The inventory quantity.
Parameters
itemNameName of the inventory item

◆ HasInventory() [1/2]

bool HasInventory ( string  itemName)

Returns true if the player has the specified inventory item.

◆ GetEverHadInventory() [1/2]

bool GetEverHadInventory ( string  itemName)

Returns true if the player has, or ever had the specified inventory item.

◆ AddInventory() [1/2]

void AddInventory ( string  itemName,
float  quantity = 1 
)

Adds an item to the player's inventory

Parameters
itemNameName of the inventory item.
quantityThe quantity of the item to add.

◆ RemoveInventory() [1/2]

void RemoveInventory ( string  itemName,
float  quantity = 1 
)

Removes an item from the player's inventory.

Parameters
itemNameThe name of the inventory item to remove.
quantityQuantity of the item to remove.

◆ GetInventoryQuantity() [2/2]

float GetInventoryQuantity ( IInventory  item)

Gets the number of a particular inventory item the player has

Returns
The inventory quantity.
Parameters
itemThe inventory item to check

◆ HasInventory() [2/2]

bool HasInventory ( IInventory  item)

Returns true if the player has the specified inventory item.

◆ GetEverHadInventory() [2/2]

bool GetEverHadInventory ( IInventory  item)

Returns true if the player has, or ever had the specified inventory item.

◆ AddInventory() [2/2]

void AddInventory ( IInventory  item,
float  quantity = 1 
)

Adds an item to the player's inventory

Parameters
itemThe inventory item to add.
quantityThe number of the item to add.

◆ RemoveInventory() [2/2]

void RemoveInventory ( IInventory  item,
float  quantity = 1 
)

Removes an item from the player's inventory.

Parameters
itemThe item to remove.
quantityQuantity of the item to remove.

◆ ClearInventory()

void ClearInventory ( )

Remove all inventory items from the player.

◆ GetScript< T >()

T GetScript< T > ( )

PowerQuest internal function: Access to the specific quest script for the character. Pass the specific character class as the templated parameter so you can access specific members of the script. Eg: GetScript<CharacterBob>().m_saidHi = true;.

Type Constraints
T :CharacterScript<T>