Multi-Prim Breedables

Posted on

In the let’s make a breedable series, the scripts were tuned for single prim meshes. The most noticable issue will be the colour is not set on the whole linkset, but rather just the root prim.

Fixing the Colour

To fix this, you’ll need to replace the single llSetColor instance in the brain script (look for the following snippet, it’s towards the end…)

   link_message(integer sender, integer number, string message, key id) {
        if (number == 100) {
            if (llGetOwnerKey(id) == llGetOwner()) {
                list data = llParseString2List(message, ["^"], []);
                if (llList2String(data, 0) == "PET_DATA") {
                    llAllowInventoryDrop(FALSE);
                    my_colour_trait = (vector)llList2String(data, 1);
                    llLinksetDataWrite("colour-trait", (string)my_colour_trait);
                    sex = (integer)llList2String(data, 2);
                    llLinksetDataWrite("sex", (string)sex);
                    llLinksetDataWrite("age", "0");
                    llLinksetDataWrite("home-position", (string)llGetPos());
                    llLinksetDataWrite("range", "3.0");
                    llLinksetDataWrite("cooldown", "0");
                    llLinksetDataWrite("hunger", "0");
                    llLinksetDataWrite("sickness", "0");
                    llSetColor((vector)llList2String(data, 1), ALL_SIDES);
                    llMessageLinked(LINK_THIS, 9999, "", "");
                    state running;

                }
            }
        }
    }

You could change the entire linkset with the following line

llSetLinkColor(LINK_SET, (vector)llList2String(data, 1), ALL_SIDES);

If you are using an invisible root prim, you might prefer:

llSetLinkColor(LINK_ALL_CHILDREN, (vector)llList2String(data, 1), ALL_SIDES);

To set the colour of only specific link numbers try

llSetLinkColor(2, (vector)llList2String(data, 1), ALL_SIDES);
llSetLinkColor(3, (vector)llList2String(data, 1), ALL_SIDES);
llSetLinkColor(5, (vector)llList2String(data, 1), ALL_SIDES);

This will set link number 2,3 and 5 to the colour, but not link number 4.

Getting the link number can be tricky, it’s shown in firestorm’s edit dialog, but it is not always right. You can use this following script to get an accurate link number (put the script in the prim you want the link number of).

default {
	state_entry() {
		llSay(0, (string)llGetLinkNumber());
	}
}

Copy the link number down and remove the script, then place it in the next prim you want the link number of.

Fixing the Rotation

Sometimes your pets might walk sideways, or up the wrong way. This can happen if your linkset is not oriented in the right direction.

Your pet at zero rotation should be oriented in the positive X direction, this means when you edit it inworld, the rotation should be 0 for each x, y and z components, and the pet should be facing the same direction as the red move arrow is pointing.

If it is not, due to the arrangement of your linkset or orientation of a mesh is not right, you may need to add an invisible root prim and link your pet to it (then move all your scripts, as they need to be in the root prim).