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 
 
nwnx_funcs for windows
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 27, 28, 29  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Balanor



Joined: 13 Jun 2005
Posts: 29

PostPosted: Fri Aug 06, 2010 3:51    Post subject: Reply with quote

Well, for right now I'm just trying to get it to work so I have that script on a generic trigger's OnEnter event. I run across the trigger with my test PCs (the true goal is to get this to work on NPCs though), and for both of my debug lines in the little script, it returns 0 as the soudset ID.

Here's what I get in the log:
Code:

Windows NWNX Funcs plugin v.0.0.8.2 [log level: 3]
* CreateLookupTable
* CreateNewGeometry hooked
- StrReq: "GETSOUNDSETID"           Params: "-"
- StrReq: "SETSOUNDSETID"           Params: "241"
- StrReq: "GETSOUNDSETID"           Params: "-"


After I run through the trigger with a PC, it does not have any soudset.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Aug 06, 2010 3:59    Post subject: Reply with quote

Hmm, the plugin is definetly receiving the argument, which suggests that it might be a case that the CNWSCreature struct layout might be incorrect?

Code:

uint16_t                          cre_soundset;                    /* 0x0ADC */


This is the memory location for the Soundset within a creature object, but I have no expertese with mapping of structures, so I have no idea of verifying this data.

The odd thing however, is that the GetSoundSet function, uses this same memory address, for reading the soundset.

Code:

int CNWNXFuncs::GetSoundSetID() {
      sprintf(Params, "-1");
   if (!GetIsCreature()) {
      _log(2, "o Error: GetSoundSetID used on non-creature object.\n");
      sprintf(Params, "-1");
      return 0;
   }

   int iSoundSetID = ((CNWSCreature*)oObject)->cre_soundset;
   sprintf(Params, "%d", iSoundSetID);

   return 1;
}


Im gonna suggest something profound here.


Attempt the following.

Change PC Voiceset,
Log off,
Log in,
and see if the voiceset changed at all.


Voicesets were one of the things that Letoscript was originally needed for, and this was only usable when a player / creature, was offline, and not in use.

Some nwnx_funcs functions only take effect once a creature object has been refreshed etc, eg - Race Changes only take effect after you apply a polymorph effect for a second or so etc.
Back to top
View user's profile Send private message
Gperinazzo



Joined: 31 Jul 2010
Posts: 9

PostPosted: Fri Aug 06, 2010 5:11    Post subject: Reply with quote

MaxRock wrote:
Already working on it.

Problem seems to be that there's actually not one memory location that can be changed but instead it calculated on serveral occasions.

My approach so far is to have a local var on the armor that overrides the regular max dex bonus value.
I've hooked GetDexMod with the result that it now subtracts MaxDexBonus from the regular Dex Bonus instead of limiting it Confused


Well, can you do it by changing the item? Like the SetWeight one.
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Fri Aug 06, 2010 19:24    Post subject: Reply with quote

SetSoundset
Seems indeed broken at least it didn't do anthing for me.
I'm also fairly sure that once it's working it will require a relog.

Max Dex Bonus
There's unfortunately not a "field" on the item itself. The value is read from (a cached) armor.2da every time a piece of armor is equipped.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Gperinazzo



Joined: 31 Jul 2010
Posts: 9

PostPosted: Sat Aug 07, 2010 3:20    Post subject: Reply with quote

MaxRock wrote:
Max Dex Bonus
There's unfortunately not a "field" on the item itself. The value is read from (a cached) armor.2da every time a piece of armor is equipped.


What value does it use to get the penalty?
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sat Aug 07, 2010 3:25    Post subject: Reply with quote

The DEXBONUS column

armor.2da
Code:

2DA V2.0

          ACBONUS    DEXBONUS   ACCHECK    ARCANEFAILURE%      WEIGHT    COST      DESCRIPTIONS   BASEITEMSTATREF

0          0          100        0          0                   10        1            1727       5411
1          1          8          0          5                   50        5            1728       5432
2          2          6          0          10                  100       10           1729       5435
3          3          4          -1         20                  150       15           1730       5436
4          4          4          -2         20                  300       100          1731       5437
5          5          2          -5         30                  400       150          1732       5438
6          6          1          -7         40                  450       200          1733       5439
7          7          1          -7         40                  500       600          1734       5440
8          8          1          -8         45                  500       1500         1736       5441
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Gperinazzo



Joined: 31 Jul 2010
Posts: 9

PostPosted: Sat Aug 07, 2010 7:24    Post subject: Reply with quote

I mean, given an armor A, how does the game know what line from the armor.2da A is related to?
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Sat Aug 07, 2010 19:47    Post subject: Reply with quote

Oh... It goes as follows:
In parts_chest.2da get the ACBONUS from the armor's chest part (row). If the ACBONUS is a fraction round mathematically (>= .5 up, otherwise down).

That number is the row in armor.2da; and the base AC of the armor, unless armor.2da was modified.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Greyfort



Joined: 20 Jul 2010
Posts: 66

PostPosted: Sun Aug 08, 2010 21:06    Post subject: Reply with quote

I used NWNXFuncs_SetAbilityScore ability and NWNXFuncs_ModAbilityScore The down side was with strength no increase wieght holding.
To get idea of what im trying to do is...PC levels very hard to get pc awarded base ability if quest/rp.

is there a core nwn file i must change so when pc gets abilty base up it reads corectly ?

forgive my messy post,

Greyfort
Back to top
View user's profile Send private message
Gperinazzo



Joined: 31 Jul 2010
Posts: 9

PostPosted: Sun Aug 08, 2010 22:05    Post subject: Reply with quote

Try equiping a item.
This will update the weight in the inventory screen.
The screen is a lie.
Working fine here.

So the only way to change the max dex bonus is by changing the chest from the armor and reequiping it? Well, for what i need i can do that.
Back to top
View user's profile Send private message
Balanor



Joined: 13 Jun 2005
Posts: 29

PostPosted: Sun Aug 08, 2010 23:37    Post subject: Reply with quote

MaxRock wrote:
SetSoundset
Seems indeed broken at least it didn't do anthing for me.
I'm also fairly sure that once it's working it will require a relog.


Thanks for checking on that Max. I did trying logging and and logging out, but the voiceset as it stands right now always remains blank.

I've also been trying to use the NWNXFuncs_SetMaxHitPoints function in my trigger to modify a PCs maximum hit points, and it does not appear to do anything. I went to your manual and saw that the Max Hit Points function is 'Not functional as Maximum Hit Points seem to be calculated on login'.

Is there any potential workaround to this, or could this potentially be worked out at a later date?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Aug 09, 2010 0:01    Post subject: Reply with quote

Hey, got problem, trap geometry do not work at all. Using latest precompiled dll from sourcepage, geometry functions do just 2.0 square...

I tried your trap_example run as DM, got two trap squares under object run that script.

nwnx_funcs log:
Code:

Windows NWNX Funcs plugin v.0.0.8.2 [log level: 3]
* CreateLookupTable
- StrReq: "GETTRIGGERGEOMETRY"           Params: "---------------------------------------------------------------------------------
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
---------------------"
Verts: 4
- StrReq: "SETCUSTOMGEOMETRY"           Params: "0¬21.028¬32.369¬21.897¬32.603¬20.105¬37.336¬"
coordinates valid
- StrReq: "SETCUSTOMGEOMETRY"           Params: "0¬      -2.500000000¬      -7.789999962¬     -10.680000305¬      -7.759999752¬      -4.050000191¬     -12.550000191¬      -6.599999905¬     -20.319999695¬       0.000000000¬     -15.489999771¬       6.599999905¬     -20.319999695¬       4.050000191¬     -12.550000191¬      10.680000305¬      -7.759999752¬       2.500000000¬      -7.789999962¬"
coordinates valid
- StrReq: "SETCUSTOMGEOMETRY"           Params: "0¬      -2.500000000¬      -7.789999962¬     -10.680000305¬      -7.759999752¬      -4.050000191¬     -12.550000191¬      -6.599999905¬     -20.319999695¬       0.000000000¬     -15.489999771¬       6.599999905¬     -20.319999695¬       4.050000191¬     -12.550000191¬      10.680000305¬      -7.759999752¬       2.500000000¬      -7.789999962¬"
coordinates valid
- StrReq: "ROTATECUSTOMGEOMETRY"           Params: "     180.000000000"
o Shutting down
(first two logs will be from my script, rest from trap_example)

my trap (re)spawn script (only partial):
Code:

string sGeometry = NWNXFuncs_GetTrapGeometry(oSelf);
DelayCommand(0.2,respawn(oSelf,sGeometry,nTrap));

//note oSelf is non-trap trigger

//and respawn function
void respawn(object oSelf, string sGeometry, int nTrap)
{
vector v;
int iP = FindSubString(sGeometry, "¬");
int iStart = 0;
v.x = StringToFloat(GetSubString(sGeometry, iStart, iP));
iStart = iP+1; iP = FindSubString(sGeometry, "¬", iStart);
v.y = StringToFloat(GetSubString(sGeometry, iStart, iP));
// and then we remove them from the list
sGeometry = GetSubString(sGeometry, iP+1, GetStringLength(sGeometry)-(iP+1));
PrintString(FloatToString(v.x)+FloatToString(v.y));
PrintString(sGeometry);
location l = Location(GetArea(oSelf),v,0.0);
NWNXFuncs_SetCustomTrapGeometry(sGeometry);
object oTrap = CreateTrapAtLocation(nTrap,l,1.0,"",STANDARD_FACTION_HOSTILE,"sh_trap_disarm","sh_trap_trigger");

_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Aug 09, 2010 3:16    Post subject: Reply with quote

Hmm... I used to have a readme.txt that explained the ini settings but I can't find it anymore. grrr.

put this
Code:

HOOK_CustomTrapGeometry=1

in nwnx.ini under [FUNCS]

The log file should say "* CreateNewGeometry hooked" and it should work.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Aug 09, 2010 7:58    Post subject: Reply with quote

MaxRock wrote:
Hmm... I used to have a readme.txt that explained the ini settings but I can't find it anymore. grrr.

put this
Code:

HOOK_CustomTrapGeometry=1

in nwnx.ini under [FUNCS]

The log file should say "* CreateNewGeometry hooked" and it should work.
DOH!

anyway te code didnt worked until I changed it to simple this

Code:
string sGeometry = NWNXFuncs_GetTrapGeometry(oSelf);
DelayCommand(0.2,respawn(oSelf,sGeometry,nTrap));

//note oSelf is non-trap trigger

//and respawn function
void respawn(object oSelf, string sGeometry, int nTrap)
{
NWNXFuncs_SetCustomTrapGeometry(sGeometry,TRUE);
object oTrap = CreateTrapAtLocation(nTrap,GetLocation(oSelf),1.0,"",STANDARD_FACTION_HOSTILE,"sh_trap_disarm","sh_trap_trigger");
Thanks a lot, wonderfull function for my respawning static traps.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
MaxRock



Joined: 24 Jan 2008
Posts: 196

PostPosted: Mon Aug 09, 2010 10:02    Post subject: Reply with quote

There's a small problem in that the disarm script does not fire when the trap is recovered.
SetTrapRecoverable can take care of this but I can't seem to find the switch for this in the toolset.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development All times are GMT + 2 Hours
Goto page Previous  1, 2, 3 ... 15, 16, 17 ... 27, 28, 29  Next
Page 16 of 29

 
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