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 
 
Placeable appearance

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



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Jan 26, 2014 0:24    Post subject: Placeable appearance Reply with quote

Hi,

i'm making a player-housing system on my pw. I know about the SetPlaceableAppearance function in nwnx_funcs, and that is working great. But later i realized (and shocked) that there is no GetPlaceableAppearance function anywhere... is there any way to get that number somehow?

thx
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Jan 26, 2014 14:40    Post subject: Reply with quote

Doh, i started to tinker with the code. I've added the GetPlaceableAppearance function to the nwnx_funcs, cmakelists, headers, and the nss. It works ...almost. Most of the time the number i get is too big. Like the CEP logo for example: 83889088. On lower bits it's okay, but there are some 'unneeded ones' on the higher bits.
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Jan 26, 2014 20:56    Post subject: Reply with quote

Ok i give up, something wrong with this, i can't figure out it's behavior. The integer i get by checking a placeable's appearance changes over module reload, and i get different numbers with same placeable-appearances.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Jan 26, 2014 22:43    Post subject: Reply with quote

can you share your c++ code?
It will help us debug your issue.
Back to top
View user's profile Send private message
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Sun Jan 26, 2014 23:31    Post subject: Reply with quote

Yeah, but almost same az SetPlaceableAppearance:
Code:
#include "NWNXFuncs.h"


void Func_GetPlaceableAppearance (CGameObject *ob, char *value) {
    CNWSPlaceable *plc;

    if (ob == NULL                                     ||
        (plc = ob->vtable->AsNWSPlaceable(ob)) == NULL ){

        snprintf(value, strlen(value), "-1");
        return;
    }
    snprintf(value, strlen(value), "%d", plc->plc_appearance);
}


Calling it from nwscript:
Code:
int GetPlaceableAppearance (object oPlace) {
    return  NWNXFuncsZero(oPlace, "NWNX!FUNCS!GETPLACEABLEAPPEARANCE");
}


But i've dropped this idea, i'm now using a string-tokenizer with placeable-codes and SetPlaceableAppearance, which works. So it's not needed anymore.
Back to top
View user's profile Send private message
virusman



Joined: 30 Jan 2005
Posts: 1020
Location: Russia

PostPosted: Mon Jan 27, 2014 17:53    Post subject: Reply with quote

Use %hd instead of %d
_________________
In Soviet Russia, NWN plays you!
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Ravine



Joined: 26 Jul 2006
Posts: 105

PostPosted: Mon Jan 27, 2014 21:09    Post subject: Reply with quote

virusman wrote:
Use %hd instead of %d


Not so surprisingly, that works Smile Thx virusman!
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