Author Topic: Where and how to change basic skin for new player?  (Read 7284 times)

Offline Powerack

  • Administrátor na doživotí.
    • Powerackovo Doupě
Where and how to change basic skin for new player?
« 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.
I am working on private server at: fonline.powerack.cz.
Why I cant use image in signature?

Re: Where and how to change basic skin for new player?
« Reply #1 on: June 25, 2019, 07:33:43 am »
Code: [Select]
`disguise critter_number_from_CritterTypes.cfg target_critter_id

Offline Powerack

  • Administrátor na doživotí.
    • Powerackovo Doupě
Re: Where and how to change basic skin for new player?
« Reply #2 on: June 25, 2019, 02:51:39 pm »
Thanks, but I want to set default skin for all players automatically at registration.
I am working on private server at: fonline.powerack.cz.
Why I cant use image in signature?

Offline Wipe

  • Rotator
  • Random is god
Re: Where and how to change basic skin for new player?
« Reply #3 on: June 25, 2019, 11:50:06 pm »
critter_init(firstTime=true)
Games are meant to be created, not played...

Offline Powerack

  • Administrátor na doživotí.
    • Powerackovo Doupě
Re: Where and how to change basic skin for new player?
« Reply #4 on: June 26, 2019, 12:10:13 am »
Still nothing. Filename? I using Reloaded S2 engine.
I am working on private server at: fonline.powerack.cz.
Why I cant use image in signature?

Re: Where and how to change basic skin for new player?
« Reply #5 on: June 30, 2019, 11:11:29 am »
Still nothing. Filename? I using Reloaded S2 engine.
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.

Offline C4N

Re: Where and how to change basic skin for new player?
« Reply #6 on: July 23, 2019, 11:59:05 am »
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.

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

Code: [Select]
`disguise critter_number_from_CritterTypes.cfg target_critter_id

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

critter_init(firstTime=true)

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

Code: [Select]
////////////////////////////////////////////////////////////////////////////////////////////////////
// Call on player register or login in game.
// Default start position for players is center of global map.

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.

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.

Re: Where and how to change basic skin for new player?
« Reply #7 on: July 23, 2019, 08:39:25 pm »
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: [Select]
    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;
        }
    }

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 ).
« Last Edit: July 23, 2019, 08:42:36 pm by Vice Dice »

Offline C4N

Re: Where and how to change basic skin for new player?
« Reply #8 on: July 24, 2019, 12:37:34 am »
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: [Select]
// Critter base types
#define CRTYPE_MALE_DEFAULT                      (CRTYPE_MALE_VAULTSUIT)
#define CRTYPE_FEMALE_DEFAULT                    (CRTYPE_FEMALE_JUMPSUIT)

To:

Code: [Select]
// Critter base types
#define CRTYPE_MALE_DEFAULT                      (CRTYPE_MALE_LEATHER_ARMOR)
#define CRTYPE_FEMALE_DEFAULT                    (CRTYPE_FEMALE_LEATHER_ARMOR)

Offline C4N

Re: Where and how to change basic skin for new player?
« Reply #9 on: July 24, 2019, 09:44:54 am »
I finally got the chance to try this out with success