Author Topic: How to recolor default models?  (Read 881 times)

I was trying to make a pack of varying default rocket launchers for a server, and to differentiate them I wanted to make them all different colors.  However, I don't know how I can simply change the color of them like that.  Could someone help?

(Yes I am aware there is an add-on that is rocket launchers varying in color, I do not want/need that add-on).

datablock itemData(itemWhatever)
{
    doColorShift = true;
    colorShiftColor = colorFvalues;
};

datablock shapeBaseImageData(imageWhatever)
{
    doColorShift = true;
    colorShiftColor = itemWhatever.colorShiftColor;
};

that's psuedocode, don't use that exactly. its there to give you an idea
colorFvalues are RGBA values divided by 255

basically that ^ but if you want to just create recolored rocket launchers then it would make sense to do this to inherit all of its properties like the model and projectile:

datablock itemData(itemWhatever : rocketLauncherItem)
{
    doColorShift = true;
    colorShiftColor = colorFvalues;
};

datablock shapeBaseImageData(imageWhatever : rocketLauncherImage)
{
    doColorShift = true;
    colorShiftColor = itemWhatever.colorShiftColor;
};

an example of the colorFvalues would be "1 0 0 1" which would make it tinted red (red 100%, green 0%, blue 0%, alpha 100%)

This code remakes new rocket launchers that are recolored as an add on?  I don't understand.  I feel like I can just edit the colors in paint.net or something?

This code remakes new rocket launchers that are recolored as an add on?  I don't understand.  I feel like I can just edit the colors in paint.net or something?
Yes, the code that we are giving you is something similar to what you would use to recolor the item.

I feel like I can just edit the colors in paint.net or something?
You can't because the default weapons were designed to be more easily recolored than that. Plus re-coloring the icon would be harder manually. Doing this takes care of the icon too.

Use the code above and change itemWhatever and imageWhatever to a unique name with no spaces.

So while hosting I type this code into the console and it'll create a new rocketlauncher as a new add on too?

No.
Create a new folder. Name it Weapon_WhateverYouWant
Put a description.txt in it. The contents of the file doesn't matter.
Put a server.cs in it.
Put this code into the server.cs
Quote from: Code
datablock itemData(someUniqueNameItem : rocketLauncherItem)
{
    uiName = "Display Name";

    image = someOtherUniqueNameImage;

    colorShiftColor = "1 1 1 1";
};

datablock shapeBaseImageData(someOtherUniqueNameImage : rocketLauncherImage)
{
    item = someUniqueNameItem;

    colorShiftColor = someUniqueNameItem.colorShiftColor;
};
Replace the bolded things with your own stuff.