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

Set Outfit do action

LuisPro

World War <3
Joined
May 10, 2009
Messages
425
Solutions
1
Reaction score
53
https://github.com/TwistedScorpio/OTHire/blob/master/source/game.cpp#L3318-L3326

This is outfit window show up code.
I want to make: if player click Set Outfit, dont show up outfit window just run this function from changeoutfit.lua

Code:
function onUse(cid, item, frompos, item2, topos)
    if getPlayerAccountId(cid) == 1 and getPlayerVocation(cid) == 8 then
    doCreatureChangeOutfit(cid, {lookType = 142, lookHead = 116, lookBody = 87, lookLegs = 87, lookFeet = 0})
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Your sex has been changed")
    end
end

It can be done or it have to be hardcoded?
If it have to be hardcoded can someone show me how its should looks like in src?
 
Whatever your trying to do, your doing it wrong.

Tell us why your trying to make this 'work-around' to your issue.
Or better yet tell us your actual issue..
 
I pretty much don't think you can change the functionality of the client button "Set Outfit" with a lua script. Don't get me wrong, but the client won't load your script by connecting to your server. I'm still not sure if you can hardcode it the way you want to work.
 
It is not a big deal, but is most easier make from c++ than call lua script for execute this simple script, i'll gave you a way, but im doing based on latest sources from forgottenserver, so try to convert to your sources version.
change
Code:
player->sendOutfitWindow();
for
Code:
if (player->getAccountType() == 1 && player->getVocation() == 8) {
player->addOutfit(uint16_t lookType, uint8_t addons); // add at your own here
player->sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE,  "Your sex has been changed");
}
this code above make what you want, but it does not seen you want something like you proposed, so let us know.
 
for
Code:
if (player->getAccountType() == 1 && player->getVocation() == 8) {
player->addOutfit(uint16_t lookType, uint8_t addons); // add at your own here
player->sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Your sex has been changed");
}

Yes i need something like this, but i need set exacly lookType and colors.

I got this:
Code:
if (player->getAccountId() == 1 && player->getVocationId() == 8){
        player->BUT HERE I DONT KNOW HOW TO SET LOOK TYPE AND COLORS
    }
 
what about
Code:
player->defaultOutfit.lookType = whateveryouwant

i try:
Code:
player->defaultOutfit.lookType = 142;

no errors in compile, but nothing change in game


And i also want to ask, right now my code looks like:
Code:
bool Game::playerRequestOutfit(uint32_t playerId)
{
    Player* player = getPlayerByID(playerId);
    if(!player || player->isRemoved())
        return false;

    //player->sendOutfitWindow();
    if (player->getAccountId() == 1 && player->getVocationId() == 8){
        player->defaultOutfit.lookType = 142;
        player->sendTextMessage(MSG_STATUS_SMALL, "Your sex has been changed.");
    }
    else
        player->sendTextMessage(MSG_STATUS_SMALL, "wrong acc id or voc id.");
    return true;
}
change lookType not working but BTW.. why "Your sex has been changed." text is showing only once? When i click set outfit again nothing happend.
I need to relog then ""Your sex has been changed." is showing again...
 
Last edited:
@LuisPro it's only sending one time? somehow its waiting a answer from client, take a look at protocolgame.cpp and internal outifit set works, also see if this solve for you
Code:
bool Game::playerRequestOutfit(uint32_t playerId)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;

//player->sendOutfitWindow();
if (player->getAccountId() == 1 && player->getVocationId() == 8){
Outfit_t setOutfit = player->defaultOutfit;
player->setOutfit.lookType = 142;
player->setOutfit.lookHead =  116;
player->setOutfit.lookBody = 87;
player->setOutfit.lookLegs = 87;
player->setOutfit.lookFeet = 0;
player->sendTextMessage(MSG_STATUS_SMALL, "Your sex has been changed.");
addGameTask(&Game::playerChangeOutfit, player->getID(), setOutfit);
} else {
player->sendTextMessage(MSG_STATUS_SMALL, "wrong acc id or voc id."); }
return true;
}
 
Last edited:
@LuisPro it's only sending one time? somehow its waiting a answer from client, take a look at protocolgame.cpp and internal outifit set works, also see if this solve for you
Code:
bool Game::playerRequestOutfit(uint32_t playerId)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;

//player->sendOutfitWindow();
if (player->getAccountId() == 1 && player->getVocationId() == 8){
Outfit_t setOutfit = player->defaultOutfit;
player->setOutfit.lookType = 142;
player->setOutfit.lookHead =  116
player->setOutfit.lookBody = 87
player->setOutfit.lookLegs = 87
player->setOutfit.lookFeet = 0
player->sendTextMessage(MSG_STATUS_SMALL, "Your sex has been changed.");
addGameTask(&Game::playerChangeOutfit, player->getID(), setOutfit);
} else {
player->sendTextMessage(MSG_STATUS_SMALL, "wrong acc id or voc id."); }
return true;
}

dNnEMsz.png
 
@LuisPro my bad outfit_t are not a member of player class, just remove all player->, also idk if 0.3 has addGameTask() check at protocolgame.h if there has an prototype of that, if there is add an obj to ProtocolGame* and try it.
 
Last edited:
@LuisPro my bad outfit_t are not a class of player, just remove all player->, also idk if 0.3 has addGameTask() check at protocolgame.h if there has an prototype of that, if there is add an obj to ProtocolGame* and try it.

Code:
bool Game::playerRequestOutfit(uint32_t playerId)
{
Player* player = getPlayerByID(playerId);
if(!player || player->isRemoved())
return false;

//player->sendOutfitWindow();
if (player->getAccountId() == 1 && player->getVocationId() == 8){
Outfit_t setOutfit = player->defaultOutfit;
setOutfit.lookType = 142;
setOutfit.lookHead = 116;
setOutfit.lookBody = 87;
setOutfit.lookLegs = 87;
setOutfit.lookFeet = 0;
player->sendTextMessage(MSG_STATUS_SMALL, "Your sex has been changed.");
addGameTask(&Game::playerChangeOutfit, player->getID(), setOutfit);
} else {
player->sendTextMessage(MSG_STATUS_SMALL, "wrong acc id or voc id."); }
return true;
}

I7OubBf.png
 
Back
Top