A cool idea for shop.php

C++, C#, Java, PHP, ect...
Post Reply
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

A cool idea for shop.php

Post by ZeroComp »

Don't like the prices? Barter!!!!!
in shop.php add at the bottom <a href='barter.php'</a>
barter.php so far

Code: Select all

<?php

include_once 'connect.php'
session_start()
<center> echo "Give me an offer"
<input type='number' 'name=offer' size='11'>
after that I'm figuring how to make the variable offer but here is the if function that you can change the number for the max offer
if($offer <100;)
{
echo "Thats to low."
}
else;
{
echo"I'll take it."
}
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
Joey
Posts: 82
Joined: Mon Jan 11, 2010 3:47 am

Re: A cool idea for shop.php

Post by Joey »

Cool :)
FLASH - Epic

Image
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: A cool idea for shop.php

Post by Jackolantern »

You would probably want to add a bit more to the barter system than just a simple If-Else construct, because once players figure out the amount he is deciding on, they will always offer him the lowest amount possible. What if it was randomized for each player when they start bartering, and if the player tries to go too low, the shop will not sell to them for a certain period of time? That way there is a risk in asking for lower prices.
The indelible lord of tl;dr
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: A cool idea for shop.php

Post by jpoisson »

Yea JOLantern is right. You want to make the bartering price item specific. So you would go by %'s and then you can add a skill that actually can affect the % that a player can barter off of an Item.
Laguages:
PHP, MYSQL, (X)HTML, HTML5, JQuery, CSS 3.0,
C, C#, C++, Python, Pascal, Perl, Ruby, Turing

Software:
Adobe MC CS4, Visual Studio 2008, Notepad++,
NetBeans IDE, WAMPSERVER

Browsers:
Internet Explorer, Firefox, Opera, Safari, Chrome
(Always have latest patches for browsers.)

Free time:
...
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: A cool idea for shop.php

Post by hallsofvallhalla »

normally you would use a barter skill for this but since we dont have one lets just use some rands
quick and dirty version

Code: Select all

$randmod = rand(0,20);
$minprice = $iteminfo3['price'] / $randmod;
$minprice = $iteminfo3['price'] - $minprice;

if ($_GET['offer'] >= $minprice)
{
echo "He accepts your offer!"
}

else 
{
echo "No way pal!!";
}
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: A cool idea for shop.php

Post by ZeroComp »

Yeah after revising it I was thinking about putting a rand() in there but I didn't think of a actual "barter skill" so if I had a barter skill would i do a
if ($barterSkill==3)// just keep putting the rand() lower and lower right?
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Post Reply

Return to “Coding”