| 10-28-2004, 07:30 PM | #1 |
I'm curious if anyone has made or would be willing to make type of "Villager AI". Right now, in my town all the NPC's roam around the city, but it's fairly random where they go. Ideally I could make a system of triggers that gives every villagers some kind of purpose for going to a certain place, like going to the market district if they need food, going home at night for sleep, etc etc etc. It's for a campaign, the town will be the center of it all, kind of like the Durotar campaign so I want things to be as realistic as possible. Anyone seen something like this or would be willing to check out my project and see if you want to join? |
| 10-28-2004, 09:00 PM | #2 |
I dont know if anyone made, and im not really willing to make, but I can tell u how 2do it : make a region array with some regions where the villagers should go to. Then set the custom value of a villager to a random number (or use some kind of formula) and order them to move to regionarray[units custom value]. Hope this helps u :god_help_us: |
| 10-28-2004, 10:28 PM | #3 | |
Quote:
That's almost exactly what I have now. Villagers just kinda walk around aimlessly though, maybe i'm reading too much into it but it looks too fake. I don't need help doing it, just wondering if anyone would be willing to do it because I'd rather stick to other mechanics and terrain and story elements. |
| 10-28-2004, 11:08 PM | #4 |
I have an idea. How about.. Make 4 variables, Food, Recreation, Home. Each variable set it to 100 during initiation. The 4th variable name it "Randomstat". Have em all as integers. Make two triggers. One trigger is: Event: Periodic Event, every 5 seconds. Action: Set Variable Randomstat = (random number between 1 and 3) if (RandomStat) = 1 then Set Food = Food - 1 If (RandomStat) = 2 then Set Recreation = Recreation - 1 If (RandomStat) = 3 then Set Home = Home - 1 Else Do nothing of course! And so the villager will walk around with that ability random roaming... and every 5 seconds one of those stats will drop. You can use arrays to determine which villager you want to assign each array to. Say you had 5 villagers, you can make a variable called "Villager(#)" array 1 to 5. Assign Villager(1) to 1, etc. But you'll need to array each of the stats as well except Random. Then make another trigger: Event: Every 5 seconds. Conditions: None Action: For Integer (1 to (number of villagers)) If Food(IntegerA) is less than 50 then Unit-Issue (Villager(IntegerA)) to move to Region(foodstore) and repeat for every stat you have so it'll move there. You can then make a trigger for when a unit = villager moves into region and fill up that stat again. Just so I don't end up doing it all for you I'll stop here. |
| 10-29-2004, 01:44 PM | #5 |
Somethign that I have been wanting to do dose not exactly follow random variables and locations. Instead you have about 50 - 100 villagers, all doing their own unique thing. At dawn a ( or a family of ) villagers spawn infront of their house, where they procede to go to their erspective locations. Children to an open ground school house, men to a lumber field to chop wood, women to markets, etc. It would not involve programming each individual villager, perhaps create mutiple variations of villagers. ( Villager (Male-Lumberjack), Villager (Child-School), Villager (Male-Gaurd) ) You could select all Lumberjacks and order them to proceede to the lumber field and have them begin to harvest from random trees. Gaurds are ordered to go to their post where they equip and become a footman. One or two teachers are ordered to go to the school and stand or movearound as though they are adressing a class. ( Order [Villager (Child-School)] 1-20 to move to location [School] 1-20 and face [Teacher] - Rows of kids. ) At night they all go back to their respective homes and dissapear inside of it to sleep, then perhaps a few males come out as night watchmen, or even a few females. (Wink-wink.) It could get tedious to do, and perhaps not what your lookign for. But it's something I've been looking at doing, and have been tryign to get around to it. |
