NPC's wandering, "windowshopping?"

Started by Hollister Man, Wed 31/03/2004 19:19:23

Previous topic - Next topic

Hollister Man

I just thought of an interesting idea, perhaps it has been used before.

I have seen the NPCs in Pleurghburg and KQ2:RTS, but they just kinda go by.  Could it be useful to make a script that would take them randomly to "walk to points" of different areas, possibly even making a state engine to randomize whether or not they're "interested" in that particular place?

I used the idea of windowshopping.  It doesn't seem like it would be hard to program an "engine" in the script that would allow characters to walk by, then decide they want to look at a window, then either go in, or continue on.  I can't count the times I headed off in a certain direction, quite quickly I might add, then decided to turn around abruptly to look at something.  :)

I had considered something like this to make more realistic NPCs that can randomly (per game or per session) decide they like the rain, or they happen to need shoes, or whatever, depending on the situation, so that they never get boring to go back and check if there's anything new that they know.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

Ginny

#1
Well, there is a plugin for a character control system that should just that, but I think it might be nice to be able to do this by scripting, since it's more interesting that way, and there's more freedom.
Now if on room enter after fadein I put some sort of routine for a character, that works in the background (i.e. only non-blocking commands that don't interrupt the gameplay), with "points" to stop, like for example you could have the character walking near a shop window, put a randomize function there, and an if statement to see what came up, say 0, 1, or 2, and in each case the character "chooses" to do something different. I could also make a seperate function to do the whole randomization thing, asking just at which point and which character needs to be handled (or maybe a few otehr things, it depends).
Now this, if it works, would cover the "AI" in the room, but one thing that would be nice is to control characters in other rooms at the same time, for example if I want to build up a day/night timed world, where eachcharacter has a routine which is subject to changes, surprises, etc, and characters do things in other rooms while we are not present. This could be handled somehow in the global script perhaps?

This is quite a complicated idea, though, so if I look at just continuing the random sequence of events, then if NPC1 decides to walk into the store, and you have another room for the store interior, and you want, for example, for him to buy new shoes and throw out the old ones when he gets home, then scripting this part in the global script is best (for the variable of the shoes object appearing in the trash for example), but what happens if, a few seconds later, the main character follows the NPC into the store? depending on how much time has passed, the NPC could be just picking up the shoes, or trying them on, or standing in line, or already buying them, going out, etc.. Then the character must continue to his house, or keep wandering, and have the shoes in his inventory, so if he comes across the same shop or another shop, he doesn't buy the shoes again...
So, are timers room-based or can they be global, to do this?
It would be great if we could control characters (NPCs) in different rooms, through the global script, simply by giving coordinates and such to walk in the other room, but actions with objects and even walking in other rooms isn't possible yet as far as I know, so maybe just setting the state of all objects and characters on room enter before fadein, according to a global timer and I feel so tired all of a sudden, too much writing....... ;)
Gawd, so many questions... :P

P.s. I don't quite remember, is there a function for a timer, like Timer (number, count, whatever), or is it just the while loop:
while (count!=0) {
//do this and that
}
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

SMF spam blocked by CleanTalk