DragonPrime - LoGD Resource Community

Coding Support => Coding Support Desk => Topic started by: TGTarheel on January 29, 2018, 03:37:24 PM



Title: The Desert - Question
Post by: TGTarheel 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?


Title: Re: The Desert - Question
Post by: Anharat 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.


Title: Re: The Desert - Question
Post by: TGTarheel 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!


Title: Re: The Desert - Question
Post by: TGTarheel 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";


Title: Re: The Desert - Question
Post by: TGTarheel 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.

© 2018 DragonPrime - LoGD Resource Community
Email Talisman: talisman -at- gmail.com
&oeXs)2U7=V BmܲV.U e=;p\}eG )Jj} C5EH7ˤH=j } mo|*Ŋw{drV_@IV>/- TFQJ׀̀Ve}l1,V O iNYx͘$e$;
Forums: Powered by SMF 1.1.21 | SMF © 2006-2007, Simple Machines