Daily Lucky Numbers:
2
11
21
26
34
47

Battle Mod

Started by Fog, July 10, 2013, 10:14:27 PM

Previous topic - Next topic

Fog

#45
What are you trying to accomplish btw?

QuoteDo you want to be able to attack the tanks no matter what?
Quote

Nope.  We want the choice to turn away.

QuoteDo you not want to be able to attack the tanks when your user level is beyond the range?

Yes.

QuoteDo you not want the tanks to attack you if outside the range?

Nope.

QuoteDo you not want the tanks to appear on the map if the user is outside the given range?

Good question...Yes

QuoteI have never played the game.. do the tanks attack you, vice versa or both?

The tanks can catch you off guard and inflect damage but what we also see is that strong tanks in the upper levels can still catch you off guard. That goes with your one about getting attacked by tanks outside your range.

If you come along a tank that hasn't caught you off guard you have the choice to attack or run.

The idea is to start out with weaker tanks like we saw at the beginning of WWII and over the course of several years(levels) you started to see bigger and better tanks but as you built these bigger tanks the old ones were either destroyed or made into training tanks.

But not have the bigger tanks engage you until you built up your atk and def through leveling up.

Fog

is this the $content part you're looking for?

function template_battle_search() {
global $context, $settings, $scripturl, $txt, $user_info, $modSettings;

echo'

<div class="title_bar">

<h3 class="titlebg"><span>'.$txt['battle_expl'].'</span></h3></div>';



foreach ($context['battle_explore'] as $row) {

if(isset($_GET['open'])) {

$num = mt_rand(1, 2);

if ($num == '1') {

echo'

<div align="center">

'.$row['outcome1'].'<br /> <br />

<form action="' . $scripturl . '?action=battle;sa=explore;home" method="post">

            <input type="submit" value ="'.$txt['battle_back'].'" />

            </form>

<div>';

} elseif ($num == '2') {

echo'

<div align="center">

'.$row['outcome2'].'<br /><br />

<form action="' . $scripturl . '?action=battle;sa=explore;home" method="post">

            <input type="submit" value ="'.$txt['battle_back'].'" />

            </form>

<div>';

}



} else { // battle or explore action that is the question



if (isset($context['isbattle_action'])) { // Explore action

echo '

'.$row['start'].'<br />

              <br />

<div align="center">

            <form action="'. $scripturl . '?action=battle;sa=search;open='.$row['id_explore'].'" method="post">

            <input type="submit" value ="'.$txt['battle_ok'].'" />

</form>

            '.$txt['battle_or'].'<br />

            <form action="' . $scripturl . '?action=battle;sa=explore;home" method="post">

            <input type="submit" value ="'.$txt['battle_no'].'" />

            </form>

</div>';

} else { // Well it is not explore action, it has to be a MONSTER!!

echo'

<div align="center">

'.$txt['battle_you_in_mon'].'<br /><br />

'.$row['name'].' <br /><br /><img name="icon" src="', $settings['images_url'], '/battle/monsters/', $row['img'],'" alt="" /><br />

<img border="0" src="',$settings['images_url'],'/battle/bomb.png" alt="" />'.$txt['battle_atk'].'=', $row['atk'], '&nbsp;',  '&nbsp;', '<img border="0" src="',$settings['images_url'],'/battle/shield.png" alt="" /> '.$txt['battle_def'].'=', $row['def'],'';

if (isset($context['battle']['firstatk'])) { // Well did the monster attack first?

echo '

<br />'.$row['name'].' '.$txt['battle_game_mcog'].' '.$context['battle']['firstatk'].' '.$txt['battle_hist10'].'';

if (isset($context['battle']['firstdead'])) { // I guess they did attack first and killed you.

echo '

'.$txt['battle_game_mcog1'].'',

battle_return();

}

echo '

<br />';

}

Fog

On the DB...should I have both the mon_range  and mon_max_range on INT10?  because it's on VARCHAR 255.

Chen Zhen

Fog,

Quote from: Fog on July 12, 2013, 11:26:16 PM
On the DB...should I have both the mon_range  and mon_max_range on INT10?  because it's on VARCHAR 255.

  Whomever created the db columns for that mod used varchar(255) which is for stings but used those columns for integers. This is ok but it would have been better and more secure if they created & used integer columns ( int(10) ) because it would force the saved data to always be integers. It makes no difference that I instructed you to create an integer column as you can mix the two within a table. I decided to do it proper for the column we added rather than copy what was already in place.

  The logic you previously posted is for when you decide to attack the tank or not. If you still want the option to do that or not to do that then perhaps change it back to how it was previously because that part you want to remain the same. You need to find the logic conditions for the other scenarios I listed to adjust their mysql queries and also the conditional logic that follows.

  Zip the mod in its current state and upload it to Tiny Upload ... then post the download link in this thread.




Fog



Fog

Here's some of the requests I've had to see if I could modify...

Can we do a progressive leveling up...

Meaning right now there is a set number we can input that it takes to level up per level.

What they suggested was if there was a way to create the game to progressively increase the number it take to level up.

In order to level up you have to gain experience points and you can do that by attacking tanks.

say it takes 2 exp points to hit the first level and then 4 exp points to hit the second level. The third level would take 8 exp points.

Chen Zhen


Fog,

  Let's do one thing at a time here and concentrate on what you were originally trying to alter.
The only thing you wanted to change regarding the tanks was that they don't attack you if the user level is outside specified range, is this correct?
All the other aspects like opting to attack any tank or all the tanks appearing on the map will remain the same, is this correct?

Fog


Fog

Thanks so much...

Over the years I've been a theme maker and when one of my themes didn't work with SP...I learned about a little glitch and figured out how to fix it for my site and help some of the others over on SP.

This Battle Game I've been able to tweak here and there but is a far cry from what I know.

I want to learn more on how to do more tweaks but I'm not sure where to start.

You've been more than helpful in showing the steps needed....I'm a bit stuck on a few things to say the least.


Chen Zhen

#55
Fog,

  I had to tend to something else for the moment.

  The link is for the mod with some edited files. If this does not work I will have to actually test the mod for another edit. I basically edited the same code as prior but fixed the mysql queries for it. I also omitted a lot of line breaks in php files I edited as I had a hard time perusing the files in their state.

http://s000.tinyupload.com/index.php?file_id=44201848699212582283

Chen Zhen

Fog,

  Is the lowest user level 1? What I mean is, does the user level start at 1 or does it start at 0? I made those adjustments assuming the user level starts at 1 and is never 0 is why I ask.

Fog

We start at zero...

But the tanks only start at level 1...

There has been talk about me trying to fix it so a guy starts on level one instead of zero.

I'm testing a few things out this morning...I'll be lurking

Fog

I downloaded the file you gave me and uploaded both templates and all the sources...Still finding that the Tank is out of range.

I'm at level 75 and I have the tank set at 1 and 100000

Database dlibson_ngs
Table structure for table ngs_battle_monsters
Column   Type   Null   Default
id_monster   int(10)   No   
atk   int(10)   No   
def   int(10)   No   
hp   int(10)   No   
max_hp   int(10)   No   
img   varchar(255)   No   
name   varchar(255)   No   
mon_range   int(10)   No   
mon_max_range   int(10)   No   
Dumping data for table ngs_battle_monsters
id_monster   atk   def   hp   max_hp   img   name   mon_range   mon_max_range
143   2   1   10   10   germany-ltraktor.png   Leichttraktor   1   100000



Chen Zhen


Fog,

  I have been editing the files of the mod including the admin template. I found by testing the game that the user starts at level 0 so I have now edited the source files accordingly.

  Are you the one who added mon_range to this mod? The logic statement you found and that I edited in the last post is for when the user attacks the enemy/monster. You stated that you want the option to attack the monster no matter what so it is not necessary in that part of the code and I will adjust it. Now I need to find where the monster decides to attack the user & not let it attack when the user is not in range. This is what you want to do, is that correct?