Jump to content

mysql php math combat system help


Jiraiya

Recommended Posts

i want a to have a fighting like system in the game i am making. like in the mysql table

there are npc enemys for players to fight against to train there characters. the npc enemys have preset health Skill(what is used to determine strength basically its just subtracting the skill from the enemys health and keep doing that until the one of them dies by having there health reach zero. and when a player kills a npc enemy i want the player to gain a set amount of "skill" points and cash to add to there character profiles any idea were i should start? im new to using php and mysql but im learning

npc health       dmg   skillgained    gold

nin1  50          7          10          2

nin2 600         15         100         6

nin3 2400      200         200         8

nin4 7500         1500         300         10

nin5 21500 2500         400         12

nin6 100000 7500         1500         15

nin7 410000 35000 3500         18

nin8 1500000 100000 10000 22

nin9 5000000 750000 50000 27

nin10 17500000 2000000 100000 33

nin11 65000000 5000000 500000 40

nin12 185000000 12500000 750000 48

Edit Delete nin13 1000000000 100000000 1000000 55

Link to comment
Share on other sites

Well, lets say I have a database called, "game" and a table called "monsters". The table will probably look like this,

name| Health | damage  |
    |        |
------------------------
nin1|    50  |     3   |
nin2|   600  |    10   |
nin3|  2400  |    20   |
nin4|  7500  |    26   |
nin5| 21500  |    32   |
nin6|100000  |    50   |

Now look at that. 50 damage!? We need to change that. So an UPDATE query would be necessary.

//Change the value from 50 to 42
//define the table
UPDATE `game` (Tablename)
//now SET the value
SET `damage` = '42'
//Where at?
WHERE `name` = 'nin6'

There you go There is an update for you =).

Link to comment
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.

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.