Script for garment used by non-standard body character

Post » Tue May 17, 2011 11:45 am

I have the following problem:
I created a character (group of races), using non-standard lower body parts (http://tesnexus.com/downloads/file.php?id=30545, http://tesnexus.com/downloads/file.php?id=28798, http://tesnexus.com/downloads/file.php?id=28817...).
I need create a script (or group of scripts) that can detect whether are the currently used / wearing armor or garment suitable for my characters.
But It is not appropriate that all "appropriate" clothing listed directly in the Script or some kind of list. Due to the simple extensibility would be an appropriate piece of clothing or armor itself somehow notify management script that clothing "is appropriate". At best, using a simple unified script, which would be placed on the object.

I do not know if anyone has solved a similar problem - solution used in plugin Scripted Argonian Feet is too complex and, in particular - use the fixed list of objects. I'm looking for an simpler and versatile solution...
User avatar
Kelsey Hall
 
Posts: 3355
Joined: Sat Dec 16, 2006 8:10 pm

Post » Tue May 17, 2011 7:03 am

Simplest would be a quest script (Start Enabled) that has a "begin menumode" block to run when the inventory menu is opened. This just sets a "CheckFeet" flag to indicate that the player could have changed equipment. A "begin game mode" block in the same script then has
if CheckFeet   Set BannedItem to    if ( BannedItem )       player.UnequipItem BannedItem   endif   set CheckFeet to 0 ; so it doesn't get done all the time.endif

Slightly simplified, of course. OBSE has a number of different functions for testing equipment slots, and I'm not sure which would be best for this. A lot will depend on whether multi-slot items are to be allowed or not.
User avatar
Rowena
 
Posts: 3471
Joined: Sun Nov 05, 2006 11:40 am

Post » Tue May 17, 2011 1:08 pm

In this time is ready only one model of feet and about twenty lower body models. One lower body model to be "basic", which should be used, unless it is not used a different appropriate model (for "naked" character) . The basic model of the feet and the lower body are sort of clothing, marked as unplayable and therefore invisible in the menu.
[IMG]http://img261.imageshack.us/img261/416/smtx01bodypartsk.jpg[/IMG]

Garment testing is obvious, something of this nature

Quest script
Edit: Everything is done wrong.Banish them on the trees and start over again.

I already tried it, but it works only for the feet, not for the lower body. As if the global flag not set to 1
User avatar
Gavin Roberts
 
Posts: 3335
Joined: Fri Jun 08, 2007 8:14 pm

Post » Tue May 17, 2011 10:42 am

Preliminary results - it works passably, but it still is not perfect ...

1) for starting quest
Spoiler
ScriptName SMTXQMinotaurus2BodyControlQuestScriptBegin GameModeIf player.GetItemCount SMTXtaurusRMFoot == 0	player.AddItem SMTXtaurusRMFoot 1	player.EquipItem SMTXtaurusRMFootendifIf player.GetItemCount SMTXtaurusRMLBAPs == 0	player.AddItem SMTXtaurusRMLBAPs 1;	player.EquipItem SMTXtaurusRMLBAPsendifIf player.GetItemCount SMTXtaurusRMUB == 0	player.AddItem SMTXtaurusRMUB 1	player.EquipItem SMTXtaurusRMUBendifIf player.GetItemCount SMTXtaurusRMLBlc1 == 0	player.AddItem SMTXtaurusRMLBlc1 1	player.EquipItem SMTXtaurusRMLBlc1endif;advlt itemIf player.GetItemCount SMTXtaurusRMLBCPup == 0	player.AddItem SMTXtaurusRMLBCPup 1endifIf player.GetItemCount SMTXtaurusRMLBCPupg == 0	player.AddItem SMTXtaurusRMLBCPupg 1endifStartQuest SMTXMinotaurus2FootControlStartQuest SMTXMinotaurus2LowerBodyControlStartQuest SMTXMinotaurus2UpperBodyControlStopQuest SMTXMinotaurus2BodyControlQuestMessagebox "Please wait a moment. Body control script starts and adds the necessary body parts."end


2) three similar scripts for body control quests (for foot, lower body and upper body)
Spoiler
ScriptName SMTXQMinotaurus2LowerBodyControlScript; global SMTXAppropriateLBodyObjectref whatisonlowerbodyshort Testdonefloat fQuestDelayTimeBegin Menumode	set Testdone to 1endBegin Gamemode	set SMTXMinotaurus2LowerBodyControl.fQuestDelayTime to 0.3	set whatisonlowerbody to player.GetEquippedObject 3 		 	If testdone == 1		if (whatisonlowerbody != SMTXtaurusRMLBAPs) 			if (SMTXAppropriateLBodyObject == 0)				player.UnequipItem whatisonlowerbody				player.EquipItem SMTXtaurusRMLBAPs			endif		endif				set Testdone to 1	endif	end



3) three similar scripts for objects (for foot, lower body and upper body)
Spoiler
ScriptName SMTXMinotaurus2LowerBodySetScriptBegin OnEquip	set SMTXAppropriateLBodyObject to 1EndBegin OnUnEquip	set SMTXAppropriateLBodyObject to 0End


4) Script for "arena armor"
Spoiler
Scriptname SMTXMinotaurusArenaRaimentScriptBegin OnEquip Player	set ICArenaMatchGateRef.WearingArmor to 1	set SMTXAppropriateLBodyObject to 1	set SMTXAppropriateUBodyObject to 1EndBegin OnUnequip Player	set ICArenaMatchGateRef.WearingArmor to 0	set ICArenaRedRoomGateRef.WearingArmor to 0	set SMTXAppropriateLBodyObject to 0	set SMTXAppropriateUBodyObject to 0End


But still I feel that the system is lacking something essential ...
User avatar
James Smart
 
Posts: 3362
Joined: Sun Nov 04, 2007 7:49 pm

Post » Tue May 17, 2011 5:31 am

I do not know if anyone has solved a similar problem - solution used in plugin Scripted Argonian Feet is too complex and, in particular - use the fixed list of objects. I'm looking for an simpler and versatile solution...


I agree my approach in Scripted Argonian Feet is rather complex, especially since it's fairly out-dated nowadays and far inferior to its improved version used in my http://www.tesnexus.com/downloads/file.php?id=30094... but coming to think of it, even this one's fairly out-dated already...

...but my approach is "not" using a fixed list of objects ever. That would be contradictory to its purpose, universal applicability.
I'm working on this approach since 2 years... well, "was", until my laptop died and all modding got suspended until further notice (that is when I finally get some time to buy a new pc)... and was constantly improving it... and will be as soon as I can go on modding again.

The basic approach is to not allow unfitting items to be worn and to replace them with their fitting counterparts, if present. The emphasize here is on "present", as my scripts "look out" in the folder (incl. BSA archives) of the original NIF files for so-called "adapted" files. I devised a system to mark these with certain "tags" according to the system they're used in, so my scripts will recognize them and associate them with the items automatically. Once an adapted file is found, it will be used (maybe one will have to trigger an update-process due to my approach also using "generic placeholders" for items without fitting counterparts for the time being), no need ever to alter any scripts.

A simple example of what it does:
Let's assume there's an armor item ingame with a NIF file in "meshes/armor/honorguard/cuirass.nif". Now my scripts are told to search for adapted upperbody files by the tag "dcpart", as done in my Anthro-Dragon race. As soon as this item gets equipped by an actor of the special race, the scripts search for "meshes/armor/honorguard/cuirass_dcpart.nif" and if found, replace the visuals (stats and such are preserved) of the item ingame with this mesh.
In case there is no "cuirass_dcpart.nif" and my scripts are configured not to allow unfitting upperbody items the visuals of the item will instead be replaced by a generic placeholder, also configured in the initialization part for the race in question. This "replacer template" is intended to become a rather complex system of anolysing armor-class (or clothing), value, weight, or whatever of the item equipped and take this into consideration for what replacer template's visuals to use for the time being, until a real adapted mesh gets added into your folders.

The only things "fix" in my approach are the files to be used when nothing is worn (1 for each body part, just like Vanilla, or more, that is, when using a race able to do partial shape shifting), and even those are configured in the initialization part for the race in question. The scripting approach used in my Anthro-Dragon race can control multiple different races at once, and one can use more than one mod using my scripting approach at the same time as well.

But it indeed is rather complex, and not at all free of bugs or flaws or even completely working as intended yet. I had to do an emergency release when my laptop was on the verge of dying or loose all my files forever. So they're by no means finished up as I'd like them to be yet.
I'm so thriving to go on with it and finally finish them up to a state I can be satisfied with... but that's not going to happen soon I'm afraid.


One major point I stumbled across and what your scripts are lacking though is using the function GetEquipmentSlotMask instead of GetEquippedObject.
With GetEquippedObject you'll have to make a direct match for slot-combination (and still not all arbitrary combinations are possible to cover). If you use it with the parameter for lowerbody and the item you're wearing also covers your feet, you will not receive a usable value. If you use GetEquipmentSlotMask with the mask for only lowerbody though, you will receive the base-id of any item you're wearing that is covering the legs, if it's occupying other slots as well or not.

Also keep in mind using the old functions EquipItem and UnequipItem UnequipItem will very well trigger the OnUnequip blocks, but EquipItem will "not" trigger the OnEquip blocks.
Your scripts for the Arena Raiments for example will lead you to loose the flag ICArenaMatchGateRef.WearingArmor when your scripts unequip unfitting Arena Armor, but you will "not" get it back when your scripts equip fitting Arena Armor afterwards.
I had to alter the Vanilla scripts for detecting Arena Armors myself so they set this flag different ways and not via OnEquip and OnUnequip.
Nowadays though one can easily use the new Equip/Unequip functions from one of the latest OBSE releases instead, with telling them to explicitly trigger those blocks.

Just something important to keep in mind, as I myself ran into a lot of trouble due to not knowing it at the start.

edit: You might want to take a look at those resources:
http://www.tesnexus.com/downloads/file.php?id=14326
http://www.tesnexus.com/downloads/file.php?id=33521

As far as I know they work by putting a script on all items one wants to be wearable and such, among other things,... so nothing I could use for my own purposes... but there might be something useful to your purpose. :shrug:
User avatar
Yama Pi
 
Posts: 3384
Joined: Wed Apr 18, 2007 3:51 am

Post » Tue May 17, 2011 11:38 am

Thank you for your clarification. I'll have to study your scripts and related system again - and carefully.
User avatar
Mr. Allen
 
Posts: 3327
Joined: Fri Oct 05, 2007 8:36 am


Return to IV - Oblivion