# Game hustle function

## Recommended Posts

I am creating a turn based game for my programming class.

I am creating a hustle function to "hustle" drugs/ deal drugs

I have a "study" section and the higher you learn about the drug you are hustling the more you will sale.

My Question is does anyone have an idea of what to do.  If I am not making sense let me know but for now I will show you and example

say my player has 21 pounds of weed to sale.

he has 6 hustlers that is part of his crew and he has increased his study to stage 11 which % is 44%

So I am looking to see what would work best if the user wanted to use 6 turns to sale/hustle 21 pounds of weed.  Any suggestion.  I have part of the script coded but nothing but setting the variables....

##### Share on other sites

Perhaps if you stop smoking the weed, your mind will be more clear...

Also, do you really think your teacher is going to like seeing a game about drug dealing? Do you really think nobody is going to start eyeballing you more for this? Running around telling the whole world "HEY I SMOKE WEEEED!!" is a good way to put yourself in a position of NOT getting to smoke weed.  Just sayin'...

##### Share on other sites

Agreed. I remember in high school there was a popular game about drugs and pimps. If one of the kids got caught playing it they got in trouble. And that was just PLAYING it.

Make it school friendly.

Next, post code and an exact problem, and we can help debug. But if you're just asking "how should I program this part of my game", well you're the programmer.

##### Share on other sites

Hey! I smoke weed! (Well mostly eat it now, it's much kinder to the respiratory system)... but it's for medical and I generally only use it as a sleep aid and for diet. Can't get any work done with a clouded head

This issue is pretty simple. For each turn, any given 'hustler' has a 44% chance to sell a given amount (say 1lb).

```<?php

if(rand(1,100) <= \$study_percent) {
// 1 lb was sold
}

?>```

To do that for all 6 hustlers

```<?php

for(\$i = 0; \$i < \$hustler_count; \$i++) {
if(rand(1,100) <= \$study_percent) {
// 1 lb was sold
}
}

?>```

##### Share on other sites

i would add caveat but im too stoned to bother

##### Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.