Jump to content
MakeWebGames

Recommended Posts

Posted

i would like a few mods to be made also there are afew quiestions at the end of the mods i want

1 just like the male and female theres another option for NPC's called animals done thanks to tonk and MTG

2 an mod so that NPC's can attack without someone having to log into there user(would this be hard to make?)

i would like an offer for both mods and/or separate please

Posted

Re: a couple of mods

These two are good ideas, for the animals try this query. All credit to Magictallguy he gave me them

 

ALTER TABLE `users` DROP `gender`;
ATLER TABLE `users` ADD `gender` ENUM('Male', 'Female', 'Animal') NOT NULL DEFAULT 'Male';
Posted

Re: a couple of mods

try the five minute cron. you might wanna add something like:

$db->query("ALTER TABLE users SET hospital=15 WHERE userid=$random");

$db->query("ALTER TABLE users SET hospreason=Hospitalized by $bot")

$bot and $random don't exist so you'll have to sort that out, i'll have a go if i get the chance. i don't think both them query's will work becoz the $random and $bot would change in each query and i'm not that good with SQL so i don't know how to put them together :?

Posted

Re: a couple of mods

This will automate the NPC's and get them to attack random members, the NPC's will jump to the city of the random member then attack them....

you may need to change the exp given i have exp caps in my game so edit it to suit your game...

 

add this to whichever cron you want mine is in a new cron which runs every 20 mins you could add it to 5min cron or hour cron etc

 

 

// start attack code



function eve_add($userid,$text,$connection=0)
{
global $db;
$text=mysql_esca($text);
$db->query("INSERT INTO events VALUES('',$userid,UNIX_TIMESTAMP(),0,'$text')");
$db->query("UPDATE users SET new_events=new_events+1 WHERE userid={$userid}");
return 1;
}
function mysql_esca($str)
{
return str_replace("'","''",$str);
}




$q=$db->query("SELECT * FROM users where user_level = 0 and hospital =0 limit 20");

while($r=$db->fetch_row($q))

{

$s=$db->query("SELECT * FROM users where user_level > 0 and hospital =0 and jail =0 order by rand() limit 1");
$p=$db->fetch_row($s);
$numb=$db->num_rows($s);

if ($numb > 0)
{
$db->query("UPDATE users SET location={$p['location']} WHERE userid={$r['userid']}");

$t=$db->query("SELECT * FROM userstats where userid={$r['userid']}");
$v=$db->fetch_row($t);

$bot=($v['strength'] + $v['guard'] + $v['agility']);

$x=$db->query("SELECT * FROM userstats where userid={$p['userid']}");
$w=$db->fetch_row($x);

$memb=($w['strength'] + $w['guard'] + $w['agility']);


if ($bot > $memb)
{
$qe=abs((($p['level']-$r['level'])*100) + 100);
if ($qe > 10000)
{
$qe = 10000;
}
if ($qe < 0)
{
$qe = 1;
}
if ($p['level'] < $r['level'])
{
$qe = 1;
}


$db->query("UPDATE users SET exp=exp+$qe WHERE userid={$r['userid']}");
$hosptime=20;
$db->query("UPDATE users SET hp=1,hospital=$hosptime,hospreason='Hospitalized by <a href=\'viewuser.php?u={$r['userid']}\'>{$r['username']}</a>' WHERE userid={$p['userid']}");
eve_add($p['userid'],"[url='viewuser.php?u={$r[']{$r['username']}[/url] beat you up. They gained $qe",$c);
}

else
{

$qe=abs((($p['level']-$r['level'])*100) + 100);

if ($qe > 10000)
{
$qe = 10000;
}
if ($qe < 0)
{
$qe = 1;
}
if ($p['level'] < $r['level'])
{
$qe = 1;
}



$db->query("UPDATE users SET exp=exp+$qe WHERE userid={$p['userid']}");


$db->query("UPDATE users SET exp=0 WHERE exp < 0");
eve_add($p['userid'],"[url='viewuser.php?u={$r[']{$r['username']}[/url] attacked you and lost. You gained $qe",$c);


}
}

}


Posted

Re: a couple of mods

this code again added into a cron will make the npc's train their stats...

 

// start training code
$q=$db->query("SELECT * FROM users where user_level = 0 and hospital = 0 limit 20");

while($r=$db->fetch_row($q))
{
$gain=0;
   for($i=0; $i<$r['energy']; $i++)
   {
     $stat+=rand(1,3)/rand(800,1000)*rand(800,1000)*(($r['will']+20)/150);

   }



$statgain=rand(1,3);

if ($statgain == 1)
{
$db->query("update userstats set strength=strength+$stat where userid = {$r['userid']}");

}

else if ($statgain == 2)
{
$db->query("update userstats set guard=guard+$stat where userid = {$r['userid']}");

}

else if ($statgain == 3)
{
$db->query("update userstats set agility=agility+$stat where userid = {$r['userid']}");

}
}

Posted

Re: a couple of mods

again add to cron of your choice... will make the NPC's appear online

 

//fetchs the npc info and makes them appear online



$db->query("UPDATE users SET laston=unix_timestamp() WHERE user_level = 0");
//fetch
Posted

Re: a couple of mods

 

i would like a few mods to be made also there are afew quiestions at the end of the mods i want

1 just like the male and female theres another option for NPC's called animals done thanks to tonk and MTG

2 an mod so that NPC's can attack without someone having to log into there user(would this be hard to make?)

i would like an offer for both mods and/or separate please

tonk? tonk!? is that what i get when trying to help people, i get called tonk!! it's tolk!! lol :lol:

Posted

Re: a couple of mods

ok im not even sure how u would do it but it would be cool if when u mail a npc it sends a random mail bk?

also as u have it so the npcs randomly attack could u have it so if u had a gang of npc's if u declair war on then they will fight bk?

Posted

Re: a couple of mods

 

These two are good ideas, for the animals try this query. All credit to Magictallguy he gave me them

 

ALTER TABLE `users` DROP `gender`;
ATLER TABLE `users` ADD `gender` ENUM('Male', 'Female', 'Animal') NOT NULL DEFAULT 'Male';

 

Lmao, tolk do that it will mess your register page up :)

This is what you do

ALTER TABLE `users` CHANGE `gender` `gender` ENUM( 'Male', 'Female', 'Animal' ) NOT NULL DEFAULT 'Male'

^^ I only done php tags for colors ;)

Posted

Re: a couple of mods

 

ok im not even sure how u would do it but it would be cool if when u mail a npc it sends a random mail bk?

also as u have it so the npcs randomly attack could u have it so if u had a gang of npc's if u declair war on then they will fight bk?

Good idea i know of a code with the mail ill post it soon

  • 1 month later...
Posted

Re: a couple of mods

So just adding these simple codes to Crons will make your NPC's go on the offensive?

And what if you have several NPC's. Will they all attack or just one? "confused"

Posted

Re: a couple of mods

$q=$db->query("SELECT * FROM users where user_level = 0 and hospital =0 limit 20");

 

this line is selecting the npc's if you only want it to select a certain amount change limit 20

Posted

Re: a couple of mods

 

$q=$db->query("SELECT * FROM users where user_level = 0 and hospital =0 limit 20");

 

this line is selecting the npc's if you only want it to select a certain amount change limit 20

$db->query('SELECT `blah`, `blah`, `blah` FROM `users` WHERE ((`user_level` = 0) && (`hospital` = 0)) LIMIT 20');
Posted

Re: a couple of mods

if u change

$q=$db->query("SELECT * FROM users where user_level = 0 and hospital =0 limit 20");

to

$q=$db->query("SELECT * FROM users where userid = 1 and hospital =0 limit 20");

that will make only id 1 attack so u can mako only 1 person attack

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