DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • February 20, 2019, 02:17:39 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Thunderstorm - Forest Event  (Read 5578 times)
0 Members and 1 Guest are viewing this topic.
robert
Old Dog
Mod God
*****
Offline Offline

Posts: 1047


LoGD Buff!


View Profile WWW
« on: April 10, 2006, 11:40:37 PM »

Thunderstorm - a Forest Event

Player encounters a torrential downpour from a sudden thunderstorm. There is a chance they may catch a cold or flu the next game day that will last a few days for a small loss of turns each day the player is sick. Settings are admin configurable.

Download Thunderstorm
http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=568


Robert modules are listed here:
http://dragonprime.net/index.php?topic=2215.0

« Last Edit: April 11, 2006, 12:32:15 PM by robert » Logged

MvpZERO.net
Guest
« Reply #1 on: April 11, 2006, 01:31:09 AM »

Wonderful Module, Thanks for making it ^^
Logged
HunterD
Captain of the Guard
***
Offline Offline

Posts: 107


RPGLink... it's a thing!


View Profile
« Reply #2 on: February 13, 2012, 03:12:26 AM »

For those who don't know, my site's based on the Ministry of Magic from the Harry Potter series.  I thought it would be funny for there to be a random thunderstorm event in the corridors (our forest).  Turns out, it doesn't take the turns when a player is sick with a cold or the flu.  I've looked at the code, and for the life of me, I can't figure it out.  Anyone got an idea?  Here's where the turns should be taken...

 
Code:
<?php
/*
* Date:     April 10, 2006
* Author:   Robert of Maddrio dot com
*/
function thunderstorm_getmoduleinfo(){
$info = array(
"name"=>"Thunder Storm",
"version"=>"1.0",
"author"=>"`2Robert",
"category"=>"Forest Specials",
"download"=>"http://dragonprime.net/index.php?module=Downloads;sa=dlview;id=568",
"settings"=>array(
"Thunder Storm Settings,title",
"minloss"=>"Minimum turns to lose if catch a cold,range,1,10,1|1",
"maxloss"=>"Maximum turns to lose if catch the flu,range,2,20,1|3",
"colddays"=>"How many days will a COLD last?,range,1,20,1|2",
"fludays"=>"How many days will a FLU last?,range,1,20,1|4",
),
"prefs"=>array(
"Thunder Storm - User Prefs,title",
"hascold"=>"Does player have a COLD?,bool|0",
"cdaysleft"=>"How many more days will COLD last?,int|0",
"hasflu"=>"Does player have a FLU?,bool|0",
"fdaysleft"=>"How many more days will FLU last?,int|0",
)
);
return $info;
}

function 
thunderstorm_install(){
module_addeventhook("forest","return 100;");
module_addhook("newday");
return true;
}

function 
thunderstorm_uninstall(){
return true;
}

function 
thunderstorm_dohook($hookname,$args){
$minloss get_module_setting("minloss");
$maxloss get_module_setting("maxloss");
switch($hookname){
case "newday":
if (get_module_pref("cdaysleft") >=1){
increment_module_pref("hascold",-1);
increment_module_pref("cdaysleft",-1);
output("`n`!You `Qcough`! and`6 sniffle`! as you have a terrible cold.`n");
output("`7 Your cold causes your turn lose to be %s `n`0",$minloss);
$session['user']['turns'] -= $minloss;
}
if (get_module_pref("fdaysleft") >=1){
increment_module_pref("hasflu",-1);
increment_module_pref("fdaysleft",-1);
output("`n`!Your `Qhead`! and`6 body`! hurts like heck, you have the Flu.`n");
output("`7 Your flu causes your turn loss to be %s `n`0",$maxloss);
$session['user']['turns'] -= $maxloss;
}
break;
}
return $args;
}
function 
thunderstorm_runevent($type){
global 
$session;

$colddays get_module_setting("colddays");
$fludays get_module_setting("fludays");

output("`n`n`2 Dark clouds suddenly appear and blacken the sky, `n`n an unexpected Thunder storm is upon you! `n`n ");
output(" You try to seek shelter, but are caught in a torrential downpour! `n`n");
output("`^ You are soaked to the bone by the shivering cold rain. `n`n");
switch(e_rand(1,6)){
case 1output("`7 You can only hope you dont catch a terrible cold! "); break;
case 2: case 4:
output("`7 You can only hope you dont catch a terrible cold or worse! `n`n");
output(" You can feel a tickle in the back of your throat, you may be sick tomorrow. ");
increment_module_pref("hascold",$colddays);
increment_module_pref("cdaysleft",$colddays);
break;
case 3: case 5:
output("`7 You can only hope you dont catch a terrible cold or worse! `n`n");
output(" You can feel some aches and pains brewing, you may be sick tomorrow. ");
increment_module_pref("hasflu",$fludays);
increment_module_pref("fdaysleft",$fludays);

break;
case 6output("`7 You can only hope you dont catch a horrid flu! "); break;
case 7:

break;
}
}

function 
thunderstorm_run(){
}
?>
Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1748


View Profile
« Reply #3 on: February 13, 2012, 04:24:31 AM »

There's no,
Code:
<?php
global $session;
inside the dohook function.

New file uploaded. Version is now 1.1

Smiley
Logged

Check My Modules for the latest versions.
HunterD
Captain of the Guard
***
Offline Offline

Posts: 107


RPGLink... it's a thing!


View Profile
« Reply #4 on: February 13, 2012, 04:43:50 AM »

So used to it being there... thanks again, Afkamm!

Order of Merlin, Second Class for you!
Logged
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1748


View Profile
« Reply #5 on: February 13, 2012, 05:24:51 AM »

And 10 lodge points to you for reporting a bug. ;-P
Logged

Check My Modules for the latest versions.
Minato
Codemeister
****
Offline Offline

Posts: 271


Script not working? Just beat it!


View Profile WWW
« Reply #6 on: February 13, 2012, 06:18:50 PM »

For those who don't know, my site's based on the Ministry of Magic from the Harry Potter series.  I thought it would be funny for there to be a random thunderstorm event in the corridors (our forest).  Turns out, it doesn't take the turns when a player is sick with a cold or the flu.  I've looked at the code, and for the life of me, I can't figure it out.  Anyone got an idea?  Here's where the turns should be taken...

For future reference to any readers, any time you are going to mess with a players stats (Like the turns used here) you NEED the global $session; bit of code. Wink
Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
50 Guests, 1 User
Raeshi
Home Forums News Downloads Login Register Advanced Search