Advertisement:

Author Topic: Stat Battle / RPG Mod  (Read 62547 times)

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: Stat Battle Mod
« Reply #40 on: September 29, 2008, 03:11:00 PM »
Okay.
I seams to be working great, but it only says "Your opponent dodged and took no damage!" every time I attack, so I don't know how it removes HP and all of that. :P

Also, I thought that if your users just keep fighting and fighting each topic will be filled up whit messages, which will Be pretty annoying.

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #41 on: September 29, 2008, 03:22:51 PM »
The script has been updated to say your name and their name in place of you  and your opponent.

If your stats are too much lower than your opponents, than yes, you'll never hurt them  ;).

Users can only use the attack buttons in threads called PvP threads, and the prupose behind the button is merely to tell the user whether they made a successful attack or not. The users at my site are Role-Players, so by using the attack function to determine whether they hit their opponent or not, they can then write out their action.

Example: Player A uses the attack button, and it says he hits. He writes a post like this:

"Player A draws his trusty pistol and cocks the hammer, firing a shot at the mysterious man in front of him. The bullet tears into his foe's shoulder."

His opponent can respond then by hitting the attack button and seeing what happens, then Posting a response in kind with that.

This goes back and forth until one person gives up or dies, and then the Admin can go back and delete the posts that simply state what hit and missed later, making it much easier to re-read for our other members. And I made a profile called "The Referee" and set his ID to the poster ID so he's the one who makes the posts, so that we can just go back and delete all his posts to clear out the forums.

I can send you the Stat Items I made for the Shop and some basic instructions on how to run it if you'd be interested.

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: Stat Battle Mod
« Reply #42 on: September 29, 2008, 03:26:45 PM »
I can send you the Stat Items I made for the Shop and some basic instructions on how to run it if you'd be interested.

Yes, I'm interested :)

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Stat Battle Mod
« Reply #43 on: September 29, 2008, 03:44:48 PM »
Well, then before running those queries, check if the $HP is empty or not. And also, you can send 'type' with url and do them all with just one function.

For example:

For physical => http://yoursite.com/index.php?action=attack;attacked=3;arena=1;country=6;type=physical
For magical => http://yoursite.com/index.php?action=attack;attacked=3;arena=1;country=6;type=magical

Then at the start of your Attack function:

if(!empty($_REQUEST['type']) && in_array($_REQUEST['type'], array('physical', 'magical')))
  $type = $_REQUEST['type'];
else
  fatal_error('Undefined type');

Then you will calculate variables according to that:

if($type == 'magical')
  $variables = a;
else
  $variables = b;

I really don't know how can I help you anymore. If you have specific coding questions, I can answer them if I can.

And Nascar; you can easily limit to a single board and call it the Battle Area.
Former SMF Core Developer | My Mods | SimplePortal

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #44 on: September 29, 2008, 03:50:44 PM »
Here you go, I attached the 12 items I have right now with a brief Read Me of what they do.

I'll write up a full explanation on the StatBattle system and how it works, what to do to set it up etc. and post it tomorrow.

Thanks for all your help, SiNaN! The only question I have is how to make it go to an error screen (like the "die(hacking attempt)" one and have it say "you can't attack for whatever reason" instead of actually posting it on the board.

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Stat Battle Mod
« Reply #45 on: September 29, 2008, 03:59:57 PM »
That was an easy question really. :)

In the if, instead of doing

$msg = 'You cannot attack';

do

fatal_error('You cannot attack!', false);
Former SMF Core Developer | My Mods | SimplePortal

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #46 on: September 29, 2008, 04:05:09 PM »
Dude, you really are awesome at this!

If I ever make this into a complete Mod for the Mod site, I'm giving you top billing for the credit:

By SiNaN / Daisuke.

Thanks yet again, and if I ever need anything else I'l post. Thanks!

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Stat Battle Mod
« Reply #47 on: September 29, 2008, 04:06:38 PM »
You're welcome. Glad that I could help you.
Former SMF Core Developer | My Mods | SimplePortal

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #48 on: September 29, 2008, 04:20:30 PM »
Update for Nascar:

Please download the attached file, it has an updated version of Potion, Full Heal, and Elixir as well as a Pheonix Down to revive dead players.

The update makes it so dead players cannot use a potion to revive themselves (kind of cheating lol.)

Offline matasanos

  • Jr. Member
  • **
  • Posts: 267
    • Lords-Beer.net
Re: Stat Battle Mod
« Reply #49 on: September 29, 2008, 04:21:04 PM »
uhmm!!!

this sound more and more exciting !!!
when we will have a complete mod?? or a stable version? moreless..

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #50 on: September 29, 2008, 04:24:52 PM »
The current version os Satble, but there's no mod for it yet lol.

At the moment, the following things are done:

-Stat system
-Stat items
-Auto-Adjusting HP and MP.
-Attack buttons

But there's still a few things I'll need to do before it's really ready to be done:

-Make the function move "dead" people into a non-post based group called "Dead."
-Make a permission so that "Dead" members cannot attack at all.
-Make a restriction somehow so that people cannot attack the same person repeatedly and kill them before an Admin can step in. (They'd get punished obviously, but it'd still suck to have to go back and fix it.)
-Making an edit to some files so that when a member gains enough posts to "level up" by reaching the next highest post group, he'll also get some stat items at random. (Should be easy to code, but I've no idea what files I'd need to edit...)
-Making a few other things just to make things smoother...
« Last Edit: September 29, 2008, 04:30:22 PM by Daisuke_aurora »

Offline Marcus Forsberg

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 8,608
  • Gender: Male
    • marcus.t.forsberg on Facebook
    • marcusforsberg on LinkedIn
    • @marcusforsberg on Twitter
    • marcusforsberg.net
Re: Stat Battle Mod
« Reply #51 on: September 30, 2008, 01:07:01 AM »
This sound really interesting. I'll test everything in a few hours.

And I just thought, couldn't you adjust the mod so that it adds its own profile fields when installed, so that Custom Profile Fields mod doesn't need to be used at all?

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #52 on: September 30, 2008, 08:09:39 AM »
Probably, but since it isn't yet a mod so much as it is 2 edits and 1 file, I'll have to see about adding that it when it's done.

Also, the Custom Profile Fields mod doesn't work on 1.1.6, so I'll probably just end up integrating that mod's edits into my own mod (As long as thats okay with the mod's maker.)

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Stat Battle Mod
« Reply #53 on: September 30, 2008, 09:23:20 AM »
Custom Profile Field uses this system.
Former SMF Core Developer | My Mods | SimplePortal

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #54 on: September 30, 2008, 09:37:29 AM »
Nice, thanks again!

Update:

I added some more checks to the codes (making sure you cannot attack dead people, people with no stats, yourself, if you have no stats, if you're dead) and also I added a chunk that checks to see if your attack killed the enemy, and if it did, to give you posts equal to 1/10th of their posts as a reward. (The stat system uses levels, and posts are the system's EXP. So, you get EXP for killing someone now.)\

Update again:

I'm working on adding Status effects to the Stat battle system, so that players can be poisoned, blind, silenced, etc. Also working on items to heal said status effects or cause them.
« Last Edit: September 30, 2008, 01:29:00 PM by Daisuke_aurora »

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #55 on: October 01, 2008, 12:42:38 PM »
Okay, now I need help again  :P.

Code: [Select]
<?php

if (!defined('SMF'))
die('Hacking attempt...');

//The Physical attack function.
function Physical()
{
global $db_prefix$sourcedir$ID_MEMBER;

//Find out who attacked who, and where.
$attacked_id = !empty($_REQUEST['attacked']) ? (int) $_REQUEST['attacked'] : 0;
$attacked_topic = !empty($_REQUEST['arena']) ? (int) $_REQUEST['arena'] : 0;
$attacked_board = !empty($_REQUEST['country']) ? (int) $_REQUEST['country'] : 0;

//Get the attacker's Atk value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP3'
&& ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($A) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the defender's Def value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP4'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($D) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the attacker's Spd value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes
WHERE variable = 'CP7'
&& ID_MEMBER = 
$ID_MEMBER
LIMIT 1"
__FILE____LINE__);
list ($S) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the defender's R. Spd value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP8'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($R) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the Defender's HP value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP9'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($HP) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the attacker's HP value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP9'
&& ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($youHP) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the attacker's name.
$request db_query("
SELECT realname
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($you) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the defender's name.
$request db_query("
SELECT realname
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($them) = mysql_fetch_row($request);
mysql_free_result($request);

//The actual Stat Battle formula.
$N1 mt_rand(110);
$N2 mt_rand(110);
$A1 $N1 $S;
$A2 $A1 $A;
$D1 $N2 $R;
$D2 $D1 $D;

//Can you even hurt anyone?
if(empty($A))
 
{
fatal_error('You have no attack value! Did you really think you could win by attacking for 0?'false);
$HP2 0;
}

//Are you suicidal?
elseif($attacked_id == $ID_MEMBER)
 
{
fatal_error('You cannot attack yourself!'false);
$HP2 0;
}

//Are you killing dead people?
elseif(empty($HP))
{
fatal_error('Either they are dead or have no stats! You cannot attack them!'false);
$HP2 0;
}

//Are you a dead?
elseif(empty($youHP))
{
fatal_error('You cannot attack someone if you are dead!'false);
$HP2 0;
}
//Are you beating the Ref?
elseif($attacked_id == 42)
{
fatal_error('You cannot attack the Referee!'false);
$HP2 0;
}
//Did you Smash them?
elseif ($A1 $D2)
{
$damage $A $A;
$HP2 $HP $damage $HP $damage 0;
$msg '' .($you). ' smashed ' .($them). ' for ' .($damage). ' damage!';
}

//Did you hit them?
elseif ($A2 $D2)
{
$HP2 $HP $A $HP $A 0;
$msg '' .($you). ' attacked ' .($them). ' for ' .($A). ' damage!';
}

//Did they dodge your attack?
elseif ($A2 <= $D1)
{
$msg '' .($them). ' dodged an attack by ' .($you). ' and took no damage!';
}

//Did they block your attack?
elseif ($A2 <= $D2)
{
$DA $A $D $A-$D 0;
$damage $DA 1;
$HP2 $HP $damage $HP $damage 0;
$msg '' .($them). ' blocked an attack by ' .($you). ', taking only ' .($damage). ' damage!';
}

//Do the damage.
db_query("
UPDATE 
{$db_prefix}themes
SET value = 
{$HP2}
WHERE variable = 'CP9' && ID_MEMBER = 
{$attacked_id}"__FILE____LINE__);

//Did you Kill them?
if (empty($HP2))
{
//Get their EXP.
$request db_query("
SELECT posts
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($Exp) = mysql_fetch_row($request);
mysql_free_result($request);

$Exp2 $Exp/10;

round($Exp2);

//Give the winner some EXP.
db_query("
UPDATE 
{$db_prefix}members
SET posts = posts + 
{$Exp2}
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);

//Did they recieve a Random Item drop?
$lucky mt_rand(30,80);
if($lucky 40 && $lucky 60 && $lucky != 49 && $lucky != 51 && $lucky != 52 && $lucky != 58)
{
db_query("
INSERT INTO 
{$db_prefix}shop_inventory
(ownerid, itemid, amtpaid)
VALUES (
{$ID_MEMBER},
{$lucky},
0)"
, __FILE____LINE__);

$request db_query("
SELECT name
FROM 
{$db_prefix}shop_items   
WHERE id = 
$lucky   
LIMIT 1"
__FILE____LINE__);
list ($item) = mysql_fetch_row($request);
mysql_free_result($request);

$msg2 '' .($msg). ' ' .($you). ' killed ' .($them). '! Congratulations, ' .($you). '! You got ' .($Exp2). ' EXP, and an item dropped! You recieved 1 ' .($item). '!';
}
else
{
$msg2 '' .($msg). ' ' .($you). ' killed ' .($them). '! Congratulations, ' .($you). '! You got ' .($Exp2). ' EXP!';
}
$msgOptions = array(
'id' => 0,
'subject' => 'Physical Attack!',
'body' => $msg2,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
);
$topicOptions = array(
'id' => $attacked_topic,
'board' => $attacked_board,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 42,
'update_post_count' => 1,
);
}
//If they're still alive...
Else
{
$msgOptions = array(
'id' => 0,
'subject' => 'Physical Attack!',
'body' => $msg,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
);
$topicOptions = array(
'id' => $attacked_topic,
'board' => $attacked_board,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 42,
'update_post_count' => 1,
);
}

require_once($sourcedir '/Subs-Post.php');
createPost($msgOptions$topicOptions$posterOptions);

redirectexit('topic=' $attacked_topic);
}



//Same as Physical, except for the reducing MP and checking MP parts.
function Magical()
{
global $db_prefix$sourcedir$ID_MEMBER;

$attacked_id = !empty($_REQUEST['attacked']) ? (int) $_REQUEST['attacked'] : 0;
$attacked_topic = !empty($_REQUEST['arena']) ? (int) $_REQUEST['arena'] : 0;
$attacked_board = !empty($_REQUEST['country']) ? (int) $_REQUEST['country'] : 0;

$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP5'
&& ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($A) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP6'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($D) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT value
FROM 
{$db_prefix}themes
WHERE variable = 'CP7'
&& ID_MEMBER = 
$ID_MEMBER
LIMIT 1"
__FILE____LINE__);
list ($S) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP8'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($R) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP9'
&& ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($HP) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP9'
&& ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($youHP) = mysql_fetch_row($request);
mysql_free_result($request);

//Get the attacker's MP Value.
$request db_query("
SELECT value
FROM 
{$db_prefix}themes   
WHERE variable = 'CP10'
&& ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($MP) = mysql_fetch_row($request);
mysql_free_result($request);

$request db_query("
SELECT realname
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$ID_MEMBER   
LIMIT 1"
__FILE____LINE__);
list ($you) = mysql_fetch_row($request);
mysql_free_result($request);


$request db_query("
SELECT realname
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($them) = mysql_fetch_row($request);
mysql_free_result($request);

$N1 mt_rand(110);
$N2 mt_rand(110);
$A1 $N1 $S;
$A2 $A1 $A;
$D1 $N2 $R;
$D2 $D1 $D;
$MP2 $MP $A $MP $A 0

if(empty($A))
 
{
fatal_error('You have no Magic attack value! Did you really think you could win by attacking for 0?'false);
$HP2 0;
}

//No Mp? No attack.
elseif ($MP $A)
{
fatal_error('You do not have enough MP! Magic attacks are not free, you know.'false);
$HP2 0;
}
elseif($attacked_id == $ID_MEMBER)
 
{
fatal_error('You cannot attack yourself!'false);
$HP2 0;
}

elseif(empty($HP))
{
fatal_error('You cannot attack a dead person!'false);
$HP2 0;
}
elseif(empty($youHP))
{
fatal_error('You cannot attack someone if you are dead!'false);
$HP2 0;
}
//Are you beating the Ref?
elseif($attacked_id == 42)
{
fatal_error('You cannot attack the Referee!'false);
$HP2 0;
}
elseif ($A1 $D2)
{
$damage $A $A;
$HP2 $HP $damage $HP $damage 0;
$msg '' .($you). ' blasted ' .($them). ' for ' .($damage). ' damage!';
}
elseif ($A2 $D2)
{
$HP2 $HP $A $HP $A 0;
$msg '' .($you). ' attacked ' .($them). ' using Magic for ' .($A). ' damage!';
}
elseif ($A2 <= $D1)
{
$msg '' .($them). ' dodged a Magic attack from ' .($you). ' and took no damage!';
}
elseif ($A2 <= $D2)
{
$DA $A $D $A $D 0;
$damage $DA 1;
$HP2 $HP $damage $HP $damage 0;
$msg '' .($them). ' blocked a Magic attack from ' .($you). ', taking only ' .($damage). ' damage!';
}


db_query("
UPDATE 
{$db_prefix}themes
SET value = 
{$HP2}
WHERE variable = 'CP9' && ID_MEMBER = 
{$attacked_id}"__FILE____LINE__);

//Pay for the spell.
db_query("
UPDATE 
{$db_prefix}themes
SET value = 
{$MP2}
WHERE variable = 'CP10' && ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);

//Did you Kill them?
if (empty($HP2))
{
//Get their EXP.
$request db_query("
SELECT posts
FROM 
{$db_prefix}members   
WHERE ID_MEMBER = 
$attacked_id   
LIMIT 1"
__FILE____LINE__);
list ($Exp) = mysql_fetch_row($request);
mysql_free_result($request);

$Exp2 $Exp/10;

round($Exp2);

//Give the winner some EXP.
db_query("
UPDATE 
{$db_prefix}members
SET posts = posts + 
{$Exp2}
WHERE ID_MEMBER = 
{$ID_MEMBER}"__FILE____LINE__);

//Did they recieve a Random Item drop?
$lucky mt_rand(30,80);
if($lucky 40 && $lucky 60 && $lucky != 49 && $lucky != 51 && $lucky != 52 && $lucky != 58)
{
db_query("
INSERT INTO 
{$db_prefix}shop_inventory
(ownerid, itemid, amtpaid)
VALUES (
{$ID_MEMBER},
{$lucky},
0)"
, __FILE____LINE__);

$request db_query("
SELECT name
FROM 
{$db_prefix}shop_items   
WHERE id = 
$lucky   
LIMIT 1"
__FILE____LINE__);
list ($item) = mysql_fetch_row($request);
mysql_free_result($request);

$msg2 '' .($msg). ' ' .($you). ' killed ' .($them). '! Congratulations, ' .($you). '! You got ' .($Exp2). ' EXP, and an item dropped! You recieved 1 ' .($item). '!';
}

else
{
$msg2 '' .($msg). ' ' .($you). ' killed ' .($them). '! Congratulations, ' .($you). '! You got ' .($Exp2). ' EXP!';
}
$msgOptions = array(
'id' => 0,
'subject' => 'Physical Attack!',
'body' => $msg2,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
);
$topicOptions = array(
'id' => $attacked_topic,
'board' => $attacked_board,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 42,
'update_post_count' => 1,
);
}
Else
{
$msgOptions = array(
'id' => 0,
'subject' => 'Physical Attack!',
'body' => $msg,
'icon' => 'xx',
'smileys_enabled' => 1,
'attachments' => array(),
);
$topicOptions = array(
'id' => $attacked_topic,
'board' => $attacked_board,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => 42,
'update_post_count' => 1,
);
}

require_once($sourcedir '/Subs-Post.php');
createPost($msgOptions$topicOptions$posterOptions);

redirectexit('topic=' $attacked_topic);
}

?>

Everything works fine, except one of my members gets an error when he tries to attack me:

Database Error
Please try again. If you come back to this error screen, report the error to an administrator.

I have no idea why though, other people can attack me and they can all attack each other. Any ideas?

Also, SiNaN, I'm not exactly sure how to make this into one function  :P sorry I'm not that good at this.

Also, the Round function isn't working for some reason.
« Last Edit: October 01, 2008, 12:54:45 PM by Daisuke_aurora »

Offline [SiNaN]

  • SMF Super Hero
  • *******
  • Posts: 11,526
  • Young and Foolish
    • SimplePortal
Re: Stat Battle Mod
« Reply #56 on: October 01, 2008, 07:12:09 PM »
Add this line to your Settings.php:

$db_show_debug = true;

Then you will be able to see the whole query causing error on the error page.

When you complete it, I can make it doing them with one function for you.

Instead of just round($var); you should make $var = round($var); to make it rounded.
Former SMF Core Developer | My Mods | SimplePortal

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #57 on: October 02, 2008, 08:36:13 AM »
Thanks a bunch, SiNaN. It'll probably take me about a week to finish it though (I'm adding weapons and stat effects, spells, etc. stuff like that. It's all going to be "if" codes that check for the status effect / weapon and then carry out whatever the stat effect / weapon does.)

I'll post again if I need more help or when it's done.

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #58 on: October 02, 2008, 12:36:49 PM »
Ok, my letters got big again. I tried changing the names of the buttons, and they got huge and my avatar pic is now an x. I changed them back, but somethign must be wrong, as it isn't fixed... Attached the 2 files I edited, any idea why it got messed up?

Offline Daisuke_aurora

  • Jr. Member
  • **
  • Posts: 168
  • Gender: Male
  • Move like water, to wash your opponents away...
    • Daisuke's Dojo
Re: Stat Battle Mod
« Reply #59 on: October 02, 2008, 02:31:12 PM »
Also I can't log in... no one can... strange...?

Edit: Also, I get these errors at the top of the page:

Code: [Select]
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Load.php on line 1981

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Load.php on line 1981

Warning: Cannot modify header information - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Load.php on line 1985

Warning: Cannot modify header information - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Subs.php on line 3365

Warning: Cannot modify header information - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Subs.php on line 3366

Warning: Cannot modify header information - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Subs.php on line 3372

Warning: Cannot modify header information - headers already sent by (output started at /home/daisuke/public_html/forum/index.php:3) in /home/daisuke/public_html/forum/Sources/Subs.php on line 3375
« Last Edit: October 02, 2008, 02:47:01 PM by Daisuke_aurora »