- Adding accessories to your content pack
- 15 Feb 2010 12:15:49 am
- Last edited by elfprince13 on 15 Feb 2010 10:29:10 pm; edited 1 time in total
Important Commands
Code:
The arguments to constructAccessory are as follows.
getAccessoryGroup(%type) returns the SimSet containing accessories of type %type or errors if passed NoneType (or an unknown type).
Sample Code
Code:
This is EVERYTHING that needs to be done to add your custom accessories to the player customization menu. A few glitches with skinning are still being ironed out of the system, but this is all you need to know for creating a content pack.
When LDraw support is added, the same interface will allow you to use arbitrary LDraw models for player customization (or make your own unofficial ones), but will be extended for arms, legs, hands, head, and torso
[edit]
Be sure your accessories are initialized somewhere that ensures dedicated servers will see them.
Code:
constructAccessory(%type, %name, %offset, %rotation, %shapeFile, %datablockname, %customMountPoint);
getAccessoryGroup(%type);
The arguments to constructAccessory are as follows.
- %type is one of $Accessories::NoneType, $Accessories::HeadGearType, $Accessories::AccentType, $Accessories::BodyGearType, or $Accessories::OtherType. I can't think of any particular reason why NoneType would be used in constructing an accessory other than the default $Accessories::None (used to insert "None" into all the accessory menus), but I'm including it for documentation purposes. HeadGear and BodyGear represent hats/helmets/hair/etc and backpacks/air tanks/armor/etc. AccentType is for things like visors and feathery things in hats. OtherType is used for things like left handed accessories, beards, and birds, and anything else weird.
- %name is how the accessory will be identified in options menus and other gui elements.
- %offset is a 3-vector representing offset from the mount node. If passed an empty string this defaults to "0 0 0"
- %rotation is a normal TGE axis-angle rotation (a unit length 3-vector describing the axis of rotation followed by an angle in degrees). If passed an empty string this defaults to "0 0 1 0"
- %shapeFile is a string with the path to the model for this accessory.
- %datablockName is the name to be used for the datablock that will automagically be generated for this accessory. DO NOT CODE YOUR OWN DATABLOCK FOR THE ACCESSORY
- %customMountPoint allows you to specify a non-standard mount node for your accessory. For convenience, $Accessories::RightHandMount, $Accessories::LeftHandMount, $Accessories::BodyMount, $Accessories::RightFootMount, $Accessories::LeftFootMount, $Accessories::HeadMount, and $Accessories::VisorMount are defined. If passed a blank string, OtherType accessories will default to LeftHandMount, AccentType accessories will default to VisorMount, BodyGearType accessories will default to BodyMount and HeadGearType accessories will default to HeadMount.
getAccessoryGroup(%type) returns the SimSet containing accessories of type %type or errors if passed NoneType (or an unknown type).
Sample Code
Code:
%og = getAccessoryGroup($Accessories::OtherType);
%og.add(constructAccessory($Accessories::OtherType, "Shield", "", "", "core/data/shapes/player/left/shield.dts", "shieldShowImage", ""));
%og.add(constructAccessory($Accessories::OtherType, "Goblet", "", "", "core/data/shapes/player/left/goblet.dts", "gobletShowImage", ""));
%og.add(constructAccessory($Accessories::OtherType, "Beard", "", "", "core/data/shapes/player/left/beard.dts", "BeardShowImage", $Accessories::HeadMount));
%og.add(constructAccessory($Accessories::OtherType, "Sickle", "0 0 -0.5", "1 0 0 12", "core/data/shapes/player/left/sickle.dts", "sickleShowImage", ""));
%og.add(constructAccessory($Accessories::OtherType, "Push Broom", "0 0 1.2", "-1 0 0 180", "core/data/shapes/player/left/pushbroom.dts", "broomShowImage", ""));
%og.add(constructAccessory($Accessories::OtherType, "Whip", "", "", "core/data/shapes/player/left/whip.dts", "whipShowImage", ""));
%og.add(constructAccessory($Accessories::OtherType, "Bird", "0.45 0.2 0.2", "", "core/data/shapes/player/left/bird2.dts", "birdShowImage", $Accessories::BodyMount));
This is EVERYTHING that needs to be done to add your custom accessories to the player customization menu. A few glitches with skinning are still being ironed out of the system, but this is all you need to know for creating a content pack.
When LDraw support is added, the same interface will allow you to use arbitrary LDraw models for player customization (or make your own unofficial ones), but will be extended for arms, legs, hands, head, and torso
[edit]
Be sure your accessories are initialized somewhere that ensures dedicated servers will see them.