Help with NPCs interacting with the Player [SOLVED]

Started by Plot, Mon 03/11/2008 19:14:52

Previous topic - Next topic

Plot

Hi there, I'm currently training myself via the AGS tutorial. My sandbox is a simple little point and click adventure game that works fairly well until I start thinking along the lines of "I wonder if I can..." At this point things start to break and the editor yells at me.

For the most part I can find my solutions within the tutorial and function glossary, however there are a couple of items I'm not clear on and I hope that someone here might be able to point me in the right direction.

1) Is it possible to have a secondary character talk or display a message after your character interacts with a hotspot. I'm not talking about a conversation, just a simple display. For example, let's say cEgo (love the tutorial) looks at a picture on the wall. "That's a lovely picture," he says, to which an onlooker responds, "You obviously have no taste."

function hPicture_Look()
{
Display("That's a lovely picture.");
???????("You obviously have no taste.");
}

Maybe it's because it was late, but for the life of me I couldn't fathom or find just how to get the secondary character to display a message. I figure if I do, I can pretty much make the secondary characters do anything based upon the player's interactions once this is solved. Why is it always the simple puzzles that give me the most trouble?

2) This isn't so much of a problem that it is seeking a bit of advice. Since I've added permanent characters into my rooms, I tend to place them in the previous rooms script. For example, if I want cBob to be in Room 2, I place a line of code stating this beneath the change room code in Room 1's script.

Is this necessary or should I just stick to listing the character's starting position in their control panel? Is there any advantage or disadvantage to my method?

Thanks for your patience and advice. I look forward to working with the community more as my little game comes into fruition.

Trent R

1)I wouldn't use Display for your player character, and instead use Say for both characters.
Code: ags
function hPicture_Look()
{
 cEgo.Say("That's a lovely picture.");
 cOnlooker.Say("You obviously have no taste.");
}
There is also SayAt and SayBackground that you should look up in the manual.


2)If they're permanent, then I would just stick with properties window settings. Unless I'm understanding what you're saying wrong....
If Bob stays in room2 the entire game, then I would just set his property to that room. If he changes rooms, then yeah, you'd have to use scripting.


~Trent
PS-densming's videos are very helpful, and a few go into the Say functions and things you can do with them (randoms, timers, etc). Check them out!
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Plot

See, I knew I'd come away from this feeling a little dumber and a little wiser. I didn't even realize I could use Say. What's the purpose of Display, then?

As for the second question: you nailed it. I had a feeling the control panel was used more for permanent characters but my inexperience was taunting me, suggesting I might have been missing a great function.

Regardless, you've been exceptionally helpful. Thanks for the quick response...I can't wait to get home and rewrite my script! ;)

Khris

Display will show a (by default) white box displaying the text. Unless you set "Always display text as speech" to true in the General settings pane, then Display will make the current player character say something.

Trent R

Ever played QFG4? I recently beat it again (20+ times) and it's in my mind right now. So I'll use it to demonstrate:

This video uses the Display function for the narrator.
This other video uses the Say Function for characters. And with AGS, you can even simulate the full-screen version of Speech display.


~Trent
PS-I just used the first videos I found on Youtube, so no need to watch them for more than 30 secs at the most.
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Plot

I see. One of the first things I did was set "Always display text as speech" to true which explains why I completely forgot about it. I don't see any harm in switching it back to false (provided I change all of my Displays to Says)...if anything it'll open up new options.

And to Trent R, I haven't played Quest for Glory 4, though watching bits of the video I can't believe I missed it (and John Rhys-Davies, really?). I can totally relate to replaying adventure games, though. I'm sure it's part nostalgia, but there's something very relaxing and serene about the genre. But that's probably for another discussion :)

Trent R

Well I'm just using it as an example (and it has voices included too) of one way to use Display and Speech separately.


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk