DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • February 23, 2018, 08:20:33 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: The Desert - Question  (Read 281 times)
0 Members and 1 Guest are viewing this topic.
TGTarheel
Codemeister
****
Offline Offline

Posts: 296


View Profile
« on: January 29, 2018, 03:37:24 PM »

OK, so, I have my test server set up and working.

I have been fooling around with The Desert module.  I notice that when I am fighting creatures in the desert...the creaturelose message does not correspond to the creature I was fighting...it just seems to pull a creaturelose message at random.

I am guessing this is because it is pulling a special array of creatures that you could fight, and no others.  But...valhalla does this same thing.  Although valhalla creates a string for the badguy, whereas desert seems to handle this a different way.

The desert appears to hand off the creature to the normal /lib/fightnav - while valhall's fighting is contained within the valhalla module.

Now, with regular forest fights...the correct creaturelose message comes up.  But, in The Desert...it seems to pick one at random.

So, I have tried fiddling around, and I can't get where I need to get to.

This is the best I have managed so far...

I added this line in The Desert
Code:
$args['creaturelose'] = $row['creaturelose'];

right below
Code:
case "creatureencounter":
if ($session['user']['location'] == get_module_setting("location")) {
$creatures = db_prefix("creatures");
$module_objprefs = db_prefix("module_objprefs");
$sql = "SELECT c.creaturename AS creaturename, c.creatureweapon AS creatureweapon
FROM $creatures AS c
INNER JOIN $module_objprefs AS mo ON mo.objid = c.creatureid
WHERE mo.objtype='creatures'
AND mo.modulename='desert'
AND mo.setting='desertcreature'
AND mo.value=1
AND c.creaturelevel = {$args['creaturelevel']}
ORDER BY rand(".e_rand().")
LIMIT 1";
$result = db_query($sql);
if (db_num_rows($result)) {
$row = db_fetch_assoc($result);
$args['creaturename'] = $row['creaturename'];
$args['creatureweapon'] = $row['creatureweapon'];
$args['creaturehealth'] = round($args['creaturehealth'] * (0.1 + get_module_setting("expbonus")));
$args['creatureattack'] = round($args['creatureattack'] * (0.1 + get_module_setting("expbonus")));
$args['creaturedefense'] = round($args['creaturedefense'] * (0.1 + get_module_setting("expbonus")));

What THIS produces now...is NO creaturelose message at all...when fighting in the Desert...and still the correct creaturelose message in regular forest fighting...which is better than where I was at.  And if I gotta live with that, then fine.

But...is there a way to make it carry this info through to the /lib/forestoutcomes.php file...so that a correct creaturelose message will appear?

I'm sorta out of ideas.

P.S. this is where it is fetching the creaturelose message in forestoutcomes.php
Code:
if(isset($badguy['creaturelose'])) $msg = translate_inline($badguy['creaturelose']);
tlschema();

P.S.2 - if it helps...the correct creature name is shown as having been slain...even when the wrong creaturelose message shows up.
So maybe there is a way in forestoutcomes.php to fetch the correct line and set it?
« Last Edit: January 29, 2018, 05:03:57 PM by TGTarheel » Logged
Anharat
Codemeister
****
Offline Offline

Posts: 270



View Profile WWW
« Reply #1 on: January 30, 2018, 10:21:17 AM »

Just one thing, if you use
Code:
<?php
$args
['creaturelose'] = $row['creaturelose'];
you should select that field from the DB as well, which you do not in the code you posted.
Logged

TGTarheel
Codemeister
****
Offline Offline

Posts: 296


View Profile
« Reply #2 on: January 30, 2018, 11:43:34 AM »

Just one thing, if you use
Code:
<?php
$args
['creaturelose'] = $row['creaturelose'];
you should select that field from the DB as well, which you do not in the code you posted.

Oy vey!!  Of course you are right there, but I am cross-eyed from staring at code and trying different things for hours.

Let me plug that in!
Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 296


View Profile
« Reply #3 on: January 30, 2018, 11:58:55 AM »

Just one thing, if you use
Code:
<?php
$args
['creaturelose'] = $row['creaturelose'];
you should select that field from the DB as well, which you do not in the code you posted.

By Jove, you done it!!  Thank you tons and tons!!
You pointed me in the right direction and I plugged it in and it worked.

Sincerely huge thanks!

here is the new line
Code:
$sql = "SELECT c.creaturename AS creaturename, c.creatureweapon AS creatureweapon, c.creaturelose AS creaturelose
FROM $creatures AS c
INNER JOIN $module_objprefs AS mo ON mo.objid = c.creatureid
WHERE mo.objtype='creatures'
AND mo.modulename='desert'
AND mo.setting='desertcreature'
AND mo.value=1
AND c.creaturelevel = {$args['creaturelevel']}
ORDER BY rand(".e_rand().")
LIMIT 1";
Logged
TGTarheel
Codemeister
****
Offline Offline

Posts: 296


View Profile
« Reply #4 on: February 07, 2018, 08:54:28 AM »

OK....I am still playing around with The Desert...and many thanks for the solve of the problem I had.

But I am wondering....as it is currently written, all special forest events are blocked...using the following code
Code:
case "collect-events":
if ($session['user']['location'] == get_module_setting("location")) {
foreach($args as $index => $event) {
$event['rawchance'] = 0;
$events[$index] = $event;
}
$args = $events;
}
break;

Is there a way to write this differently....so that only SOME events are blocked and not all events?

I am totally curious.

I understand that the events, when they end, point you back to "forest.php" - which, likely, is why the author blocked the events.

But, in playing around a bit...I managed to make the Flying Healer show up in the Desert...and navigate you back to The Desert.

So...each event you WANTED to show up in The Desert, obviously...would have to have the same thing...a way to navigate back to The Desert instead of The Forest.

So...would there be a way to block only SOME events, and not all events?

Just interested in further developing the potential of this module, because a tougher fighting area is actually a lot of fun.  But would be nice if some events could also occur.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

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