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 
 
Functions: Get/SetBodypart() with 1.66
Goto page 1, 2  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Thu Jul 07, 2005 11:09    Post subject: Functions: Get/SetBodypart() with 1.66 Reply with quote

It seems that 1.66 changed something about the bodypart offsets. A script, that I used to force-attach wings to RDDs>lvl 9 stopped working correctly after the update.

Any suggestions?
Back to top
View user's profile Send private message
Vladiat0r



Joined: 17 Jun 2005
Posts: 25

PostPosted: Thu Jul 07, 2005 11:38    Post subject: Reply with quote

http://www.nwnx.org/phpBB2/viewtopic.php?p=2205

I think Bioware has removed the ability to change PC data in-memory, which is what SetBodyPart was doing. It seems this function still works for NPCs, just not PCs.
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Thu Jul 07, 2005 21:43    Post subject: Reply with quote

Quote:
Sent 07/07/05 19:11:48 (GMT) by Craig Welburn

Quote:
Sent 07/07/05 10:39:32 (GMT) by Senalaya

Hello Craig,

sorry for bothering you with a PM.
I have the impression, that with 1.66 you guys improved the protection of the player character's memory objects. Probably to restrict mem-edit based cheats and hacks on client for servervaults.

I used a serverbased NWNX fuction, to force wings on RDD players, who edited them out with Leto. You know, those who want the stats, but not the look. This doesn't work any longer with 1.66.

I don't critize this or would call this a broken fuctionality. I can rather understand it, if the reasoning is as I asume. I just would like you to confirm this, so that I don't waste too much time on trying to fix something, that can't be fixed.

Thanks in advance,
Michael


We did not make any changes with regards to RDD wings in the 1.66 update (or to the player's object in memory with regards to RDD wings).

If your NWNX stuff is no longer working for RDD wings, I suspect it is an unintended byproduct of some other change that we made. Possibly the addition of the new Get/SetFootStepType scripting commands have changed the format of the player update objects in memory (or possibly it was caused by some other change, although I'm not sure what that would have been).

Not sure how much help that is.
Craig.


Well, it seems I was totally wrong with my asumption, allthough it made sense to me. Razz
However, Craig's reply gives at least some hope for a solution.
Back to top
View user's profile Send private message
Dazzle



Joined: 29 Dec 2004
Posts: 19

PostPosted: Sat Jul 16, 2005 15:53    Post subject: Reply with quote

That's right, it's working again. After spending ages (About an hour) trying to find the new offset I was finally lucky.

The old info from my old topic:
Dazzle wrote:
Just a custom functions.dll I once compiled for my own use.

Contents:
void NWNX_SetGoldPieceValue(object oObject, int iValue);
void NWNX_SetTag(object oObject, string sValue);
string NWNX_GetDescription(object oObject);
void NWNX_SetDescription_(object oObject, string sValue);
void NWNX_SetName(object oObject, string sValue);
int NWNX_GetBodyPart(object oPlayer, int nPart);
void NWNX_SetBodyPart(object oPlayer, int nPart, int nType);

Credits go out to Isilweo for the SetName and SetDescription and the NWNX Team for the other functions.

These functions only work with the Windows version of NWNX. It has not been tested on Linux.


The new DLL can can be found here (I added the source too this time!).

For those wondering, the new offset is +12 bytes (I have no idea if I'm saying this correct, I'm a newbie programmer Razz )

Enjoy.

Edit: Rar file updated due to typo in the source causing GetBodyPart not to function.


Last edited by Dazzle on Sat Jul 16, 2005 20:37; edited 1 time in total
Back to top
View user's profile Send private message
Senalaya



Joined: 29 Dec 2004
Posts: 82
Location: Germany

PostPosted: Sat Jul 16, 2005 16:18    Post subject: Reply with quote

Thanks Dazzle.

The changes in 1.66 obviously moved the memory locations for the bodyparts 12 bytes off. The changed and recompiled DLL allows to get it back working without any script changes. Tested and implemented.
Back to top
View user's profile Send private message
Vladiat0r



Joined: 17 Jun 2005
Posts: 25

PostPosted: Sun Jul 17, 2005 17:14    Post subject: Reply with quote

Yeah, thanks alot. I tried using OBJDUMP to figure it out myself but somehow it didn't work... Anyway, I made the change on Linux and it worked. ^^ Kudos.
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Sun Jul 17, 2005 22:34    Post subject: Reply with quote

Thanx Dazzle!!! This is my favorite plugin Smile

Papillon? Could you post the new one, replacing the one that is already there?
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Jul 19, 2005 19:30    Post subject: Reply with quote

Done!
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
teleri



Joined: 28 Jan 2005
Posts: 21

PostPosted: Tue Jul 19, 2005 19:46    Post subject: Reply with quote

Vladiat0r wrote:
Yeah, thanks alot. I tried using OBJDUMP to figure it out myself but somehow it didn't work... Anyway, I made the change on Linux and it worked. ^^ Kudos.


Could you make the Linux updated version avalible?
Back to top
View user's profile Send private message
Vladiat0r



Joined: 17 Jun 2005
Posts: 25

PostPosted: Tue Jul 19, 2005 20:20    Post subject: Reply with quote

Papillon wrote:
Done!
I don't see any changes in the downloads. The windows download source doesn't even have the Get/SetBodyPart functions. :S

teleri wrote:
Vladiat0r wrote:
Yeah, thanks alot. I tried using OBJDUMP to figure it out myself but somehow it didn't work... Anyway, I made the change on Linux and it worked. ^^ Kudos.


Could you make the Linux updated version avalible?
The source is part of the Linux NWNX2 download. I just updated the offset used only in Set/GetBodyPart and recompiled with Redhat Linux on i386: http://www.antiworld.biz/downloads/nwnx_functions.rar
Back to top
View user's profile Send private message
knowj



Joined: 12 Aug 2005
Posts: 5

PostPosted: Fri Aug 12, 2005 17:41    Post subject: Reply with quote

Dazzle wrote:
That's right, it's working again. After spending ages (About an hour) trying to find the new offset I was finally lucky.

The old info from my old topic:
Dazzle wrote:
Just a custom functions.dll I once compiled for my own use.

Contents:
void NWNX_SetGoldPieceValue(object oObject, int iValue);
void NWNX_SetTag(object oObject, string sValue);
string NWNX_GetDescription(object oObject);
void NWNX_SetDescription_(object oObject, string sValue);
void NWNX_SetName(object oObject, string sValue);
int NWNX_GetBodyPart(object oPlayer, int nPart);
void NWNX_SetBodyPart(object oPlayer, int nPart, int nType);

Credits go out to Isilweo for the SetName and SetDescription and the NWNX Team for the other functions.

These functions only work with the Windows version of NWNX. It has not been tested on Linux.


The new DLL can can be found here (I added the source too this time!).

For those wondering, the new offset is +12 bytes (I have no idea if I'm saying this correct, I'm a newbie programmer Razz )

Enjoy.

Edit: Rar file updated due to typo in the source causing GetBodyPart not to function.


thanks dazzel it makes the wingery work but every time i exit the module/server it crashes the server application and when it reboots and i login the wings are gone.

anyone got a solution to this?

im using the wingtail module
Back to top
View user's profile Send private message
knowj



Joined: 12 Aug 2005
Posts: 5

PostPosted: Fri Aug 12, 2005 18:58    Post subject: Reply with quote

somone else has tried it as well on there windows pc and it crashes on them as well.

its fine if you logout without using the wingery but if you logout after using the wingery it crashes the server

i ran resman and got these

NWNX Resource Manager V.0.0.2.0
(c) 2005 by Ingmar Stieger (papillon@nwnx.org)
visit us at http://www.nwnx.org

* Resource source path is: scripts\
* Logfile maximum size limit is: 524288 bytes
* Log level: Resource Manager specific info will be logged.
* RetrieveResEntry hooked at 416980.
* DemandRes hooked at 416580.

o Skip - File not found: scripts\activate_include.ncs
o Skip - File not found: scripts\aps_include.ncs
o Skip - File not found: scripts\bodypart_inc.ncs
o Skip - File not found: scripts\designinclude.ncs
o Skip - File not found: scripts\elite_functions.ncs
o Skip - File not found: scripts\inc_nwnx_func.ncs
o Skip - File not found: scripts\x2_inc_craft.ncs
o Skip - File not found: scripts\plc_d07.pwk
o Skip - File not found: scripts\plc_x0_mss.pwk
o Skip - File not found: scripts\plc_x0_drt.pwk
o Skip - File not found: scripts\plc_x0_trk.pwk
o Skip - File not found: scripts\plc_x0_ivy.pwk
o Skip - File not found: scripts\plc_x0_rcr.pwk
o Skip - File not found: scripts\plc_x0_rg2.pwk
o Skip - File not found: scripts\plc_x0_cha.pwk
o Skip - File not found: scripts\plc_x0_scr.pwk
Back to top
View user's profile Send private message
Dazzle



Joined: 29 Dec 2004
Posts: 19

PostPosted: Fri Aug 12, 2005 21:04    Post subject: Reply with quote

Could you post the function the script uses to change the wing on the PC? Especially the one with the SetLocalString() function.
Back to top
View user's profile Send private message
knowj



Joined: 12 Aug 2005
Posts: 5

PostPosted: Fri Aug 12, 2005 21:07    Post subject: Reply with quote

Code:

const int NWNX_BODYPART_LOW = 3;
const int NWNX_BODYPART_GENDER = 3;
const int NWNX_BODYPART_COLOR_SKIN = 4;
const int NWNX_BODYPART_COLOR_HAIR = 5;
const int NWNX_BODYPART_COLOR_TATTOO_1 = 6;
const int NWNX_BODYPART_COLOR_TATTOO_2 = 7;
const int NWNX_BODYPART_FOOT_R = 8;
const int NWNX_BODYPART_FOOT_L = 9;
const int NWNX_BODYPART_SHIN_R = 10;
const int NWNX_BODYPART_SHIN_L = 11;
const int NWNX_BODYPART_THIGH_L = 12;
const int NWNX_BODYPART_THIGH_R = 13;
const int NWNX_BODYPART_PELVIS = 14;
const int NWNX_BODYPART_TORSO = 15;
const int NWNX_BODYPART_BELT = 16;
const int NWNX_BODYPART_NECK = 17;
const int NWNX_BODYPART_FOREARM_R = 18;
const int NWNX_BODYPART_FOREARM_L = 19;
const int NWNX_BODYPART_BICEP_R = 20;
const int NWNX_BODYPART_BICEP_L = 21;
const int NWNX_BODYPART_SHOULDER_R = 22;
const int NWNX_BODYPART_SHOULDER_L = 23;
const int NWNX_BODYPART_HAND_R = 24;
const int NWNX_BODYPART_HAND_L = 25;
const int NWNX_BODYPART_UNKNOWN = 26;
const int NWNX_BODYPART_HEAD = 27;
const int NWNX_BODYPART_TAIL = 28;
const int NWNX_BODYPART_WING = 29;
const int NWNX_BODYPART_HIGH = 29;

// Returns the byte value type stored for the part requested.
// Types are the corresponding 2DA index for that bodypart.
// It is strongly advised to use the NWNX_BODYPART constants
// instead of directly pluggin in the integer if and when the
// offset changes.
int GetBodyPart(object oTgt, int nPart);

// Changes the creature bodypart on dynamic models.
// Types are the corresponding 2DA index for that bodypart.
// It is strongly advised to use the NWNX_BODYPART constants
// instead of directly pluggin in the integer if and when the
// offset changes.
void SetBodyPart(object oTgt, int nPart, int nType);

int GetBodyPart(object oTgt, int nPart)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART",
        IntToString(nPart));
    string sType = GetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART");
    return StringToInt(sType);
}

void SetBodyPart(object oTgt, int nPart, int nType)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!SETBODYPART",
        IntToString(nPart)+"!"+IntToString(nType));
}

// Need to sync the engine to the client otherwise effects
// stack.  SetCreatureAppearanceType() can do this, but it
// must be a change and not application of their current type.
// Therefore we need a pair.  A delay of about 1.0 second seems
// to be the safe minium between them.

// Hide SetCreatureAppearanceType() effects with a flashy effect.
// You can also do this with Cutscene Invisibility applied before
// the first SCAT();


Code:

#include "aps_include"
#include "bodypart_inc"

void main()
{
object oPC = GetLastUsedBy();
   //this is to prevent the player from stuck as will_o_wisp if he double click on the pillar and/or due to lag
   if (GetLocalInt(oPC, "InUse") == 1)   return;

   SetLocalInt(oPC,"InUse",1);



    int nModP = GetLocalInt(OBJECT_SELF,"MODPART");
    int nPart = nModP?NWNX_BODYPART_WING:NWNX_BODYPART_TAIL;
    int nType = GetLocalInt(OBJECT_SELF,"MODTYPE");

    SetBodyPart(oPC,nPart,nType);

    FloatingTextStringOnCreature(
        "Setting "+IntToString(nPart)+" to "+IntToString(nType),
        oPC);

    // Add Persistent wings//
    if (nPart == 29)SetPersistentInt(oPC, "WingsModel", nType);
    if (nPart == 28)SetPersistentInt(oPC, "TailModel", nType);

    // Need to sync the engine to the client otherwise effects
    // stack.  SetCreatureAppearanceType() can do this, but it
    // must be a change and not application of their current type.
    // Therefore we need a pair.  A delay of about 1.0 second seems
    // to be the safe minium between them.

    // Hide SetCreatureAppearanceType() effects with a flashy effect.
    // You can also do this with Cutscene Invisibility applied before
    // the first SCAT();
    int nApp = GetAppearanceType(oPC);
    ApplyEffectToObject(DURATION_TYPE_TEMPORARY,
        EffectVisualEffect(VFX_FNF_STRIKE_HOLY), oPC, 1.5);
    SetCreatureAppearanceType(oPC,APPEARANCE_TYPE_WILL_O_WISP);
    DelayCommand(1.0,SetCreatureAppearanceType(oPC,nApp));

    DelayCommand(2.0,SetLocalInt(oPC,"InUse",0));
}
Back to top
View user's profile Send private message
Dazzle



Joined: 29 Dec 2004
Posts: 19

PostPosted: Fri Aug 12, 2005 21:16    Post subject: Reply with quote

Hmm.

Change these two functions:

Code:
int GetBodyPart(object oTgt, int nPart)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART",
        IntToString(nPart));
    string sType = GetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART");
    return StringToInt(sType);
}

void SetBodyPart(object oTgt, int nPart, int nType)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!SETBODYPART",
        IntToString(nPart)+"!"+IntToString(nType));
}


To:

Code:
int GetBodyPart(object oTgt, int nPart)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART",
        IntToString(nPart));
    string sType = GetLocalString(oTgt,"NWNX!FUNCTIONS!GETBODYPART");
    DeleteLocalString(oTgt, "NWNX!FUNCTIONS!GETBODYPART");
    return StringToInt(sType);
}

void SetBodyPart(object oTgt, int nPart, int nType)
{
    SetLocalString(oTgt,"NWNX!FUNCTIONS!SETBODYPART",
        IntToString(nPart)+"!"+IntToString(nType));
    DeleteLocalString(oTgt, "NWNX!FUNCTIONS!SETBODYPART");
}


It should be fixed now, I remember having the same issues, took me a while to figure it out.
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
Goto page 1, 2  Next
Page 1 of 2

 
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