Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bryan_abos on Fri 08/09/2017 06:54:38

Title: Undefined token 'SetCharacterView'
Post by: Bryan_abos on Fri 08/09/2017 06:54:38
I want to "hide" my main character, and only show it if a hotspot is clicked.
The idea is to change the character's view  by clicking that hotspot.

I did THIS but a message says "Undefined token 'SetCharacterView'":
       
Code (ags) Select

function room_Load()
{
  gMaingui.Visible = false;
  gAction.Visible = false;
  SetCharacterView(cEgo, 19);
}

function cPito_AnyClick()
{
  RestoreWalkableArea(1);
  SetCharacterView(cEgo, 20);
}

Title: Re: Undefined token 'SetCharacterView'
Post by: Kara Jo Kalinowski on Fri 08/09/2017 07:20:10
From the help pages:

QuoteLockView
(Formerly known as SetCharacterView, which is now obsolete)

Code (ags) Select
Character.LockView(int view)

Sets the character's view to VIEW. This can be used to perform animations with characters, for example bending down to pick something up, which don't use the default view.
NOTE: This function locks the character's view to the specified view, so that it can only be changed by other script commands (ie. it won't automatically be changed by AGS on walkable areas, screen changes, etc). When you are done with the animation, call UnlockView to allow AGS to take control back.

Example:

Code (ags) Select
cEgo.LockView(12);
cEgo.Animate(0, 0, eOnce, eBlock, eForwards);
cEgo.UnlockView();


will change the character's EGO view to view 12, perform an animation using loop 0, wait until the animation finishes and then return the character to his normal view.
Title: Re: Undefined token 'SetCharacterView'
Post by: Khris on Fri 08/09/2017 10:38:56
The AGS language went through a significant change from 2.62 to 2.7; I don't know where you got that command from, but when you search for stuff on the forums, you should be wary of code from 2005 and earlier.
Title: Re: Undefined token 'SetCharacterView'
Post by: eri0o on Fri 08/09/2017 13:31:05
You can use player.Transparency and set to 100 to hide and back to 0 to show again.