DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • April 27, 2018, 01:50:46 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: limited flawless rewards  (Read 5897 times)
0 Members and 1 Guest are viewing this topic.
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« on: May 12, 2005, 07:54:04 AM »

on my .9.7 server, i limited the number of flawless fights a user could get to 5 a newday.  There are no hooks in 9.8 around the area i need...lookinging at ~line 48 in lib/forestoutcomes.php  and you can't use header or footer since it's all in a function.. is it possible to limit flawless fights with a module here?
Logged

Talisman
Administrator
Mod God
*****
Offline Offline

Posts: 5479



View Profile WWW
« Reply #1 on: May 12, 2005, 09:34:05 AM »

Try adjusting the likelihood of Flawless in game settings...
Logged

Play the latest beta version here on DragonPrime
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #2 on: May 12, 2005, 09:39:03 AM »

Sixfoot... you... Grin

I've already finished, what you want... Tongue

*lmao* *roflstc*
Logged

Running for more than three years now:
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #3 on: May 12, 2005, 09:41:45 AM »

Code:
module_addhook("battle-victory");
Code:
if ($args['type'] == "forest" && $args['diddamage'] != 1) { //flawless fight

these are the hints I'll give you... Smiley

Now, you can do whatever you want to do with you player having to many flawless fights...

Logged

Running for more than three years now:
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #4 on: May 13, 2005, 05:28:12 AM »

muahaha... got your last replay by mail...

use $args instead of $badguy and it should work...
Logged

Running for more than three years now:
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #5 on: May 13, 2005, 05:28:22 AM »

ha, ok, i thought i had it there, but i didnt.

It has to be $denyflawless right?  i can't figure out how i am to pass that through the forestvictory() call (line 196 forest.php)

I tried setting $args[diddamage]=1, but that didnt work either.

attached what i have so far.
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #6 on: May 13, 2005, 05:29:16 AM »

Quote
muahaha... got your last replay by mail...

use $args instead of $badguy and it should work...


hehe, that is what i caught just after making the post, so i deleted it.  but it still doesnt work...
« Last Edit: May 13, 2005, 05:30:01 AM by sixf00t4 » Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #7 on: May 13, 2005, 05:32:15 AM »

line 280, battle.php
Code:
if ($victory) modulehook("battle-victory",$badguy);
sh**... You could pass you whole family via $args, the script wouldn't care...
Logged

Running for more than three years now:
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #8 on: May 13, 2005, 05:32:48 AM »

i was thinking that setting diddamage to 1 was the wrong way to do it since they really didnt do any damage, and should still get the ~~Flawless Fight!~~ message.  Which, i can just recreate, but wasn't sure what the $denyflawless variable would be used for then.
Logged

sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #9 on: May 13, 2005, 05:36:03 AM »

line 280, battle.php
Code:
if ($victory) modulehook("battle-victory",$badguy);
sh**... You could pass you whole family via $args, the script wouldn't care...


heh, i tried the whole thing with $badguy instead of $args, and it still didnt return diddamage as 1...
Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #10 on: May 13, 2005, 05:36:57 AM »

You could do two things:

Change line 280/281 of battle.php from
Code:
  if ($victory) modulehook("battle-victory",$badguy);
   if ($defeat) modulehook("battle-defeat",$badguy);

to
Code:
if ($victory) $badguy = modulehook("battle-victory",$badguy);
if ($defeat) $badguy = modulehook("battle-defeat",$badguy);

or simply do
Code:
$session['user']['turns']--;

Although the last one will not suppress the flawless victory message...
« Last Edit: May 13, 2005, 05:37:21 AM by XChrisX » Logged

Running for more than three years now:
XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #11 on: May 13, 2005, 05:39:51 AM »

heh, i tried the whole thing with $badguy instead of $args, and it still didnt return diddamage as 1...

In the dohook-part $args is equal to $badguy (it contains the same values). But as the result ($args-array) is not assigned to the $badguy-array your changes won't be applied...
(see my last post for a solution)

Another (third, un-nice) way would be, to use
Code:
global $badguy;
$badguy['diddamage'] = 1;

The best way would be a change in the core for the next release...
Logged

Running for more than three years now:
sixf00t4
Mod God
*****
Offline Offline

Posts: 1916



View Profile WWW
« Reply #12 on: May 13, 2005, 05:52:50 AM »

who's taking bets on Kendaer's approval?  Grin

i can already sense he will say it's the wrong way to do it, because it should be $denyflawless...perhaps he will have someway to use that, and if not, make a way.  PM'ing him now.

Thanks Chris!
Logged

XChrisX
Global Moderator
Mod God
*****
Offline Offline

Posts: 4647

Be aware of the squirrel!


View Profile WWW
« Reply #13 on: May 13, 2005, 05:58:20 AM »

I'd take a bet...

One module on
Code:
if ($victory) $badguy = modulehook("battle-victory",$badguy);
if ($defeat) $badguy = modulehook("battle-defeat",$badguy);

 Grin
Logged

Running for more than three years now:
Kendaer
Guest
« Reply #14 on: May 13, 2005, 07:02:30 AM »

You'd both be right.

The correct answer *is* the $denyflawless setting.  However, you need a way to set it.
At line 50 of lib/forestoutcomes.php add
Code:
if (!$denyflawless && isset($badguy['denyflawless']) && $badguy['denyflawless'])
            $denyflawless = $badguy['denyflawless'];
(this is right above the line which prints 'Flawless fight')

Also, make those changes to battle.php that XChrisX mentioned, to capture the values set in those module hooks.

Now in your module hook for battle victory, you can check diddamage (to see if it IS a flawless fight) and then if the number is more than what you want to allow, set $args['denyflawless'] to the message you want to have output which will cause the denyflawless code to run, so it will report that it's a flawless fight but tell them why they don't get the reward.   Please note that it will NOT use your custom message if the code is already passing in the value for denyflawless on it's own.  (IE, for travel fights, so you will definately want to check the type of the fight in diddamage to make sure it's of type forest (only place you can get flawless fights))
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

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