Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('\2')', to be a valid callback in /nfs/c01/h06/mnt/10927/domains/dragonprime.net/html/Sources/Load.php(225) : runtime-created function on line 3
Discussion: Lost Game
DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • September 20, 2019, 02:33:56 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: Discussion: Lost Game  (Read 14337 times)
0 Members and 1 Guest are viewing this topic.
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« on: December 28, 2009, 11:55:47 PM »

Name: Lost Game
Version: 2.8
Category: Useless Modules Pack (Forest Events)
Submission Thread: HERE

Ok here it is! The latest module for Jack and I's Useless Module Pack! Lost Game! What happens? Well, it simulates you losing the game, most of your stats, mainly the ones that would cause any of you to freak out and start throwing things Tongue but when the event is over with, you get those stats back, plus a random amount of bonus, all admin settable.

So what does it do? Nothing! It's perfect! Well...almost nothing...it will prolly make a couple people flip out, but I assure you, I've thoroughly tested it out and it's quite harmless Smiley
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
robert
Old Dog
Mod God
*****
Offline Offline

Posts: 1047


LoGD Buff!


View Profile WWW
« Reply #1 on: December 29, 2009, 12:40:03 PM »

ROFLMAO  Muwahahaha ...............

Nice job jollygg, it would be funny.

I can only suggest to make it a 'one time only' event that is DK based so everyone who encounters it gets to laugh at the next one who gets it. ....this would mean adding in a news blurb as well.
Logged

JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #2 on: December 29, 2009, 12:54:54 PM »

Hmm, I might be able to do that..
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #3 on: February 24, 2010, 07:56:01 PM »

Question on this, it doesn't appear to be working with 1.1.2, something to do with the function lostgame_chance(), which I have laid out below. Why doens't that work with 1.1.2?

Code:
function lostgame_chance(){
global $session;
if ($session['user']['dragonkills'] < get_module_setting("mindk")) return 0;
return 100;
}
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
KaosKaizer
Mod God
*****
Offline Offline

Posts: 1016


Zeno's Arrow never hits the mark.


View Profile
« Reply #4 on: February 24, 2010, 08:00:25 PM »

I'm not too sure, but try changing:
Code:
return 100;
to
Code:
else return 100;

and see if that fixes it Wink It certainly can't hurt Smiley
Logged

My Mods
I'm not currently a fully active member of DP, though I do respond to most PMs.
Iori
Mod God
*****
Offline Offline

Posts: 832


View Profile WWW
« Reply #5 on: February 24, 2010, 09:33:16 PM »

I'm not too sure, but try changing:
Code:
return 100;
to
Code:
else return 100;

and see if that fixes it Wink It certainly can't hurt Smiley
The else is (correctly) not needed in this case.

More likely this isn't working due to
Code:
get_module_setting("mindk"))
is missing the second argument (namely, the modulename).

However, some more info regarding how it is "not working" would be helpful Smiley

« Last Edit: February 24, 2010, 09:36:38 PM by Iori » Logged

MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1752


View Profile
« Reply #6 on: February 25, 2010, 08:46:10 AM »

Like Iori said, you need to add the module name to the function calls as the code that's executed to work out the chance is done so inside php's eval() function and therefore has no global calls for $mostrecentmodule.

Smiley
Logged

Check My Modules for the latest versions.
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #7 on: March 02, 2010, 04:36:54 PM »

Fatal error: Call to undefined function lostgame_chance() in ****\****\****\html\lib\modules.php(1031) : eval()'d code on line 1


that's what I'm getting. A couple people get it too, but others seem to have no issue..
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #8 on: March 02, 2010, 04:51:55 PM »

So, looking at your Hidden Chest (which I love the commented out bit there...makes me feel special to screw even that up xD), would this be right?

Code:
global $session;
$chance = get_module_setting('chance','lostgame');
if( $session['user']['dragonkills'] < get_module_setting('mindk','lostgame') ) return 0;
elseif( get_module_pref('done','lostgame',$session['user']['acctid']) == 1 ) return 0;
return $chance;
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #9 on: March 02, 2010, 05:19:15 PM »

Ok, here is my module attached with those edits...perhaps someone can find out what is wrong...it's throwing up that error for certain people who try to enter the forest, we know it's not for everyone as there are still people leveling...
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
Boris735
Mod God
*****
Offline Offline

Posts: 570


View Profile
« Reply #10 on: March 02, 2010, 11:33:48 PM »

The issue is with your event hook installation:

Code:
function lostgame_install(){
    module_addeventhook("forest","return lostgame_chance();");
    return true;
}

When the module code selects an event to run, it goes through the array of fragments defining chances and evaluates them.  This is done outside of any context, so when it reaches the fragment for your event here ("return lostgame_chance();") it naturally has no idea where this function is, and correctly tells you that it is not defined.

You need to include the file that defines this function:

Code:
function lostgame_install(){
    module_addeventhook("forest","require_once('modules/lostgame.php'); return lostgame_chance();");
    return true;
}
Logged
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #11 on: March 03, 2010, 04:40:48 PM »

Hmm, ok, thank you, I'll give it a try then Smiley
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #12 on: March 03, 2010, 04:46:38 PM »

* JollyGG dances and throws marshmallows around

Aha! Thank you Boris!!!! Here is the finished version ready to publish Cheesy

And as a request from a friend, it's set to only be done once each DK, with a reset on the DK
« Last Edit: March 03, 2010, 06:17:18 PM by JollyGG » Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
MarcTheSlayer
Mod God
*****
Offline Offline

Posts: 1752


View Profile
« Reply #13 on: September 06, 2010, 07:14:01 AM »

JollyGG, you need to remove the player's buffs at the same time and then give them back.

Reason for this is because you make the player's attack/defence zero, but some buffs use these to calculate the modifer.

Example:
Code:
"atkmod"=>"1+((1+floor(<level>/2))/<attack>)",

Dividing by zero is bad and the player will get a php output message displayed on their screen. Sad

See your last output message,
Code:
output_notl("`n`n`c`\$Now for the next problem! The bill! You decide to make `b`GJolly`@GG`b`\$ pay for it as he is the one to put you through it all...`c");

You should change it to this so that it's translatable. Smiley
Code:
output("`n`n`c`\$Now for the next problem! The bill! You decide to make %s`\$ pay for it as he is the one to put you through it all...`c", '`b`GJolly`@GG`b');

Lines 104 to 115 you set all the prefs to zero, but then you set them again with the player's data. Why set them to zero in the first place? :-/

Also, the pref previousmar isn't used anywhere.

Smiley
Logged

Check My Modules for the latest versions.
JollyGG
Mod God
*****
Offline Offline

Posts: 607


Jolly Good!


View Profile WWW
« Reply #14 on: September 06, 2010, 06:01:24 PM »

Lines 104 to 115 you set all the prefs to zero, but then you set them again with the player's data. Why set them to zero in the first place? :-/

So they think they lost the game? I'll take a look through it tomorrow, gettin ready for bed at the moment...long day >.<
Logged

Senior Staff Coder to: RPGLink
Supporter of: Forbidden Realm and LotGD4Adults2.
Released Modules: Here
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

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