Jump to content

Recommended Posts

If your willing to help me sort things out like calculators for a game, or generate a hiscore lookup (a future project), please can you either help me here, or help me via msn, skype, AOL messenger or other device.

 

I can't pay for your advise, but I am a complete novice and this is the only way I will learn.

 

If you post here, I will send you my code via a PM if thats possible.

 

Basically, I need to recalculate, using a different formula, which I think I would just need to change the order of things but I am not sure.

I am glad.

 

function combatLevel($attack, $defence, $strength, $hp, $prayer, $ranged, $magic, $summoning) {$base = ($defence + $hp + floor($prayer / 2) + floor($summoning / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;$ranger = floor($ranged * 1.5) * 0.325;$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);}
function combatLevelF2p($attack, $defence, $strength, $hp, $prayer, $ranged, $magic) {$base = ($defence + $hp + floor($prayer / 2)) * 0.25;
$melee = ($attack + $strength) * 0.325;$ranger = floor($ranged * 1.5) * 0.325;$mage = floor($magic * 1.5) * 0.325;
return $base + max($melee, $ranger, $mage);}

 

The new formula is simpler now. Its just Defence + highest level out of Strength, Ranged, Magic, Attack and Summoning.

 

So, would this work, if not why?

 

function combatLevel($attack, $defence, $strength, $hp, $ranged, $magic, $summoning) {$base = ($defence + 2);
return intval($base + max($attack, $strength, $ranged, $magic, $summoning)); 

Edited by gaogier

I moved your topic here because it has something to do with app/algorithm design. That said, we're not 1-on-1 mentors, and, quite frankly, we don't know what you're talking about. It looks like you're making a game. Beyond that, who knows?

 

So, take a breath and write exactly what you're trying to do, what you've tried, and what's gone wrong. Since we're not in the room/in your head, we need more info.

 

Finally, please don't PM your code to me. Instead, post it here within


tags. You'll get more eyes on it, and thus more help, that way.

I moved your topic here because it has something to do with app/algorithm design. That said, we're not 1-on-1 mentors, and, quite frankly, we don't know what you're talking about. It looks like you're making a game. Beyond that, who knows?

 

So, take a breath and write exactly what you're trying to do, what you've tried, and what's gone wrong. Since we're not in the room/in your head, we need more info.

 

Finally, please don't PM your code to me. Instead, post it here within


tags. You'll get more eyes on it, and thus more help, that way.

 

Thank you, I am not going to PM you the code don't worry. I am however not designing a game, its a calculator so players of an existing game knows what levels they need to level up to gain combat levels - an combat calc.

 

I am very bad/new to php and never progressed pass basic skills.

 

I sort of know what I am doing, but also don't have a clue - I am making it up as I go along.

 

I know this is a forum, the only problem is it takes programmers a while to read posts, hence things take a while to get done, I just wanted to see if anyone wanted to help me speed this up.

 

I am comfortable to do this myself, but just need a guide. I am happy to do this here.

Perhaps use functions which do some basic things?

 

For example, let's say for a player, you had an array with the some levels and their scores similar to

 

$player = array($level_1 => 1000, $level_2 => 4000);

 

You may then have a function to add the total score of the player such as

 

function add_scores($scores) {
  $total = 0;
  foreach($scores as $level => $score) {
  $total = $total + $score; // $total += $score would also work
  }
  return $total;
  }

 

And then simply call it as

 

add_scores($player);

 

Of course, you may not want to use this particular function, but this is the general idea. Write out functions so you can reuse them later on and make your pages easier to read. As with any other project, take things one step at a time, don't freak out if it seems like such a large workload, split it into smaller parts and work on them one by one. Maybe think more about the problem itself rather than the solution. Also, if you feel that the required PHP skills are a bit overwhelming, perhaps it's time to hit the books again, but more importantly, practice and experiment more. So many have done it, surely you can too.Good luck! :D

 

Cheers,

Amp

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.