Scripting a Living World

Started by ZZjZmoz, Wed 19/11/2003 20:58:38

Previous topic - Next topic

ZZjZmoz

How can I script a living world? By that, I mean how do I script peope moving from place to place while the player is offscreen and still be moving so that when the player goes to that room, they'll be there, as if the main character was there the whole time? Also, how do I have the people do animations to pick up stuff while main char. is on and off screen? Next, how can I have certain people do certain jobs.

For example, in Joe's Weapon Store:
    Joe sells AK47s, Combat Shotguns, and 9mm Pistols. AK47s have a stock of 5 max, Shotguns 2 max., and pistols 8 max. People come into the store and buy some of these weapons, and then leave. This decreases the store of weapons. When you go in, you could buy one if they have one. If they don't have one, every hour, on the hour, Joe's friend Bill, comes in with a stock of weapons on a dolly. He talks to Bill, goes into the backroom, and leaves the stock behind as he makes his way out. Then, the thing starts all over again.

How can I make this?

Optional 1: How do I make an economy system?

Example: Bob has to pay his superiors. His weapons cost $420 for 9mm, $1,350 for AK47, and $2,750 for shotgun, and he also recieves a bazooka (1 stock, $5,780). Every 25 minutes, prices randomly change by between 1-3%, in a random direction (-,+) for each gun. Joe has to pay his buddy, Mike, who leased the store to him $10,000 each day (changes at same rate as price).
The people in the town have randomly between $2000 - $4000, and some of them go shopping for food and guns. They buy out the stocks and Bob gets a profit (price - cost. Cost is 25% to 30% of the price. Price is marked up). If Bob can't supply this money, the shop is closed for 3 days, and then reopens. If he can, the shop lives on another day.

Thanks for the help!!!

Released Late August 2007

scotch

#1
Hmm, I think really they are the kind of thing you'd have to be able to work out how to make yourself to be able to handle them properly, stuff like this complicates a lot of things.  They are both quite possible though.

Characters moving around off screen is tough work, the economy system is much easier, just learn about variables and timers.  Try making a simple game first, then you'll understand how this stuff works.

Sorry if this seems really unhelpful, I think it's right though.  Perhaps someone nicer will just give you a cut and paste script anyway ;)

ZZjZmoz

Np. I think i could manage. I just need to know how to make characters move off screen.

Also, i need to know these things:
1. How to make characters wait without affecting the main char.
2. How do I randomize numbers?
3. Is there a way to make AND rename variables, local and global?

thanx.

Released Late August 2007

scotch

To make characters wait, just don't tell them to do anything until you want them to, or try tou the Character Control System plugin, that might help, haven't used it myself but it seems to be for this kind of thing.

Random numbers are done with Random()
variable = Random(50);

You can't rename a variable once you've made it.. but there's no reason to, they are for holding variable data, not being variable data themselves.
You can set it to another value with
variable = whatever;

ZZjZmoz

there's just one problem...
How will I get them to move when I want them to?

I want them to walk around and then stop and wait at specific points, such as picking up something, like a can of peas off of a Grocery store shelf. In this case, they do this without interaction with the main character, so I need some way to make them pause and then go to the store counter or something.

Released Late August 2007

Scummbuddy

I too would suggest you take a look at the Char Control System plug in, although we don't typically send new people to our engine to the plugins.  It should be what you want.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

ZZjZmoz

Cool. Thanks. but where can I find this Char Control System plug in? Sounds interesting.

Released Late August 2007

After

#7
You can find the CCS plugin by starting your search at the AGS main page.

However, I suspect that you will still find telling all the characters how to behave quite messy. It may be best to build the environment first, before adding any population management, otherwise you risk unreadable code.

When the time comes, the Finite State Machine plugin may also be of use to you.

[edit:afterthought]
Try PMing deltamatrix for tips. He's already worked with CCS.

SMF spam blocked by CleanTalk