• 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!

Lua Znote AAC - Changing the outfit of created characters

Aradz

New Member
Joined
Sep 19, 2013
Messages
51
Reaction score
1
I'm trying to figure out how do i change start outfit in Znote AAC as my server uses custom graphics and 20 vocations which everysingle one of them uses different start outfit. Anyone could help me ?

I found in Config

$config['maleOutfitId'] = 128;
$config['femaleOutfitId'] = 138;

But i got no idea how do i setup 20 different start outfits for my vocations.
 
Last edited:
I think it would be easier to make something in craturescripts, i can try when i get to my main computer
 
Something like

Code:
local config = {
outfits = {
1 = 383,
2= 495,
},
}
function onLogin()
for voc, lookt in pairs(config.outfits) do
getPlayerVocation(cid, voc)
doSetCreatureOutfit(cid, lookt)
end
return true
end
this is just a simple example
Btw tfs version?
 
Last edited:
Something like

Code:
local config = {
outfits = {
1 = 383,
2= 495,
},
}
function onLogin()
for voc, lookt in pairs(config.outfits) do
getPlayerVocation(cid, voc)
doSetCreatureOutfit(cid, lookt)
end
return true
end
this is just a simple example
Btw tfs version?

I guess you are a "newbie" when it come's to scripting, but never create files that already is created...

login.lua, below:
Code:
if(lastLogin > 0) then

Code:
    local outfits = {
        [1] = x,
        [2] = x,
        [3] = x,
        [4] = x
    }
    local v = outfits[getPlayerVocation(cid)]
    if(v) then
        doSetCreatureOutfit(cid, v)
    end

In this case we "re use" login.lua insted of creating a new one, and makes sure aswell that its only the first login that the player gets the outfit.
 
@WibbenZ yes im sort of a "newbie" and this script was just an example of how i would make the "real script" for it, but thx for the tips they help me out alot! :)
And i did notice alot of fails in my sctipt to xD
 
I think it is best to do it in PHP, that way the character will get the correct outfit without even logging in.
Could be useful if you display the outfit of the character on the website etc. And you save up useless lua code in login.lua :p

Delete these lines:

https://github.com/Znote/ZnoteAAC/blob/master/engine/function/users.php#L1072-1076
PHP:
if ($character_data['sex'] == 1) {
    $outfit_type = $cnf['maleOutfitId'];
} else {
    $outfit_type = $cnf['femaleOutfitId'];
}

Then ADD and configure this instead:
PHP:
$outfits = array(
    // Vocation ID 0
    0 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
    // Vocation ID 1
    1 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
);

Then a few lines below you will find this:
PHP:
$import_data = array(
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $cnf['level'],
'vocation' => $character_data['vocation'],
'health' => $cnf['health'],
'healthmax' => $cnf['health'],
'experience' => 0, /* Will automatically be configured according to level after creating this array*/
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,
'maglevel' => 0,
'mana' => $cnf['mana'],
'manamax' => $cnf['mana'],
'manaspent' => 0,
'soul' => $cnf['soul'],
'town_id' => $character_data['town_id'],
'posx' => $cnf['default_pos']['x'],
'posy' => $cnf['default_pos']['y'],
'posz' => $cnf['default_pos']['z'],
'conditions' => '',
'cap' => $cnf['cap'],
'sex' => $character_data['sex'],
'lastlogin' => 0,
'lastip' => $character_data['lastip'],
'save' => 1,
'skull' => 0,
'skulltime' => 0,
'rank_id' => 0,
'guildnick' => '',
'lastlogout' => 0,
'blessings' => 0,
'direction' => 0,
'loss_experience' => 10,
'loss_mana' => 10,
'loss_skills' => 10,
'premend' => 0,
'online' => 0,
'balance' => 0
);

Replace this part of that code:
PHP:
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,

With this:
PHP:
'lookbody' => $outfits[$character_data['vocation']][$character_data['sex']]['body'], /* STARTER OUTFITS */
'lookfeet' => $outfits[$character_data['vocation']][$character_data['sex']]['feet'],
'lookhead' => $outfits[$character_data['vocation']][$character_data['sex']]['head'],
'looklegs' => $outfits[$character_data['vocation']][$character_data['sex']]['legs'],
'looktype' => $outfits[$character_data['vocation']][$character_data['sex']]['type'],
'lookaddons' => $outfits[$character_data['vocation']][$character_data['sex']]['addons'],
 
I think it is best to do it in PHP, that way the character will get the correct outfit without even logging in.
Could be useful if you display the outfit of the character on the website etc. And you save up useless lua code in login.lua :p

Delete these lines:

https://github.com/Znote/ZnoteAAC/blob/master/engine/function/users.php#L1072-1076
PHP:
if ($character_data['sex'] == 1) {
    $outfit_type = $cnf['maleOutfitId'];
} else {
    $outfit_type = $cnf['femaleOutfitId'];
}

Then ADD and configure this instead:
PHP:
$outfits = array(
    // Vocation ID 0
    0 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
    // Vocation ID 1
    1 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
);

Then a few lines below you will find this:
PHP:
$import_data = array(
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $cnf['level'],
'vocation' => $character_data['vocation'],
'health' => $cnf['health'],
'healthmax' => $cnf['health'],
'experience' => 0, /* Will automatically be configured according to level after creating this array*/
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,
'maglevel' => 0,
'mana' => $cnf['mana'],
'manamax' => $cnf['mana'],
'manaspent' => 0,
'soul' => $cnf['soul'],
'town_id' => $character_data['town_id'],
'posx' => $cnf['default_pos']['x'],
'posy' => $cnf['default_pos']['y'],
'posz' => $cnf['default_pos']['z'],
'conditions' => '',
'cap' => $cnf['cap'],
'sex' => $character_data['sex'],
'lastlogin' => 0,
'lastip' => $character_data['lastip'],
'save' => 1,
'skull' => 0,
'skulltime' => 0,
'rank_id' => 0,
'guildnick' => '',
'lastlogout' => 0,
'blessings' => 0,
'direction' => 0,
'loss_experience' => 10,
'loss_mana' => 10,
'loss_skills' => 10,
'premend' => 0,
'online' => 0,
'balance' => 0
);

Replace this part of that code:
PHP:
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,

With this:
PHP:
'lookbody' => $outfits[$character_data['vocation']][$character_data['sex']]['body'], /* STARTER OUTFITS */
'lookfeet' => $outfits[$character_data['vocation']][$character_data['sex']]['feet'],
'lookhead' => $outfits[$character_data['vocation']][$character_data['sex']]['head'],
'looklegs' => $outfits[$character_data['vocation']][$character_data['sex']]['legs'],
'looktype' => $outfits[$character_data['vocation']][$character_data['sex']]['type'],
'lookaddons' => $outfits[$character_data['vocation']][$character_data['sex']]['addons'],

Still @Znote why not try to make your aac atleast as good as gesiors? Change the highestscore layout insted of having to fetch each time that its already cached like gesior?
Same with stuff like this that drives me crazy when newbies wants first items etc, add sample characters just like gesior, its so much easier for those who are starting there first server.
 
Change the highestscore layout insted of having to fetch each time that its already cached like gesior?
Highscores are properly cached. However on 1.4 and earlier versions it is using POST logic, thus you need to fetch everytime you wish to watch it.
This is fixed on 1.5, where i use GET, allowing people to link to a specific scoreboard, and pagination is also added.

when newbies wants first items etc, add sample characters just like gesior, its so much easier for those who are starting there first server.
This is debatable, I find the gesior way very messy. Having to mess around with sample characters, and then having to make sure your data pack does not already contain a firstitems script that will add additional items to characters. A simple LUA script should suffice.
Not saying sample characters neccesarily is a bad idea, but why should I mimic Gesior when I honestly don't have to. Especially when it dosn't make it any simpler, but more confusing for many members.
 
Highscores are properly cached. However on 1.4 and earlier versions it is using POST logic, thus you need to fetch everytime you wish to watch it.
This is fixed on 1.5, where i use GET, allowing people to link to a specific scoreboard, and pagination is also added.


This is debatable, I find the gesior way very messy. Having to mess around with sample characters, and then having to make sure your data pack does not already contain a firstitems script that will add additional items to characters. A simple LUA script should suffice.
Not saying sample characters neccesarily is a bad idea, but why should I mimic Gesior when I honestly don't have to. Especially when it dosn't make it any simpler, but more confusing for many members.

Oh sorry about that then, the only znote aacs ive seen is with the post function where you had to fetch everything.
Well atleast to me its alot easier to modify those insted of changing things via lua and I try to optimize my server as good as I can and to me id say its alot better handling all that insted of using some first item script.
And also when they create ANOTHER login.lua script when there already is one.
Atleast with my time here since 08 its that users tend to go the easiest way they can insted of trying to optimize things, and thats why I think its better to use sample characters.

But also ofc we all prefer diffrent things and I prefer the way gesior does his things and since ive only used modern aac and gesior aac im used to that "messy" code as you say.
And ofc ive tried out your aac and lost intresst after about 2h and when I got your attention why do you use 2 imports for the layout insted of .. as gesior using one and using the isset function to load the content? Feels more messy to me.
 
And ofc ive tried out your aac and lost intresst after about 2h and when I got your attention why do you use 2 imports for the layout insted of .. as gesior using one and using the isset function to load the content? Feels more messy to me.
Because I do not want to append html like gesior does, I can't understand that anyone can bare the though of concatenating all html as a php string variable.

I can't see the problem with an extra include at the bottom of a page. And I have a file called "blank.php" which you can easily copy and just edit the contents, everything else is set up for you.
Of all things, I am surprised that you lost interest in my entire AAC because I use 2 includes to make sure the layout is added properly. If you ask me this is the efficient way to concatenate html.
 
Because I do not want to append html like gesior does, I can't understand that anyone can bare the though of concatenating all html as a php string variable.

Well the thing with gesior is that everything is in your layout.php file kinda, I can't say ive done any major changes to mine that have been thru gesior code except changing sizes of tables etc to fit my custom layout.
The most things I do is what I program myself and I program just like you kinda the only diffrence I can find is that you use } else { and I use }else{ thats the only thing that differs my coding with your code kinda.
And trust me I like your coding and if I could get a copy of gesiors coded like znote I would use it(Maybe should put that on my todo list :)) But the thing is that I do not like how your system is made as I wrote above.
 
I think it is best to do it in PHP, that way the character will get the correct outfit without even logging in.
Could be useful if you display the outfit of the character on the website etc. And you save up useless lua code in login.lua :p

Delete these lines:

ZnoteAAC/users.php at master · Znote/ZnoteAAC · GitHub
PHP:
if ($character_data['sex'] == 1) {
    $outfit_type = $cnf['maleOutfitId'];
} else {
    $outfit_type = $cnf['femaleOutfitId'];
}

Then ADD and configure this instead:
PHP:
$outfits = array(
    // Vocation ID 0
    0 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
    // Vocation ID 1
    1 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
);

Then a few lines below you will find this:
PHP:
$import_data = array(
'name' => $character_data['name'],
'group_id' => 1,
'account_id' => $character_data['account_id'],
'level' => $cnf['level'],
'vocation' => $character_data['vocation'],
'health' => $cnf['health'],
'healthmax' => $cnf['health'],
'experience' => 0, /* Will automatically be configured according to level after creating this array*/
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,
'maglevel' => 0,
'mana' => $cnf['mana'],
'manamax' => $cnf['mana'],
'manaspent' => 0,
'soul' => $cnf['soul'],
'town_id' => $character_data['town_id'],
'posx' => $cnf['default_pos']['x'],
'posy' => $cnf['default_pos']['y'],
'posz' => $cnf['default_pos']['z'],
'conditions' => '',
'cap' => $cnf['cap'],
'sex' => $character_data['sex'],
'lastlogin' => 0,
'lastip' => $character_data['lastip'],
'save' => 1,
'skull' => 0,
'skulltime' => 0,
'rank_id' => 0,
'guildnick' => '',
'lastlogout' => 0,
'blessings' => 0,
'direction' => 0,
'loss_experience' => 10,
'loss_mana' => 10,
'loss_skills' => 10,
'premend' => 0,
'online' => 0,
'balance' => 0
);

Replace this part of that code:
PHP:
'lookbody' => $cnf['lookBody'], /* STARTER OUTFITS */
'lookfeet' => $cnf['lookFeet'],
'lookhead' => $cnf['lookHead'],
'looklegs' => $cnf['lookLegs'],
'looktype' => $outfit_type,
'lookaddons' => 0,

With this:
PHP:
'lookbody' => $outfits[$character_data['vocation']][$character_data['sex']]['body'], /* STARTER OUTFITS */
'lookfeet' => $outfits[$character_data['vocation']][$character_data['sex']]['feet'],
'lookhead' => $outfits[$character_data['vocation']][$character_data['sex']]['head'],
'looklegs' => $outfits[$character_data['vocation']][$character_data['sex']]['legs'],
'looktype' => $outfits[$character_data['vocation']][$character_data['sex']]['type'],
'lookaddons' => $outfits[$character_data['vocation']][$character_data['sex']]['addons'],


i have problem when i change
Then ADD and configure this instead:
PHP:
$outfits = array(
    // Vocation ID 0
    0 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
    // Vocation ID 1
    1 => array(
        // Gender 0 = female
        0 => array(
            'type' => 138,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        ),
        // Gender 1 = male
        1 => array(
            'type' => 128,
            'body' => 42,
            'legs' => 89,
            'feet' => 10,
            'head' => 15,
            'addons' => 0
        )
    ),
);
my website goes to offline any help ?
 
Back
Top