Page 1 of 1
PvP script
Posted: Thu Feb 03, 2011 4:34 pm
by petermax
hi i am new to this site and i was wondering if omeone could help me to make a pvp script and how to setup the sql for that, i am using hall“s tutorials base for my game
Re: PvP script
Posted: Thu Feb 03, 2011 6:54 pm
by hallsofvallhalla
What kind of PVP are you looking for?
Players can click on other players and attack them whether they are offline or not? Or more of a realtime approach?
The latter is far more difficult.
Re: PvP script
Posted: Thu Feb 03, 2011 8:26 pm
by zvi5
i was also looking for one though i've been through the tut's and there are somre turn based p-v-p, but i am still with the whole mmorpgtut series code and i'm trying to move it over to $_session vs.$_session2 but have no clue how,secondly if i were to make a "auto self creating table"(like my hiscores
Code: Select all
<?php
include_once 'connect.php';
session_start();
include_once 'logo.php';
?>
<link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">
<?php
if(!isset($start))
{
$start=0;
}
$order="SELECT * from players";
$order2=mysql_query($order);
$d=0;
$f=0;
$g=1;
print "<center>Page: ";
while($order3=mysql_fetch_array($order2))
{
if($f%20==0)
{
print "<A href='topland.php?start=$d'>$g</a> ";
$g++;
}
$d=$d+1;
$f++;
}
print "</center><center>Players by Rank<br>";
print "<table border='1'><tr><td>Player</td><td>Level</td><td>hitpoints</td></tr>";
$topplayers="SELECT * from players order by exper DESC Limit $start, 20";
$topplayers2=mysql_query($topplayers) or die("Could not query players");
while($topplayer3=mysql_fetch_array($topplayers2))
{
$topplayer3['name']=strip_tags($topplayer3['name']);
print "<tr><td>$topplayer3[name]</td><td>$topplayer3[level]</td><td>$topplayer3[maxhp]</td></tr>";
}
print "</table>";
?>
)
and how would i make it a like in each name of my hiscores to the "attack" page(for that player!) OH and BTW i got corn jobs working =))) tysm halls you own

(oh and 1 last thing not really related,how would i sell turns ect on paypal? is there a way to sell code/non-pysical meterials?)have a good one,zvi!
Re: PvP script
Posted: Thu Feb 03, 2011 10:42 pm
by Callan S.
You gotta slow down man, programming, unlike normal life, is about getting each step done right, one at a time.
PVP where you simply attack the stats of another player is simple, in that it's essentially the same thing as attacking a monster from the database (as shown in the tutes). Instead of pulling monster stats, you pull up some other players stats.
Re: PvP script
Posted: Fri Feb 04, 2011 4:09 pm
by petermax
yes, that make sense ,
well i think it would be better a live pvp where players can fight each other realtime , but let me try that first
Re: PvP script
Posted: Fri Feb 04, 2011 6:47 pm
by Jackolantern
That is quite a bit more difficult than over-time PvP. A couple of the challenges are:
1. Keeping it fair when anyone can exit the battle at any time.
2. Notifying the attacked player in a timely manner that they have been attacked (PHP cannot do this alone).
3. Keeping players updated without obscene bandwidth costs....etc.
You will have to use a ton of clever Javascript to get real-time PvP. My suggestion, as always, is to use jQuery for all of your JS needs!