View previous topic :: View next topic |
Author |
Message |
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Sun Jan 26, 2014 0:24 Post subject: Placeable appearance |
|
|
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 |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Sun Jan 26, 2014 14:40 Post subject: |
|
|
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 |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Sun Jan 26, 2014 20:56 Post subject: |
|
|
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 |
|
|
Baaleos
Joined: 02 Sep 2007 Posts: 830
|
Posted: Sun Jan 26, 2014 22:43 Post subject: |
|
|
can you share your c++ code?
It will help us debug your issue. |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Sun Jan 26, 2014 23:31 Post subject: |
|
|
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 |
|
|
virusman
Joined: 30 Jan 2005 Posts: 1020 Location: Russia
|
Posted: Mon Jan 27, 2014 17:53 Post subject: |
|
|
Use %hd instead of %d _________________ In Soviet Russia, NWN plays you! |
|
Back to top |
|
|
Ravine
Joined: 26 Jul 2006 Posts: 105
|
Posted: Mon Jan 27, 2014 21:09 Post subject: |
|
|
virusman wrote: | Use %hd instead of %d |
Not so surprisingly, that works Thx virusman! |
|
Back to top |
|
|
|