changing between two types of talk view (SOLVED)

Started by gypsysnail, Wed 27/12/2006 12:51:12

Previous topic - Next topic

gypsysnail

I have been trying to change the view of the characters talking to each other (the portrait that comes up when the character talks style) in between the conversations. E.g. at one point in the convo, the character Y is talking normal faced, and the other char X says something to make the character Y angry, so I need to change the view to an angry face while talking. I tried this way: made a 'new character' and named it angrychar, then I went to the display messages and changed the part of the convo's view where she is to get angry to that new char view for angry but it did not work at all. Either I got an error message or when the game did load up at Test Game, I talked and I didnt get the portrait of the angry talking one, just text. Where am I going wrong? Yep I am very new to this and this is just one new area I haven't done before :P. Any ideas on what I need/can do? If there is any extra scripting required, please can you say where I should put the script in which part of the editor, etc? Just learning with this one as well.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Joe

I think there's an easiest way to change any character view
but i don't know if you're doing it through a scrip or a dialog script, anyway here it goes:

For normal scripts
Code: ags

//here is the point of the conversation wich makes the character angry e.g.:
character[a].Say("Do you want to come?");
character[b].Say("Oh no, I'm not going with you anywhere, stupid man");
character[a].SpeechView=X;
character[a].Say("What on earth you're saying??");

Where X is the the angry view, and you can chage it anytime you like.
Copinstar © Oficial Site

gypsysnail

Thanks... I am still a bit confused. Sorry I forgot to mention I am just using a normal script but not actually scripting.... just went through from the room editor and clicked the box with blue writing in it, and a box comes up, that sort of thing and it had the option of which view to select and I selected angrychar view, changing from the normal char view. It seems in the normal char view, I can only have one speech view, so I made a new character just for the same character but 'angry'. And I am not quite sure where you would put the script you had posted.... in what part of the global (or is it local) script editor? The error message that came up was cos I set the new angry character to start in room 1 so I changed it back to room -1, the error message had read "there are no other walk cycles for that view...." something like that anyway.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Joe

#3
Ok, I'd recomend you to begin using the script or you'll regret it in a future.

I'd do this:


This would make the conversation only the first time the player enters in room, and you won't have to make *Extra* characters just make the view :)
Copinstar © Oficial Site

gypsysnail

Ahhh yes!! I get it now :) thanks :):):) Yep I am sure I would regret it if I didnt use it that way, thats usually one of the best ways, the run script, have used it a few times for other things, localised scripts, easier than global. I will go try it now and then I have to go to bed :) aussie time its late ;D
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

gypsysnail

Ok I have tried it and altered it to the right charcter names and all this as shown in the code:
Code: ags
function room_b() {
  // script for Room: First time player enters room
//here is the point of the conversation wich makes the character angry e.g.:
cEgo[a].Say("Bigmum! Can u pls get some wood?");
cCarmum[b].Say("Oh why do I have to do the work??");
cEgo[a].SpeechView=8;
cEgo[a].Say("BECAUSE I Told you to! Will you bloody well get the wood or I will spank you very hard!!");  
cCarmum[b].Say("Alright! *grumble grumble grumble FART!*");
}


but when I go to test game, I cant because it comes up saying "cEgo is not an array". What am I doing wrong? I am still trying to get a grasp of understanding on how this kind of scripting works.
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Joe

#6
Right
Array means diferent variables with the same name so that when you use character[X] you have to especify X value but if you use cEgo you dont need to specify anything so instead of cEgo[a] use cEgo and instead of cCarmum use cCarmum
Copinstar © Oficial Site

gypsysnail

i understand now ;) silly me. Im going to bed now so wont reply more til tmw. thanks again for ur help cheers :)
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

gypsysnail

Ah  :-[ *embarrassed smile* I posted about this in the other thread but here goes (and feel free to delete/merge posts to this one if you feel it needs to be as I know how you feel about double posting, I hate it too :P:

Ah thanks. The problem I found too just before I went to bed was that the script is set under the enter room first time interaction, so as soon as I enter the room, the convo comes up, this wasn't what was supposed to happen. What I would like is to click the talk icon on the character that the player char needs to talk to for that to happen. So we may need to rework this but what is the best option, best way to put the script in?
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Akatosh


gypsysnail

Hey thanks!!! :D it worked - well the first time yep, but then I did the talk on character a 2nd time just to check, and the view that came up was only the angry one for all of the convo which shouldnt have happened, it should have been normal for most of the convo with one part being angry only. And strangely, when I spoke to another character thats in there too, afterwards, only the angry talk view came up which again shouldn't have happened. As you can see in the script in one of my earlier posts above, thats the script I used in the run script under the character that the player has to talk to - bigmum's view at the interaction in the spot you showed me to select... what could the problem be?
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

Did you forget to change back the SpeechView to the original one? ;)

gypsysnail

Hmmmm :O.... not sure how I will do that one? Pardon my newbism. I haven't had a chance to play with my AGS studio for a month until now thanks to havin a visitor stay with me for a mth lol. Now.... to change speech view... how will I do this? Because the method of this particular convo for bigmum was a script run.....
Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

Khris

Add cEgo.SpeechView=x to the end of the script, where x is the number of the original SpeechView.

Ghost

#14
Exactly. Each time you wish to use a certain view instead of your default one, it must be called with cCharName.SpeechView = NumberOfView. To play it safe it's best to change it just before you use it, and reset it right after you're done with in.

As to answer your PM, these calls will always go into any local, global or RunScript- scripts you're using. If you create your scripts by puzzling them toehter with the Interaction editor, it means havok, so you'd be better off using just Run Script and write the code yourself...

If you need to change expressions often, it may be handy to write a function for that into your global script, then import it in the header.
Like this:

function SetExpression(string expr) {
Ã,  if (expr == "neutral") player.SpeechView = 12;
else if (expr == "vexed") player.SpeechView = 13;
Ã,  }

and so on. That way, you can make your character look angry by calling SetExpression("angry"), and back.

(It's actually tested code, you can copy it into your global script and tweak it.)


Khris

You could even put this in the script header:
Code: ags
enum Expression {
  angry,
  neutral,
  amused
};


and then use

Code: ags
function SetExpression(Expression expr) {
  if (expr == angry) player.SpeechView = 12;
  else if (expr == neutral) player.SpeechView = 13;
  else if (expr == amused) player.SpeechView = 14;
}


That way you won't have to remember the expressions' names because the auto-complete function will show you the available ones.

gypsysnail

Believe in afterlife! It's true in a metamorphical way ;)
Ken & Roberta - my inspiration!! 20 years.
U are what you love doing and passionate about - keep up what you love most.

SMF spam blocked by CleanTalk