Author Topic: I'm a little stuck...  (Read 692 times)

Offline ZadoAsh

  • Level 10
  • *
  • Posts: 62
  • Reputation: +0/-0
    • View Profile
    • Families of New York
I'm a little stuck...
« on: June 07, 2008, 06:50:15 AM »
So I'm working on a completely new game for my site familiesofnewyork.com - i'm changing it to become more unique and more fun.

Currently the users must use turns in order to collect $$, recruit men and produce drugs... everything else is bought.

So.. The new game will get rid of turns and make the game more time based... "it'll cost $5,000,000 and 5 minutes to build this, once built it will earn you +$100 per hour"  kind of thing

You'll also have to hire men (thugs, hitmen, bodyguards, prosititutes, card dealers, hustlers and thugs) to work for you... this is where I'm stuck because it'll cost so much to have these men (per hour) and i want to make it so if you can't afford to pay your men they'll start walking out on you... Thats where I need help!

I don't want one type of men to walk out, then the next and the next so on so forth. I want it so "5 hustlers, and 2 bodyguards walked out on you at 11:00PM"   I'm not too sure how to make it selects an appropriate amount of men.

If it helps... I'll place a little scenario.

"I have 5 of each unit
thugs -$5 each per hour
bodyguards -$2 each per hour
hitmen -$6 each per hour

prostitutes -$10 each per hour
punks -$1 each per hour
card dealers -$15 each per hour
Hustlers -$100 each per hour

total of -$695 per hour

I have:
one pub (which contains an illegal casino)   +$10 per hour
one club (which has a whore house) +$300 per hour
one restaurant (which contains punks to pickpocket) +$200 per hour
one bakery (which contains loan sharks(hustlers) ) + $100 per hour
total: $610 incoming

that means I'm losing $85 per hour!
So that's when the units begin leaving cause they ain't getting paid!"

I want people to leave up until I begin making 20% of what I'm currently losing per hour ( $17 in this case)

"One Bodyguard has left (+$2 per hour)
One Hustler has left (+$100 per hour)"

Which then means I'm making $17 per hour.

All I need to know is how I can work out who leaves... but I don't want only one unit type leaving.

If this doesn't make sense just tell me and I'll try and figure it out on my own! lol

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: I'm a little stuck...
« Reply #1 on: June 07, 2008, 08:22:03 AM »
I think who leaves is a choice up to you.

You can choose to make it random (every so often a person is picked at random to leave), or you can start from the cheapest units, or from the most expensive units.

From what I read, I think the one you want is the random option. Here's how I would do it. Make a loop which will keep on selecting random people to leave. The loop is broken when the total value of the men leaving exceeds a certain number. That number  can be a constant, or it might depend on the total value of the player, or the amount of money they are losing.
« Last Edit: June 07, 2008, 08:24:00 AM by Zeggy »

Offline ZadoAsh

  • Level 10
  • *
  • Posts: 62
  • Reputation: +0/-0
    • View Profile
    • Families of New York
Re: I'm a little stuck...
« Reply #2 on: June 07, 2008, 10:22:02 AM »
Ok cool, random is an easy route to go down.

I'll try that out an reply again if I get stuck on that :D

Offline ZadoAsh

  • Level 10
  • *
  • Posts: 62
  • Reputation: +0/-0
    • View Profile
    • Families of New York
Re: I'm a little stuck...
« Reply #3 on: June 16, 2008, 01:12:18 PM »
I did it and works a treat! I love it!

I also added 'reports' since it happens every hour I thought, how about a daily report that updates every hour ;) So yeah it all works perfectly atm.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal