Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Dervish on Wed 03/10/2007 08:36:27

Title: Question about SetView on Character [Solved]
Post by: Dervish on Wed 03/10/2007 08:36:27
I have a Character pass out and therefore the player can't talk to the character anymore.  So the question is is there another "easier" way to detect if the character is passed out besides variables.  The Passed out view is set up as a different view.  Is there a built in function the detects what the view of a character is?
Title: Re: Question about SetView on Character
Post by: Gilbert on Wed 03/10/2007 08:45:14
Yes, look for Character.View (http://www.adventuregamestudio.co.uk/manual/Character.View.htm) in the manual.

Just do something like:
if (player.View==4) {...
Title: Re: Question about SetView on Character
Post by: Dervish on Wed 03/10/2007 08:47:12
Thanks Gilbot... I knew there was something there.


Alright well I did the suggestion above but when I Run Script as the interaction under "Talk To Character" it tells me RunDialog is an 'Undefined Token'
Title: Re: Question about SetView on Character
Post by: Gilbert on Wed 03/10/2007 09:56:28
Are you using V2.72 and ticked the "Enforce object-based scripting" option ? (I think it's on by default.)

RunDialog() is an old function name, it's renamed to object-style Dialog.Start() (check the manual for usage), so you may either:
1. Uncheck that option mentioned above, the editor will accept obsolete old style scripting then, or, much better
2. Change to use Dialog.Start() and try to stick to the new style object-based scripting.
Title: Re: Question about SetView on Character
Post by: Dervish on Wed 03/10/2007 11:20:32
Ok I have tried to figure this out.  Basically I want to Either have the conversation if the guy isn't passed out or display the message "I think he is done for." How can i go about doing this. Becuase I have tried running script in the interaction menu under talk to character but it won't recognize the Dialog in the global script How can I solve this?
Title: Re: Question about SetView on Character
Post by: Ashen on Wed 03/10/2007 11:23:23
What EXACTLY have you tried? (As in, post the script.) Something like this should work:

if (cGuy.View != 8) { // or whatever the 'passed out' view is
  dGuydialog.Start(); // Or whetever the script name of your dialog is
}
else {
  player.Say("I think he is done for.");
}
Title: Re: Question about SetView on Character
Post by: Dervish on Wed 03/10/2007 11:43:45
Thanks for the Code made me realize i needed to use the exact dialog name.  I was using the dialog number.
Title: Re: Question about SetView on Character [Solved]
Post by: Ashen on Wed 03/10/2007 11:57:12
Dervish, please READ THE MANUAL.

Character.View is in there, and not hard to find (you wanted a function that checked a Character's View). Looking up RunDialog will redirect you to Dialog.Start - which tells you the old function is obsolete, and gives you an example of how to use the new one. So, every question in this thread is answered in the manual, which you should be reading before you post.