theduke

Vehicle skin per UID

22 posts in this topic

Ok so here it goes, I have been banging my head with this for at least a month now. 

Im trying to have vehicles skins per UID, like the flags.

I had someone help me, but sadly the code doesnt work properly.  By looking at it, and with my limited knowledge, it seems it should work. But obvioulsy doesnt lol

This is the file in question that seems to be the one that needs to be modified

ExileClient_gui_vehicleCustomsDialog_updateVehicle.sqf

the text in bold is what was added

Spoiler

/**
 * ExileClient_gui_vehicleCustomsDialog_updateVehicle
 *
 * Exile Mod
 * exile.majormittens.co.uk
 * © 2015 Exile Mod Team
 *
 * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
 * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
 */
 
private["_restrictToUID","_myUID","_vipPlayers","_vehcileSkinArray","_originalVehicleObject","_dialog","_skinListBox","_parentClassName","_vehicleCustomsConfig","_availableSkins","_skinPrice","_skinName","_indexEntryIndex","_purchaseButton"];
disableSerialization;
_originalVehicleObject = _this;
_myUID = getPlayerUID player;
ExileClientVehicleCustomsOriginalVehicle = _originalVehicleObject;
ExileClientVehicleCustomsOriginalClass = typeOf _originalVehicleObject;
_dialog = uiNameSpace getVariable ["RscExileVehicleCustomsDialog", displayNull];
_skinListBox = _dialog displayCtrl 4001;
ExileClientVehicleCustomsOriginalClass call ExileClient_gui_modelBox_update;
lbClear _skinListBox;
_parentClassName = configName (inheritsFrom (configFile >> "CfgVehicles" >> ExileClientVehicleCustomsOriginalClass));
if (isClass (missionConfigFile >> "CfgVehicleCustoms" >> _parentClassName) ) then
{
    _vehicleCustomsConfig = (missionConfigFile >> "CfgVehicleCustoms" >> _parentClassName);
    _availableSkins = getArray (_vehicleCustomsConfig >> "skins");

    _vipPlayers = getArray (missionConfigFile >> "VipPlayers" >> "UIDS");
    if (getPlayerUID player in _vipPlayers) then {
    
        _vehcileSkinArray = getArray (missionConfigFile >> "VipSkins" >> ExileClientVehicleCustomsOriginalClass >> "Skins");
        {
            _availableSkins  pushBackUnique _x;
        } forEach _vehcileSkinArray;
        
        };

        
 
    {
        _skinPrice = _x select 1;
        _skinName = _x select 2;
        _indexEntryIndex = _skinListBox lbAdd _skinName;
        _skinListBox lbSetData [_indexEntryIndex, _skinName];
        _skinListBox lbSetTextRight [_indexEntryIndex, format["%1", _skinPrice]];
        _skinListBox lbSetPictureRight [_indexEntryIndex, "exile_assets\texture\ui\poptab_trader_ca.paa"];
        if (_skinPrice > (player getVariable ["ExileMoney", 0])) then
        {
            _skinListBox lbSetColorRight [_indexEntryIndex, [0.91, 0, 0, 0.6]];
        };
    }
    forEach _availableSkins;
    _purchaseButton = _dialog displayCtrl 4002;
    _purchaseButton ctrlEnable true;
};

and here is the addition to the config.cpp

Spoiler

class VipPlayers
{
    UIDS[]=
    {
        "xxxxxxxxxxxxxxx"
    };
};

class VipSkins
{

    class Exile_Car_Strider_abstract
    {

        Skins[] = 
        {
            {"Exile_Car_Strider",   100, "TMNT", {"textures\stridertmnt.paa"};},
            {"Exile_Car_Strider",   100, "CAMO", {"textures\stridercamo.paa"};}
        };
    };
    class Exile_Car_Offroad_abstract
    {
        Skins[] = 
        {
            {"Exile_Car_Offroad_red",            700, "Camo Stripes",{"textures\offroadcamostripes.paa"};},
            {"Exile_Car_Offroad_red",            700, "Toyota Rally",{"textures\toyotaoffroad.paa"};}
        };
    };
};

oh and yes i did the CfgExileCustomCode part also.

Any help would be greatly appreciate, as i've exhausted everything that i know...

Duke

Edited by theduke
typo

Share this post


Link to post
Share on other sites
Advertisement

Are the Skins showing in the List at the trader? As soon as im home from work tomorrow i will have a look into this. 

Also your texture paths seem to be wrong, if they are inside the missionfolder they should have a path beginning with:

mpmissions\__cur_mp.Altis\

Swap Altis with your missionfile.

Edited by The Walking Bread

Share this post


Link to post
Share on other sites

   getArray (missionConfigFile >> 

This bit of code won't work; tried also with my own settings.

Try putting ALL required info in the SQF, nothing external needed, see if that works.

Share this post


Link to post
Share on other sites
3 hours ago, The Walking Bread said:

Are the Skins showing in the List at the trader? As soon as im home from work tomorrow i will have a look into this. 

Also your texture paths seem to be wrong, if they are inside the missionfolder they should have a path beginning with:


mpmissions\__cur_mp.Altis\

Swap Altis with your missionfile.

The skins work if i add them in the normal array of custom skins. I've made about 6 or 7 skins. They all work.

But as soon as i add them under the VipSkins array, they dont.

The script, from what it reads (or what i understand). If the player is in that list of VipPlayer, those skins are added to the existing list of skins for that vehicle.

3 hours ago, xBowBii said:

 


   getArray (missionConfigFile >> 

 

This bit of code won't work; tried also with my own settings.

Try putting ALL required info in the SQF, nothing external needed, see if that works.

I not sure exactly what you mean... how exactly should it be formatted?

Thanks for the help guys!

Share this post


Link to post
Share on other sites

In your SQF:

Define VIPArray as a local variable holding an array of UIDs. Use thuis variable the same way you're using it now.

Do the same fort the skins, make a local variable holding the array of skins, exactly the same way as you configured it in your config.cpp.

 

Why? I think the getArray bit of code doesn't work correctly; it doesn't receive any info. By adding the required info (UID, skins) in the SQF itself, it has everything needed to work.

 

Here's an example code:

(I'm on mobile at school, sorry if it's quickly written)

	_vipPlayers = [UID1, UID2, UID3];
    if (getPlayerUID player in _vipPlayers) then {
    
        _vehcileSkinArray = [skin1, skin2, skin3];
        {
            _availableSkins  pushBackUnique _x;
        } forEach _vehcileSkinArray;
        
        };
	
Edited by xBowBii

Share this post


Link to post
Share on other sites
On 3/9/2017 at 0:37 PM, The Walking Bread said:

exile_21258.PNG

Your problem is that the 


typeOf _originalVehicleObject;

returns 


"Exile_Car_Strider"

But your Config "expects" 


"Exile_Car_Strider_abstract"

Hope this helps.

So if i understnad correctly in my class vipskins the vehicle itself should have _absract at the end?

Here is a part of my config.cpp

This part is included in the original custom skins by exile (CfgVehicleCustoms) and works fine. I used a different camo skin to see if it worked.

class Exile_Car_Strider_abstract
	{

		skins[] = 
		{
			{"Exile_Car_Strider",   100, "CAMO", {"textures\stridercamo.paa"};}
		};
	};

And for the VIP part i tried this. (from what i understood, its looking for the _abstract) and sadly it didnt work.

class VipSkins
{

	class Exile_Car_Strider_abstract
	{

		Skins[] = 
		{
			{"Exile_Car_Strider_abstract",   100, "TMNT", {"textures\stridertmnt.paa"};}
		};
	};

 

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.