• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[PROBLEM] How to change start player level in znote acc

In config.php on line 98-102.

Code:
  $config['level'] = 8;
   $config['health'] = 185;
   $config['mana'] = 35;
   $config['cap'] = 435;
   $config['soul'] = 0;
 
In config.php on line 98-102.

Code:
  $config['level'] = 8;
   $config['health'] = 185;
   $config['mana'] = 35;
   $config['cap'] = 435;
   $config['soul'] = 0;


It works well for starting at level 8, but in case it starts at level higher than 8 the player remains with the same life and mana.

How to configure life and mana of different vocations and level greater than 8?
 
It works well for starting at level 8, but in case it starts at level higher than 8 the player remains with the same life and mana.

How to configure life and mana of different vocations and level greater than 8?
Use tibia health/mana calculator on tibia.wikia. Then just fill it in.
 
You may need to override the config rules and make specific values for each vocation id, here is a sample where I do it with no vocation:
https://github.com/Znote/ZnoteAAC/b...5e46aee/engine/function/users.php#L1207-L1221

You could add like:
PHP:
// If new character vocation ID is 1:
if ($character_data['vocation'] === '1') {
    $import_data['level'] = 50;
    $import_data['experience'] = level_to_experience(50);
    $import_data['health'] = 1000; // Start with 1000 HP.
    $import_data['healthmax'] = 1000;
}
 
Hey @Znote,
It's my first time with your AAC. Following his tip, I did the following;

config.php
PHP:
// Start Level Needed
$config['startCustom'] = true;
$config['startLevel'] = 150;

// Base Level Stats
$config['baseLevel'] = 8;
$config['baseHealth'] = 185;
$config['baseMana'] = 40;
$config['baseCap'] = 470;
$config['baseSoul'] = 100;

users.php
PHP:
    // Parameter: level, vocationId returns health for that level.
    function health_for_Level($level, $vocation) {
        $voc = $import_data['vocations_gain'][$vocation];
        return ( $import_data['baseHealth'] + ($voc['hp'] * ($import_data['level'] - $import_data['baseLevel'])) );
    }
    // Parameter: level, vocationId returns mana for that level.
    function mana_for_Level($level, $vocation) {
        $voc = $import_data['vocations_gain'][$vocation];
        return ( $import_data['baseMana'] + ($voc['mp'] * ($import_data['level'] - $import_data['baseLevel'])) );
    }
    // Parameter: level, vocationId returns mana for that level.
    function cap_for_Level($level, $vocation) {
        $voc = $import_data['vocations_gain'][$vocation];
        return ( $import_data['baseCap'] + ($voc['cap'] * ($import_data['level'] - $import_data['baseLevel'])) );
    }
    // If need custom stats vocation
    if ($import_data['startCustom'] == true) {
        $sLevel = $cnf['startLevel'];
        $vocationId = $character_data['vocation'];
        $import_data['level']         = $sLevel;
        $import_data['experience']     = level_to_experience($sLevel, $vocationId);
        $import_data['health']         = health_for_Level($sLevel, $vocationId);
        $import_data['healthmax']     = health_for_Level($sLevel, $vocationId);
        $import_data['mana']         = mana_for_Level($sLevel, $vocationId);
        $import_data['manamax']     = mana_for_Level($sLevel, $vocationId);
        $import_data['cap']         = cap_for_Level($sLevel, $vocationId);
        $import_data['soul']         = $cnf['baseSoul'];
    }

Is correct?
 
Last edited by a moderator:
No, but nice try! :D

You are mixing $import_data and $config.
You could extend $import_data with those config values, but that would be a bad idea as it will attempt to insert them to the database. :p (thats why its called import_data).
So just keep them separated.

Config setup seems fine, but it is totally fine to nest things together. I have done a pretty poor job at that with Znote AAC, but you don't have to follow my bad example.
PHP:
// Start Level Needed
$config['newCharacterData'] = array(
    'custom' => true,
    'level' => 150
);

// Base Level Stats
$config['baseCharacterData'] array(
    'level' => 8,
    'health' => 185,
    'mana' => 40,
    'cap' => 470,
    'soul' => 100
);

Also in your functions "health_for_level" etc you use $import_data without passing it through params. The function don't have access to it.
Passing along a bigass array just to access a few values in a small function is not a good approach either.
I would just skip making functions and just do :

PHP:
// When you are inside a function, (like user_create_character), you can load config variables through the Config('keyvalue') function.
$vocation_gains = Config('vocations_gain');

$start = Config('newCharacterData');
// $startcustom = $start['custom'];
// $startlevel = $start['level'];
$base = Config('baseCharacterData');

if ($start['custom'] === true) {
    $voc = $vocation_gains[(int)$character_data['vocation']];
    $import_data['health'] = ( $base['health'] + ($voc['hp'] * ($start['level'] - $base['level'])) );
    // ...
}
 
Last edited:
users.php
Code:
// Custom Start
$vocation_gains = Config('vocations_gain');
$start = Config('newCharacterData');
$base = Config('baseCharacterData');

if ($start['custom'] === true) {
       $voc = $vocation_gains[(int)$character_data['vocation']];
       $health_  = ( $base['health'] + ($voc['hp'] * ($start['level'] - $base['level'])) );
       $mana_   = ( $base['mana'] + ($voc['mp'] * ($start['level'] - $base['level'])) );
       $cap_       = ( $base['cap'] + ($voc['cap'] * ($start['level'] - $base['level'])) );
       $import_data['level']              = $start['level'];
       $import_data['experience']    = level_to_experience($start['level']);
       $import_data['health']           = $health_;
       $import_data['healthmax']    = $health_;
       $import_data['mana']            = $mana_;
       $import_data['manamax']     = $mana_;
       $import_data['cap']               = $cap_;
       $import_data['soul']              = $base['soul'];
}
 
Last edited:
$voc = $vocation_gains[(int)$character_data['vocation']]; $health_ = ( $base

users.php
Code:
// Custom Start
$vocation_gains = Config('vocations_gain');
$start = Config('newCharacterData');
$base = Config('baseCharacterData');

if ($start['custom'] === true) {
       $voc = $vocation_gains[(int)$character_data['vocation']];
       $health_  = ( $base['health'] + ($voc['hp'] * ($start['level'] - $base['level'])) );
       $mana_   = ( $base['mana'] + ($voc['mp'] * ($start['level'] - $base['level'])) );
       $cap_       = ( $base['cap'] + ($voc['cap'] * ($start['level'] - $base['level'])) );
       $import_data['level']              = $start['level'];
       $import_data['experience']    = level_to_experience($start['level']);
       $import_data['health']           = $health_;
       $import_data['healthmax']    = $health_;
       $import_data['mana']            = $mana_;
       $import_data['manamax']     = $mana_;
       $import_data['cap']               = $cap_;
       $import_data['soul']              = $base['soul'];
}
Hello, do you have this full code working?
 
Back
Top