TWLan Forum

Full Version: Kartenverschönerung
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hallo, wieder mal ein Tool von mir!

Die Karte bei 1.4 ist ziemlich leer, und die Tools, die es gibt, benutzen entweder die Datenbank, ändern bei jedem Reload die Dekorationen oder zeigen die Grafiken nur abgehackt an.
Deshalb kommt hier mein Tool, was alle Grafiken korrekt anzeigt, nicht bei jedem Reload die Karte ändert und auch nirgends Speicherplatz belegt.

Installation
  1. Öffne htdocs/templates/game_map.tpl mit einem Texteditor.
  2. Suche nach dieser Zeile:
    Code:
    <td id="tile_{$x}_{$y}" class="{$cl_map->getClass($x,$y)}"><img src="graphic/map/{$cl_map->graphic($x,$y)}" alt="" /></td>
    und ersetze sie durch das:
    Code:
    <td id="tile_{$x}_{$y}" class="{$cl_map->getClass($x,$y)}">
    {php}
    echo '<img src="graphic/map/'.$deco[$this->_tpl_vars['x']][$this->_tpl_vars['y']].'" alt="" />';
    {/php}
    </td>
  3. Dann suche diese Zeile:
    Code:
    {foreach from=$y_coords item=y}
    und füge davor (nicht danach, auch nicht die Zeile ersetzen!) diesen Block ein:
    Code:
    {php}
    require('include/config.php');
    $algo_value = sin($config['speed']) * pi();
    $deco_type = array();
    $deco = array();
    $deco_x = $this->_tpl_vars['x_coords'];
    $deco_y = $this->_tpl_vars['y_coords'];
    array_unshift($deco_x, $deco_x[0] - 1);
    array_unshift($deco_y, $deco_y[0] - 1);
    array_push($deco_x, $deco_x[count($deco_x) - 1] + 1);
    array_push($deco_y, $deco_y[count($deco_y) - 1] + 1);
    foreach($deco_y as $y)
    {
    foreach($deco_x as $x)
    {
      if(isset($deco_type[$x][$y]))
      {
       continue;
      }
      $deco_type[$x][$y] = "gras";
      $current_algo = sin($x * $y + $algo_value);
      if(0 <= $current_algo && $current_algo < 0.1)
      {
       $deco_type[$x][$y] = "see";
       $deco[$x][$y] = 'see.png';
      }
      elseif(0.1 <= $current_algo && $current_algo < 0.3)
      {
       if(!$this->_tpl_vars['cl_map']->getVillage($x+1,$y) && !$this->_tpl_vars['cl_map']->getVillage($x,$y+1) && !$this->_tpl_vars['cl_map']->getVillage($x+1,$y+1)
        && !isset($deco[$x+1][$y]) && !isset($deco[$x][$y+1]) && !isset($deco[$x+1][$y+1]))
       {
        $deco_type[$x][$y] = "berg";
        $deco_type[$x+1][$y] = "berg";
        $deco_type[$x][$y+1] = "berg";
        $deco_type[$x+1][$y+1] = "berg";
        $deco[$x][$y] = "berg4.png";
        $deco[$x+1][$y] = "berg1.png";
        $deco[$x][$y+1] = "berg3.png";
        $deco[$x+1][$y+1] = "berg2.png";
       }
      }
      elseif(0.3 <= $current_algo && $current_algo < 1)
      {
       $deco_type[$x][$y] = "forest";
      }
    }
    }
    foreach($deco_y as $y)
    {
    foreach($deco_x as $x)
    {
      switch ($deco_type[$x][$y])
      {
        case "gras":
            $deco[$x][$y] = 'gras'.rand(1,4).'.png';
            break;
        case "forest":
            $first = 0;
            $second = 0;
            $third = 0;
            $fourth = 0;
            if($deco_type[$x][$y-1] == "forest")
            {
                $first = 1;
            }
            if($deco_type[$x-1][$y] == "forest")
            {
                $second = 1;
            }
            if($deco_type[$x][$y+1] == "forest")
            {
                $third = 1;
            }
            if($deco_type[$x+1][$y] == "forest")
            {
                $fourth = 1;
            }
            $deco[$x][$y] = 'forest'.$first.$second.$third.$fourth.'.png';
            break;
      }
    }
    }
    {/php}
  4. Speichern und schliessen
  5. Cache und templates_c leeren
  6. Fertig
Screenshot


Wenn der Speed verändert wird, ändern sich auch die Objekte auf der Karte.

Darf natürlich ich jede AiO Wink

LG
Molt
schönes tool werd ich gleich ma testen Big Grin

in die AiO??
Kannst du lesen? Big Grin

(13.06.2011, 12:18)Molt Wrote: [ -> ]Darf natürlich ich jede AiO Wink

Sieht gut aus.
Könntest du auch mehr Seen und weniger Wald einbauen oder ist das zufällig?
Diese drei Zeilen:

Code:
if(0 <= $current_algo && $current_algo < 0.1)
Code:
elseif(0.1 <= $current_algo && $current_algo < 0.3)
Code:
elseif(0.3 <= $current_algo && $current_algo < 1)

bestimmen, was wie oft vorkommt.
Möglich sind alle Werte zwischen -1 und 1.
Wenn du's also z.B. so machst:

Code:
if(-0.15 <= $current_algo && $current_algo < -0.1)
Code:
elseif(-0.1 <= $current_algo && $current_algo < 0.1)
Code:
elseif(0.1 <= $current_algo && $current_algo < 1)

Dann haste mehr Wald und weniger Seen Smile
(13.06.2011, 12:37)Molt Wrote: [ -> ]Kannst du lesen? Big Grin

(13.06.2011, 12:18)Molt Wrote: [ -> ]Darf natürlich ich jede AiO Wink

sorry ist früh am morgen
Ähm, ich hab schon zu Mittag gegessen Tongue
Aber egal Wink

Ok danke
ich bin seit 45 mins wach
(13.06.2011, 12:53)snake 9 Wrote: [ -> ]ich bin seit 45 mins wach

Penner XD
Gabs vorher nichts zu essen?^^
Ach kommt jungs, b2t Wink
Gefällt mir sehr gut Smile
Hab ich nur leider schon auf meiner Version Big Grin

MfG Manuel
English:

Very cool !
I'll show you a picture of my map for those interested

Day:

Night:

Winter:

Regards.
why are there no forrests and lakes at day?
(13.06.2011, 13:57)lolli1 Wrote: [ -> ]why are there no forrests and lakes at day?

I had to withdraw because it was causing errors.
And why does your mini map show so much forest, but the map itself doesn't?
I have the option to increase or decrease the map.

View friend .

Thanks, Molt
super arbeit molt Smile nun habe ich entlich mal wieder lust ne lan mit ds zu machen ^^ weiter so hoffe das dslan dank dir und den anderen entwicklern bald so aussieht wie das echte =)
Pages: 1 2