logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
How to Get ItemProperty String Description

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Ordoran



Joined: 10 Sep 2016
Posts: 2

PostPosted: Wed Sep 14, 2016 14:54    Post subject: How to Get ItemProperty String Description Reply with quote

Hi all,

For a first post on this forum, I have a simple question:
Is it possible to get a full item property description, without registering back all property cases (ie Alignement, damage type etc....)?

Currently, I can easily get the "first" part of the property description, using property const int, 2da file, and dialog.tlk text string.

But, for subtypes (specific damage for exemple), it start to be harder, as no 2da file exist (native file), or i missed something.

Final purpose of this is a auction house for players, with both IG/Forum interface, allowing multilingual (based on dialog.tlk).

Il will appreciate any idea,
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Wed Sep 14, 2016 17:15    Post subject: Reply with quote

Code:
string GetItemPropertyString( itemproperty IP ){

    int nType = GetItemPropertyType( IP );
    string sName = GetStringByStrRef( StringToInt( Get2DAString( "ItemPropDef", "Name", nType ) ), GENDER_BOTH );
    string sSub = Get2DAString( "ItemPropDef", "SubTypeResRef", nType );
    int nData;
    string sSep = ": ";

    if( sSub != "" ){

        nData = StringToInt( Get2DAString( sSub, "Name", GetItemPropertySubType( IP ) ) );
        if( nData > 0 ){
            sName = sName + sSep + GetStringByStrRef( nData, GENDER_BOTH );
            sSep = " ";
        }
    }

    sSub = Get2DAString( "iprp_costtable", "Name", GetItemPropertyCostTable( IP ) );

    if( sSub != "" ){

        nData = StringToInt( Get2DAString( sSub, "Name", GetItemPropertyCostTableValue( IP ) ) );
        if( nData > 0 )
            sName = sName + sSep + GetStringByStrRef( nData, GENDER_BOTH );
    }

    int nParm = GetItemPropertyParam1( IP );

    if( nParm < 0 ){
        sSub = Get2DAString( "ItemPropDef", "Param1ResRef", nType );
        if( sSub != "" )
            nParm = StringToInt( sSub );
        else
            nParm = StringToInt( Get2DAString( Get2DAString( "ItemPropDef", "SubTypeResRef", nType ), "Param1ResRef", GetItemPropertySubType( IP ) ) );
    }

    sSub = Get2DAString( "iprp_paramtable", "TableResRef", nParm );

    if( sSub != "" ){

        nData = StringToInt( Get2DAString( sSub, "Name", GetItemPropertyParam1Value( IP ) ) );
        if( nData > 0 )
            sName = sName + sSep + GetStringByStrRef( nData, GENDER_BOTH );
    }

    return sName;
}

_________________
I dun have any signature, I'm happy anyway.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Ordoran



Joined: 10 Sep 2016
Posts: 2

PostPosted: Wed Sep 14, 2016 17:24    Post subject: Reply with quote

Thanks for the script, that save me some hours.

After investigation, I was missing a few 2da files.. Embarassed

I've find them on the neverwintervault.org.

Thanks again
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group