# Php game formula

Page 1 of 1

## 11 Replies - 2607 Views - Last Post: 20 January 2010 - 11:18 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=150864&amp;s=d334af9e22131b7365dfd7f59d11c3cf&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

# Php game formula

Posted 20 January 2010 - 03:26 AM

Hi all, as some know i am creating a php text game, i am in a point of trouble, i am creating the attack system, but i dont know the correct formulas. Here are some variables
```\$will = 1200;
\$level = 1;
\$strength = 100;

```
they are some variables. Now i need to cram them into a formula to equal a small number eg 2 , 5 but every level you gain your strength goes up as does will.
Is This A Good Question/Topic? 0

## Replies To: Php game formula

### #2 Auzzie

Reputation: 43
• Posts: 573
• Joined: 20-January 09

## Re: Php game formula

Posted 20 January 2010 - 03:36 AM

What formulas have you tried already?

### #3 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

## Re: Php game formula

Posted 20 January 2010 - 04:11 AM

```1) will/strength*level
2)\$rand = rand(1,6);
strength*\$rand/level/will
```
thats about all i could think of lol but, its hard lol

### #4 Auzzie

Reputation: 43
• Posts: 573
• Joined: 20-January 09

## Re: Php game formula

Posted 20 January 2010 - 04:15 AM

Okay and what is Will?? If it is something special that can seriously affect the formula then it helps to know

### #5 Crehl

Reputation: 6
• Posts: 49
• Joined: 25-January 09

## Re: Php game formula

Posted 20 January 2010 - 04:41 AM

I'd be interested to know why you want to do this, as it sounds like all you want is to create a hash of those 3 variables, unless I've misunderstood your original intentions.

### #6 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

## Re: Php game formula

Posted 20 January 2010 - 04:47 AM

Soz here are all the variables
```\$will = 1200;
\$strength = 100;
\$agility = 50;
\$guard = 50;
\$level = 1;
\$rand = rand(1200,4500);
\$formula = \$will/\$strength*\$rand/\$guard/\$agility*\$level
```
thats sorta the formula, but every time a person levels up the \$will goes up by 200 \$level goes up by 1 and \$strength,\$agility,\$guard goes up anything you train it

### #7 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

## Re: Php game formula

Posted 20 January 2010 - 04:52 AM

Well as i said its an attack system for a php text based game

### #8 Auzzie

Reputation: 43
• Posts: 573
• Joined: 20-January 09

## Re: Php game formula

Posted 20 January 2010 - 05:12 AM

One big problem i can see with your formula at the moment is the lack of brackets ( and ) which would help a lot.
Don't forget when making an attack script you need to calculate the opponents defence too.

So for the brackets maybe try using this:
\$formula = ((\$strength * \$will) / (\$rand / (\$level * \$rand)) - \$defenceFormula;

### #9 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

## Re: Php game formula

Posted 20 January 2010 - 05:33 AM

Ok ive changed that formula around to what i want thanks but how do a calculate a defence formula

### #10 Auzzie

Reputation: 43
• Posts: 573
• Joined: 20-January 09

## Re: Php game formula

Posted 20 January 2010 - 10:48 AM

that would depend on your defensive stats.... then the formula would be almost the same

### #11 nanowire

Reputation: 1
• Posts: 107
• Joined: 05-January 10

## Re: Php game formula

Posted 20 January 2010 - 11:30 AM

This should be in the game forum, not here. Please, save me the trouble of making me report to move this or move this.

This post has been edited by nanowire: 20 January 2010 - 11:31 AM

### #12 aaron1178

• Dovakiin, Dragonborn

Reputation: 169
• Posts: 1,308
• Joined: 22-October 08

## Re: Php game formula

Posted 20 January 2010 - 11:18 PM

Sorry, my fault, but it is a php game and the coding is php and it is php formulas so technically i did post it in the right place lol next time ill remember

Sorry, my fault, but it is a php game and the coding is php and it is php formulas so technically i did post it in the right place lol next time ill remember