FOnline Development > Questions and Answers

Where and how to change basic skin for new player?

<< < (2/2)

remake:

--- Quote from: Powerack on June 26, 2019, 12:10:13 am ---Still nothing. Filename? I using Reloaded S2 engine.

--- End quote ---
Personally, I felt like being interviewed. The only thing missing here was a desk lamp that glows in the eye.
If you want to work with the server you have to learn the basics first. To find the answer follow the game scripts's code.

C4N:

--- Quote from: Powerack on June 24, 2019, 06:25:30 pm ---Hello,

I have simple question about basic skin for player. I do not want to use classic blue jumpsuit skin, but leather jacket skin. I seriously dislike this blue "gay" skin :-D

So here is my question: Where and how to change settings to change critter (or whatever) to use leather jacket skin as default for any new players?

Sorry for my bad english and thanks for an advice.

--- End quote ---

As I understand, you want to change default player unarmored view.


--- Quote from: remake on June 25, 2019, 07:33:43 am ---
--- Code: ---`disguise critter_number_from_CritterTypes.cfg target_critter_id
--- End code ---

--- End quote ---

From what I can see, disguise is a cheat command listed on the cheat codes table


--- Quote from: Wipe on June 25, 2019, 11:50:06 pm ---critter_init(firstTime=true)

--- End quote ---

This procedure is called on player registration/login from what I can see here:


--- Code: ---////////////////////////////////////////////////////////////////////////////////////////////////////
// Call on player register or login in game.
// Default start position for players is center of global map.
--- End code ---


--- Quote from: remake on June 30, 2019, 11:11:29 am ---Personally, I felt like being interviewed. The only thing missing here was a desk lamp that glows in the eye.
If you want to work with the server you have to learn the basics first. To find the answer follow the game scripts's code.

--- End quote ---

My man wut? haha

I have not found any code related to setting default unarmored player's view, so my suggestion would be to workaround it and just replace the graphic asset.

Vice Dice:
You use "bool ChangeCrType(uint newType);" engine Critter method function for that. Normally SDK holds something like "Base" critter type inside some stat, normally it is ST_BASE_CRTYPE, then to use this critter type value to restore "nude" skin of critters that take off their armors etc.

If you still don't quite understand, critter type is a structure that contains lots of data, such as animations indices allowing, run/walk time, and most importantly the actual animation BASE name ( which is technically a part of skin graphics file name). It is hooked up in plain non-negative number, you can check them in your CritterTypes.cfg file, normally its located in server/data folder, normally this file should be self-explanatory what is inside for you to get used to it. So when you want to change the critter type you logically feed the desired critter type ID ( the number its declared with ). Directly you can do it with plain number, i.e if your critter type is marked with 13 ID, you just call it with critter.ChangeCrType(13), normally people define those IDs as some verbose and easy to understand constants, then to make it easier to read and refer to in future.

At which point of execution to do this is up to you, but NORMALLY such things done via critter_init server engine callback, that allows globally handle all newly generated critters, players included. And if you do it in there, you probably want it to be executed only when firstTime is true.

Example

--- Code: ---    if(firstTime)
    {
        // INITIALIZE PARAMS
        if(cr.IsPlayer())
        {
            cr.StatBase[ST_BASE_CRTYPE] = (cr.Stat[ST_GENDER] == GENDER_MALE ? CRTYPE_MALE_DEFAULT : CRTYPE_FEMALE_DEFAULT); // set our base critter type (presumably forever)
            cr.ChangeCrType(cr.StatBase[ST_BASE_CRTYPE]); // apply it;
        }
    }

--- End code ---

If you want to change only the visual representation of a critter without changing it critter type, you might want to teach engine/rename graphic files ( why though ).

C4N:
Thanks Vice Dice, really useful information right there, nice explanation and a perfect starting point to start working with critter data. I'm personally still learning how all is structured in FOnline code and I don't have a working environment to test things out, but from what I can read what OP is seeking could be achieved by changing some constants definitions:

From:


--- Code: ---// Critter base types
#define CRTYPE_MALE_DEFAULT                      (CRTYPE_MALE_VAULTSUIT)
#define CRTYPE_FEMALE_DEFAULT                    (CRTYPE_FEMALE_JUMPSUIT)
--- End code ---

To:


--- Code: ---// Critter base types
#define CRTYPE_MALE_DEFAULT                      (CRTYPE_MALE_LEATHER_ARMOR)
#define CRTYPE_FEMALE_DEFAULT                    (CRTYPE_FEMALE_LEATHER_ARMOR)
--- End code ---

C4N:
I finally got the chance to try this out with success

Navigation

[0] Message Index

[*] Previous page

Go to full version