
dnenb
Members-
Posts
325 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Events
Everything posted by dnenb
-
Bumping this. I ended up coding a simple one-click attack-system after posting this in april, but my players want something more advanced. I could code it myself, but being lazy it would be easier to buy (tried and tested) code from someone. Shoot me a PM!
-
Awesome:) Changes done and first post updated.
-
Currently working on adding functionality so that you can say that a certain course must be completed before you can start another one. Example: You gotta finish "basic computer course" before you can start "intermediate computer course". I'll update the first post with everything once I'm done.
-
That's a good idea! I've implemented it. Original post updated.
-
Gives the players somehting to do:) Thanks!
-
Hey guys, This mod is based on illusions idea from here. I ran into a lot of problems installing that to my game, so I took the idea and wrote something similar. How it works This is almost the same as the education that comes with v2, only that the players has to performs "clicks" in order to finish courses. When you add a course you can say that it takes 42 clicks to finish that course. 1 click costs 1 brave (thanks !Angel for the suggestion). Then the player has to click a link that says "click here to study" 42 times in order to finish the course. Limits are set on how many clicks the player can perform for this course per hour and per day. This makes education something more than just "click start course and wait until it's done". Also, if you set a course id in the "mustBeTakenBefore"-field, then that course must be taken before starting this new one. Example: You can set it so that a "basic computer course" must be taken before an "advanced computer course". Screnshots [ATTACH=CONFIG]1236[/ATTACH] [ATTACH=CONFIG]1237[/ATTACH] [ATTACH=CONFIG]1238[/ATTACH] [ATTACH=CONFIG]1239[/ATTACH] Installing 1. Add the tables and fields: CREATE TABLE IF NOT EXISTS `education_courses` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '', `description` text NOT NULL, `mustBeTakenBefore` tinyint(1) NOT NULL DEFAULT '-1', `clicks_needed_total` int(11) NOT NULL DEFAULT '0', `clicks_max_hourly` int(11) NOT NULL DEFAULT '0', `clicks_max_daily` int(11) NOT NULL DEFAULT '0', `cost_money` int(11) NOT NULL DEFAULT '0', `award_STR` decimal(65,4) NOT NULL DEFAULT '0.0000', `award_GUARD` decimal(65,4) NOT NULL DEFAULT '0.0000', `award_LABOUR` decimal(65,4) NOT NULL DEFAULT '0.0000', `award_AGIL` decimal(65,4) NOT NULL DEFAULT '0.0000', `award_IQ` decimal(65,6) NOT NULL DEFAULT '0.000000', PRIMARY KEY (`ID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE IF NOT EXISTS `education_coursesdone` ( `userid` int(11) NOT NULL DEFAULT '0', `courseid` int(11) NOT NULL DEFAULT '0', `crtimes` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`userid`,`courseid`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `users` ADD `course_clicks_left` int(11) NOT NULL DEFAULT 0; ALTER TABLE `users` ADD `course_daily_clicks` int(11) NOT NULL DEFAULT 0; ALTER TABLE `users` ADD `course_hourly_clicks` int(11) NOT NULL DEFAULT 0; 2. Create a new file called "schooling.php": <?php include "../globals.php"; print "<h2>Education</h2>"; if($ir['course'] > 0) //is player taking a course right now? { $q = $db->query("SELECT * FROM `education_courses` WHERE `ID` = {$ir['course']}"); $r = $db->fetch_row($q); if($_GET['study'] && $ir['course_clicks_left']>0) //if user has clicked "click here to study" and still has clicks left in this course { if($ir['course_daily_clicks']>=$r['clicks_max_daily']) //finished with the daily clicks { echo "You've done as many clicks as you can today. Come back and continue studying tomorrow.<br><br>"; } else if($ir['course_hourly_clicks']>=$r['clicks_max_hourly']) //finished with the hourly clicks { echo "You've done as many clicks as you can this hour. Come back and continue studying in an hour.<br><br>"; } else if($ir['brave']<1) //doesn't have brave to perform the click { echo "You need 1 brave to perform a click.<br><br>"; } else { echo "Nice going! You've completed a click for this course.<br><br>"; $db->query(" UPDATE `users` SET `brave`=`brave`-1, `course_clicks_left`=`course_clicks_left`-1, `course_daily_clicks`=`course_daily_clicks`+1, `course_hourly_clicks`=`course_hourly_clicks`+1 WHERE `userid` = {$ir['userid']} "); $ir['course_clicks_left'] -= 1; } } if($ir['course_clicks_left']<=0) //finished with the course? { //update user course info $db->query(" UPDATE `users` SET `course_clicks_left` = '0', `course` = '0' WHERE `userid` = '{$ir['userid']}' "); //update the amount of times user has done the course $db->query(" INSERT INTO `education_coursesdone` VALUES ('{$ir['userid']}',{$ir['course']},1) ON DUPLICATE KEY UPDATE `crtimes`=`crtimes`+1 "); //update user stats $db->query(" UPDATE `userstats` SET `strength` = `strength` + '{$r['award_STR']}', `agility` = `agility` + '{$r['award_AGIL']}', `guard` = `guard` + '{$r['award_GUARD']}', `labour` = `labour` + '{$r['award_LABOUR']}', `IQ` = `IQ` + '{$r['award_IQ']}' WHERE `userid` = {$ir['userid']} "); //all db updates done. now display messages to user echo " Congratulations, you've completed {$r['name']}!<br><br> You've gained {$r['award_STR']} strength, {$r['award_GUARD']} guard, {$r['award_LABOUR']} labour, {$r['award_AGIL']} agility and {$r['award_IQ']} IQ for completing this course. "; echo "<br><br>> <a href='schooling.php'>Go back</a>"; } else { //display info about the course the user is currently taking: echo 'Welcome to the education center! You\'re currently enrolled in the following course:<br> <table width="100%"> <tr> <th>Course</th> <th>Cost</th> </tr> <tr> <td>'.$r['name'].'</td> <td>$'.$r['cost_money'].'</td> </tr> <tr> <th colspan="2">Description</th> </tr> <tr> <td colspan="2">'.$r['description'].'</td> </tr> <tr> <th>Clicks needed total</th> <th>Clicks left</td> </tr> <tr> <td>'.$r['clicks_needed_total'].'</td> <td>'.$ir['course_clicks_left'].'</font></td> </tr> <tr> <th colspan="2">Study</th> <tr> <td colspan="2"><a href="schooling.php?study=yes">Click here to study!</a></td> </tr> </table> '; } } else { if($_GET['courseID']) { $_GET['courseID'] = abs((int) $_GET['courseID']); $q = $db->query("SELECT * FROM `education_courses` WHERE `ID`={$_GET['courseID']}"); if($db->num_rows($q) == 0) { echo "You are trying to start a non-existant course!"; } else { $r = $db->fetch_row($q); $canTakeCourse = true; if ($r['mustBeTakenBefore']!=-1) //is there another course that must be done before this one? { //check if the user has done that course $q3 = $db->query("SELECT * FROM `education_coursesdone` WHERE `userid` = ".$ir['userid']." AND `courseid` = {$r['mustBeTakenBefore']}"); if ($db->num_rows($q3)==0) $canTakeCourse = false; } if($ir['money'] < $r['cost_money']) { echo "You don't have enough money to start this course."; echo "> <a href='schooling.php'>Go back</a>"; } else if(!$canTakeCourse) { //the user should never see this message, because the link to take the course isn't displayed if it can't be taken. but the user might be clever and edit the link to try other courseid's. echo "You have to complete another course before you can start this."; echo "> <a href='schooling.php'>Go back</a>"; } else { $db->query(" UPDATE `users` SET `course` = {$_GET['courseID']}, `course_clicks_left` = {$r['clicks_needed_total']}, `money` = `money`-{$r['cost_money']} WHERE `userid` = {$ir['userid']} "); echo "You have started the {$r['name']} course!<br>> <a href='schooling.php'>Go back</a>"; } } } else { echo "Welcome to the education center! Here you can see the list of available courses. Pick one that looks interesting and get to it. There are various rewards for completing courses, which you'll see when you finish a course."; $q = $db->query("SELECT * FROM `education_courses`"); echo " <table width='100%'> <tr> <th width='60%'>Course</th> <th>Cost</th> <th>Take</th> </tr>"; while($r = $db->fetch_row($q)) { $canTakeCourse = true; if ($r['mustBeTakenBefore']!=-1) //is there another course that must be done before this one? { //check if the user has done that course $q3 = $db->query("SELECT * FROM `education_coursesdone` WHERE `userid` = ".$ir['userid']." AND `courseid` = {$r['mustBeTakenBefore']}"); if ($db->num_rows($q3)==0) $canTakeCourse = false; } if($canTakeCourse) { $q2 = $db->query("SELECT * FROM `education_coursesdone` WHERE `userid` = ".$ir['userid']." AND `courseid` = {$r['ID']}"); if($db->num_rows($q2)) { $do = "<a href='schooling.php?courseID={$r['ID']}'>Take Again</a>"; } else { $do = "<a href='schooling.php?courseID={$r['ID']}'>Take</a>"; } echo " <tr> <td><span style='font-weight:bold;'>{$r['name']}</span><br>{$r['description']}</td> <td>\${$r['cost_money']}</td> <td>$do</td> </tr> "; } } echo " </table> "; } } $h->endpage(); 3. Edit cron_hour.php and add this: $db->query("UPDATE `users` SET `course_hourly_clicks`=0"); 4. Edit cron_day.php and add this: $db->query("UPDATE `users` SET `course_daily_clicks`=0"); 5. Add a link to schooling.php from explore or wherever. And that's it! This is the first code I give out here I think, so please give me some feedback. I didn't make a staff panel, since I just use phpmyadmin myself.
-
I'd say that's an assumption you shouldn't make, even after seeing it with a few testers. I've been surprised a few times seeing what kind of people actually play my games. It might take you a while to get this working in other browsers. In the meantime you might want to add some screenshots and maybe a video to show non-firefox-users so that you up the chances of them downloading it.
-
You think it's easy, but as soon as a potential player sees that you can only play if you use firefox he's out the door. I bet a minimum of 9 out of 10 potential players who are not already firefox-users will think that. As game owners we gotta make the signup-process as easy as we can in order to get players.
-
Looks impressive from your post, but as I don't have Firefox I won't be able to try. What is it that limits you to Firefox?
-
mccode-v2 [EDUCATION MOD] Totally Re-worked with many additional Options.
dnenb replied to Uridium's topic in Free Modifications
Working on implementing this into my game. I really like the idea, but the code is very messy. I'll post what I end up with here when done. Edit: I rewrote the whole thing. Get it here. -
Another +1 for Google Drive :)
-
No. Paypal would call your script (just as you would go to a website in your browser) and send some information with it. Your script will then process the information, verify that it's coming from paypal, check the status and credit the correct player.
-
Does MWG have an IRC channel somewhere? If not, I think there should be! I'm on IRC whenever I'm on on eof my computers.
-
I'm getting close to no signups from topsites or friends refering. I've tried advertising a little with gameadvertisingonline and it works ok, but I don't have a budget so that I can really learn how to do it. My lesson learned so far is: Do your best to actually keep the few new registrations you get.
-
A little update. Got a character designed for my game and updated the gplay icons - seems to have worked well! Almost at 70 players online last week:) I'd still like to get that number higher, though.
-
Do you know anything about the function? Does it take and produce only integers? As bertrand said you could easily use matlab or an equivalent package to fit a function to the data: [ATTACH=CONFIG]1233[/ATTACH]
-
Hey, looks like you've turned off private messages here? I can't PM you - can you PM me?
-
No longer looking for an advertising partner. Thread can be closed or deleted :) Thanks.
-
I'm happy with HostWinds. Take a look: http://www.hostwinds.com/premium.php
-
Can you say what you've changed?
-
Just added this to my live game - so far so good :) Thanks for all the help!
-
Thanks for the help. The mistake I had earlier in imadd.php was fixed when I edited the query to this: $selectItem = $db->query("SELECT `inv_borrowed` FROM `inventory` WHERE `inv_id` = ".$_GET['ID']." AND `inv_userid` = ".$ir['userid']); Also, in your last addition with gang_staff_armoury_leader_take_item() you might wanna say `items` as `i` in the query.
-
It was absolutely amazing! I'm so bummed out that Matt Smith is leaving, yet so psyched that Peter Capaldi is coming. Can't wait for more!
-
I have this in my games, and I let players buy credits or complete various tasks to get them. Works pretty well :)
-
Will is never 0 and level is never 0. Also, n is not the number of attempts. It's just a decimal number <=1. But thanks:)