Help with GetModelPath

Post » Thu Aug 25, 2011 9:39 pm

Hi! I was working a on a little mod, when I ran into some trouble with the GetModelPath function from OBSE. Here is a script I used for testing the GetModelPath function:

scriptname aabdgetArmorTargetref targetref tempmodelstring_var tmppathbegin gamemode	set target to GetCrosshairRef		set tempmodel to target.GetBaseObject 	set tmppath to GetModelPath tempmodel	MessageEx "test:%z" tmppathend


This works largely as expected, popping up a message with the model path - except when the target is a piece of armour (which, of course, is the only one I want it to work on! dc:). When armour is the target the path is empty - if you use a message box with no other text/variables it says 'default message text' or something to that nature. Any ideas on why this does not show the model path for armour? Help greatly appreciated! (c:
User avatar
jessica robson
 
Posts: 3436
Joined: Mon Oct 09, 2006 11:54 am

Post » Thu Aug 25, 2011 11:40 pm

How is the script triggered?
User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Thu Aug 25, 2011 11:44 pm

I think you need to use GetBipedModelPath for armor, since they have different path for male and female models. The same is true for clothing. So if you want general code, try something like:

ref targetref tempmodelstring_var tmppathshort typebegin gamemode        set target to GetCrosshairRef           set tempmodel to target.GetBaseObject 		set type to GetObjectType tempmodel		if type == 20 || type == 22			set tmppath to GetBipedModelPath 0 tempmodel		else			set tmppath to GetModelPath tempmodel		endif        MessageEx "test:%z" tmppathend

0 in GetBipedModelPath gives you the male model. You may want to change that, or even check which models it has (IsBipedModelPathValid) before asking for the valid one.
User avatar
Heather Kush
 
Posts: 3456
Joined: Tue Jun 05, 2007 10:05 pm

Post » Thu Aug 25, 2011 10:22 pm

I think you need to use GetBipedModelPath for armor, since they have different path for male and female models. The same is true for clothing. So if you want general code, try something like:
(snip)


Thanks! Works a charm! Love your mods by the way! (c:
User avatar
Lloyd Muldowney
 
Posts: 3497
Joined: Wed May 23, 2007 2:08 pm


Return to IV - Oblivion