Clothes(Worn)

Forgewright
In Chases "wearablesLib" The clothes in the players inventory at game start will not show as (worn) in the inventory pane. So I created the clothes and changed the attribute "worn" to true. If I give the command to wear them in game play I get "You're already wearing them" although the inventory pane does not show this. I'm sure I am by-passing a piece of coding by changing the "worn" attribute.

Is there a simple way to have the clothes be (worn) at game start and have the inventory pane show them as (worn)?

HegemonKhan
I think neonayon also asked about this, with a solution~fix thanks to 'Tm123', in this thread:

viewtopic.php?f=10&t=5402

Forgewright
....Maybe I'll just start them out naked..... :lol:

TM123
Forgewright wrote:Is there a simple way to have the clothes be (worn) at game start and have the inventory pane show them as (worn)?


The DoWear function in the library sets several attributes when an object is worn:

object.worn = True
object.original_drop = object.drop --- the attribute original_drop is created here
object.original_alias = object.alias --- the attribute original_alias is created here
object.drop = false
object.display = GetDisplayName(object) --- the attribute original_display is created here
object.alias = GetDisplayAlias(object) + " (worn)" <-------------This is what you are missing.

(And I was just wondering how to create attributes by script)

So if you set all those at the start, plus putting it in the players inventory, it should be the same as if the object was put on.

I stuck this in the game start script and it seems to work perfectly:

object = pants <----or whatever clothing item you have
AddToInventory (object)
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"

Or I guess you could set them manually.

Or make that a function with a REALLY long name, to be called from the game start script:
<function name="Silent_Initialization_of_Wear_Mode_Bypassing_Wear_Slot_Checks_for_Single_Wearable_Object" parameters="object">
AddToInventory (object)
object.worn = True
object.original_drop = object.drop
object.original_alias = object.alias
object.drop = false
object.display = GetDisplayName(object)
object.alias = GetDisplayAlias(object) + " (worn)"
</function>


In the start script, for each item:
Silent_Initialization_of_Wear_Mode_Bypassing_Wear_Slot_Checks_for_Single_Wearable_Object (boxer_shorts)
Etc.

HegemonKhan
I haven't looked closely at Chase's Wearables Library for a long time... but I'm sure there's an Object Type (quest's CLASSES~GROUPS) that you can add to Objects, to give them the Attributes~behaviors of equipment, and I'm pretty sure the name of the Object Type (CLASS~GROUP) is 'wearable'. So, for your Objects that you want to be equipment, if using the GUI~Editor: add to them (if not using the GUI~EDitor, see below with the 'creation' tag setup and~or there's *maybe* a way to add inherited Attributes via scripting too), the 'wearable' Inherited Attribute (this are how you add the 'wearable' Object Type to that Object, which thus gives that Object all of the Attributes contained within the 'wearable' Object Type).

for example (in code):

<object name="orc_1">
<inherit name="orc_object_type" />
</object>

<object name="orc_2">
<inherit name="orc_object_type" />
</object>

<type name="orc_object_type">
<alias>orc</alias>
<description>Orcs are ugly and stupid</description>
<attr name="current_life" type="int">100</attr>
<attr name="maximum_life" type="int">100</attr>
<attr name="strength" type="int">25</attr>
<attr name="endurance" type="int">25</attr>
<attr name="dexterity" type="int">25</attr>
<attr name="agility" type="int">25</attr>
<attr name="speed" type="int">25</attr>
<attr name="dead" type="boolean">false</attr>
<attr name="fight" type="script">
// fight scripting
</attr>
</type>

The Pixie
TM123 wrote:The DoWear function in the library sets several attributes when an object is worn:
...

The best way might be to look in the library code for the DoWear function, and copy it all into your game (copy all from "<function" to "</function>" inclusive, and paste it in just before the last line, "</aslx>").

Then rename it to DoWearSilently and remove any lines that print a message to the screen.

Forgewright
Added the DoWear function to the game code. Renamed it DoWearSilently. Deleted everthing from DoAfter on in the function. In Game Start script I called the function separately for each Item I wanted to start the game wearing and added that item to the parameter box.

Started the game and it works just as desired. Gotta luv copy and paste...
Thanks to all for the assist.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums