Jump to content
MakeWebGames

Upgradable Items


sniko

Recommended Posts

Hey,

This isn't a request, or a "ahh, help me moment" but an idea someone could do, to try and get the community back as it was, to inspire young/old developers to open and develop games. Anyway, this is the idea;

The Idea

You mine for ore, and with that ore, you can upgrade your items. A simple concept, and potentially enjoyed by many players.

SQL Tables

upgrade_items, with the following columns;

id int(4) PRIMARY KEY

ore_needed varchar(50)

item_from int(4)

item_to int(4)

ID For indexing

ore_needed store an array of values, separated by a comma, explode the comma, to see what they need. Stores itemID's from the items table

item_from this is the item that you are upgrading, a numerical value.

item_to once you have all the "ore_needed", this is the item you get once upgraded.

The How

L.png

Credits

This thread

This post

peterisgb

illusions

Anyone who makes this has full distributor rights.

~sniko

Edited by sniko
Link to comment
Share on other sites

I was going to create a feature like this and got about 50% of the way through. As always I wanted to make the system truly dynamic so it'd fit with any game. I soon realised how much work it'd be to get my unique ideas implemented into the system without making it take up allot of my time.

Link to comment
Share on other sites

I did something like this a while ago, which I dont have anymore, so if someone has my crafting system, please send me a copy :P But it pretty much did this, but you could restrict each 'upgrade' to each job. If I can be resent a copy, I will upgrade it, and create it outside of the jobs.

Link to comment
Share on other sites

yh.. lol, to go abit more on this, beyond me of course, but the idea is, you mine, ore, bronze, tin and more,

Then the idea was to melt them, combine them together then upgrade the wepaons, i'm working on the mineing part now

Nothing is beyond you its PHP not quantum physics!! Its really not that hard just a matter of getting used to it and then learning more on how to do it better.

Feel free to show what you have and then it can be made better.

Link to comment
Share on other sites

ok, here goes

Well so you'll need to place these sql into the users table

iron int 54 default 0
bronze  int 54 default 0
silver int 54 default 0
copper  int 54 default 0
tin int 54 default 0

 

Make a Page and call it minestats.php

<?php
include "globals.php";
global $db,$ir,$c,$userid,$h;
$db->query("UPDATE users SET lastpage='Mine Stats' WHERE userid=$userid");

print "<h3>General Info:</h2>";
$exp=(int)($ir['exp']/$ir['exp_needed']*100);
print "<table width='50%'><tr>
<td><b>Iron:</b> {$ir['iron']}</td>
<td><b>Bronze:</b> {$ir['bronze']}</td></tr><tr>
<td><b>Silver:</b> {$ir['silver']}</td>
<td><b>Copper:</b> {$ir['copper']}</td></tr><tr>
<td><b>Tin:</b> {$ir['tin']}</td>
<td><b>Gold:</b> {$ir['crystals']}</td></tr><tr>
</table>
<br />
<a href='mine.php'><h3>Go Mining</h3></a>
<br />
";
if(isset($_POST['pn_update']))
{
$db->query("UPDATE users SET user_notepad='{$_POST['pn_update']}' WHERE userid=$userid");
$ir['user_notepad']=stripslashes($_POST['pn_update']);
print "<hr><b>Personal Notepad Updated!</b>";
}
print "<hr>Your Personal Notepad:<form action='index.php' method='post'>
<textarea rows='10' cols='50' name='pn_update'>".htmlspecialchars($ir['user_notepad'])."</textarea><br />
<input type='submit' value='Update Notes' /></form>";
$h->endpage();
?>

 

call this one mine.php

 

<?php

include "globals.php";
print "
<div align='center'>
Welcome to the mine.

But you can go ahead and try, you might just get lucky.<br />
<a href='gomining.php'>Go Mining for Gold</a>
<a href='gominingi.php'>Go Mining for Iron</a>
<a href='gominingb.php'>Go Mining for Bronze</a>
<a href='gominings.php'>Go Mining for Silver</a>
<a href='gominingc.php'>Go Mining for Copper</a>
<a href='gominingt.php'>Go Mining for Tin</a>"; 
?>
<?
$h->endpage();
?>

 

Call this one goming.php

<?php
include "globals.php";
$rand = rand(1,5);
$rand2 = rand(1,5);
$reward = crystals;
$randreward = rand(1,25);
$userid = $ir['userid'];
if($ir['brave'] > 4)
{
if($rand == $rand2)
{
   $db->query("UPDATE users SET brave=brave-4 WHERE userid=$userid");
   $db->query("UPDATE users SET $reward=$reward+$randreward WHERE userid=$userid");
   print "While mining through the rubble you came across $randreward gold.

   <a href='mine.php'>Go Back</a>";
}
else
{    
   $db->query("UPDATE users SET brave=brave-4 WHERE userid=$userid");
   print "Sorry, you did not find anything.
<a href='mine.php'>Go Back</a><br />";
}
}
else
{
   print "Sorry, but you cant mine for at the moment.

   <a href='index.php'>Go Back</a><br />";
}
?>

 

for bronze eetc, copy the page above and name the file and save.

Edited by peterisgb
Link to comment
Share on other sites

ok, here goes

[...]

for bronze eetc, copy the page above and name the file and save.

Just a few pointers, I'm not flaming here, but;

1) Research into the switch control

2) In the database, you are creating columns with 54 bits, even if you are using 8 - at maximum - it will (not to the eye) fill in the rest with 0's, therefore wasting space. Think how many you can have when just using 8 bits. "xxxxxxxx" => "99999999" (Quite a lot)

3) What illusions said, create a new table with the foreign key 'userid' for mining

 

Other than that, well done :)

Link to comment
Share on other sites

I notice on the gomining.php if un-successful it deducts 4 brave. you really need to think about how youve done this statement as your users could find themselves going into minus values always make sure they have enough to deduct or tell the statement to only deduct 4 if 4 is available

Link to comment
Share on other sites

I notice on the gomining.php if un-successful it deducts 4 brave. you really need to think about how youve done this statement as your users could find themselves going into minus values always make sure they have enough to deduct or tell the statement to only deduct 4 if 4 is available

Following on from this, you need to ask yourself the question - Can they mine even if they don't have enough brave?

If no

<?php #remove tag
if($ir['brave'] < 4) {
echo "You need at least 4 brave to enter the mining shaft...<br /> 
        » <a href='index.php'>Back home</a>";
exit($h->endpage());
}

 

If yes

<?php #remove tag
$db->query("UPDATE `users` SET `brave`=`brave`-4 WHERE `userid`={$userid} AND `brave`>4");
?>

 

Also, you need to look at your game, and think - Is 4 brave too much? How much brave do they start with and get when they level? Can I make mining items to make, if they have bought, the required brave become less?

Just an idea, and a few pointers.

Link to comment
Share on other sites

cool, thanks for this,

now moving onto weapon upgrade,

i dunno where to start.

Have a look at the original post and look into these php functions, should help you get there;

mysql_fetch_array

mysql_num_rows

Also make sure you check the php manual and think of the solution (the system) logically, and don't over-complicate it.

Also, make use of primary keys and foreign keys.

Once you have tried, even if you succeed or fail, post it here, and PM me, and I'll read through your programming and give you pointers, if I feel there needs to be any.

-sniko

Link to comment
Share on other sites

well i've always had a problem getting querys from the item section, because i would beleive that once i understand how to do that i can contiune, i think going along of the idea of collecting the weapon data + post=updade+etc i tried using this weapon way when displaying weapons in iframe on the side menu, but this failed.

Link to comment
Share on other sites

  • 4 months later...
I did something like this a while ago, which I dont have anymore, so if someone has my crafting system, please send me a copy :P But it pretty much did this, but you could restrict each 'upgrade' to each job. If I can be resent a copy, I will upgrade it, and create it outside of the jobs.
you talking about the one with recipes for jobs ? i have that.
Link to comment
Share on other sites

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.   Paste as plain text instead

  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...