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 ... 9, 10, 11 ... 27, 28, 29  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Fri Jun 18, 2010 14:59    Post subject: Reply with quote

No need to apologize. You have contributed more than I have. If bug hunting helps you create better releases then I'm all for it, I was a software tester for 5 years afterall. Lol
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sat Jun 19, 2010 2:56    Post subject: Reply with quote

Just to add my 2c...
I thought MAXHITPOINTS was a calculation (not a value you could set)
Creatures
Quote:

3.4.2. MaxHitPoints
Maximum Hit Points, after considering all bonuses and penalties.
Example: Suppose that the level 5 Barbarian in the example above has a constitution of 16, but has
no active feats or effects that raise hit points. It then has a +3 modifier due to constitution.
Multiplying that by 5 levels gives +15 HP, for a MaxHitPoints of 38 + 15 = 53.
Example2: Suppose we have a level 3 elven Commoner that rolled 1, 1, 1 for hit points. The
Commoner has Constitution 8, adjusted down to 6 for being an elf, for a resulting -2 ability
modifier. This creature's HitPoints are 3, but its MaxHitPoints are also 3, because all creatures are
required to have a minimum of 1 hit point per level, even if ability modifiers would normally
result in less.


So while the value is get;set; in the BIC - it is based on a formula(method) - not an int value. (this may be causing the problem)
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sat Jun 19, 2010 22:43    Post subject: Tried to post this the other night, but my iPhone was being Reply with quote

Tried to post this the other night, but my iPhone was being a *********


Anyway...
Im fairly sure that MaxHP can be set statically.

I cant remember for sure, but I would say that 'possibly' Higher Ground Leveling System was able to set max hp via letoscript.

After all, what is the point of gaining levels 41 - 60, without gaining extra HP. Would introduce a bit of an imbalance.

If Letoscript was capable of doing it, then memory editing should be able to accomplish the same thing, after all, all it is doing, is fooling the game into introducing the changes for us.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sun Jun 20, 2010 1:57    Post subject: Reply with quote

Just doing a quick google...
Looks like the Leto MaxHP only makes sure that the PC gets Maximum HP (per level) -- i.e. On each Level-up the 'hd-roll' is maximized.
MaxHP (the value) is calculated from the accumulation of all the rolls, plus any bonuses. <not sure if equipment bonuses are included in this calculation or not>
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Jun 20, 2010 2:06    Post subject: If so Reply with quote

If it is an accumulation, then it possibly adds the hitdice gained in the lvlstatlist.

Eg -
Level 1 - 9 hit points
Level 2 - +5
Level 3 - +3


Meaning at level 3 we have 9+5+3 including any bonuses from con etc.

I just opened up leto 1-69

This is what it says about the lvlstatlist hitdice

How many additional Hit Points (HP) a character gained at a particular level. This value can range from 1 - 255 per level.
This value must be changed to increase or decrease a character's total HP; changing the values of other HP-related entries will have no effect.

I think the MaxHitDice that is stored elsewhere, is JUST the max hitdice that the Player had at the time of saving.

The game probably stores this value statically, just so it doesnt have to go through the trouble of adding up all your hitdice from previous levels for the character select screen.


This poses a problem indeed.

Means that if I am making a custom leveling system, where I am kept at level 1, but gain pseudo levels, then the max I can give my players is +255 hp on Level 1.

Unless The nwnx_funcs method for setting hitdice on specific level, will add the values in, dispite me being level 1.

Calls for some testing.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Jun 20, 2010 2:26    Post subject: Tested Reply with quote

I was able to use a simple chat function to give me the ability to add to my max hp.

Code:

if(GetStringLeft(sChatLower,3) == "+hp")
    {
     //Get the name from the right of the string
     int iLength = GetStringLength(sChatLower);
     iLength = iLength -4;
     int iLevel = StringToInt(GetStringRight(sChatLower,iLength));
     //Try to add +10 hp for that specific level
     SendMessageToPC(oPC,"Gaining +10 at level:"+IntToString(iLevel));
     NWNXFuncs_ModHitPointsByLevel(oPC,10,iLevel);
    }



Good news is - Yes, you can modify your lvlstatlist for level 1. But thats all you can do until you reach level 2, at which point you can modify your lvlstatlist for level 2 in addition to what you have in level 1.


My results were as follows

I spoke
+hp 1 (to give me +10 hp for level 1)

Result = I gained +10 Max Hp

I spoke it again

+hp 1

And I gained an extra 10.


I then tried +hp 2

Result: Server Crashed.

It will crash if you attempt to add hp to a level you do not possess.

Meaning, the max HP Attainable per level, is 256 or was it 255?? (if we believe what the leto says).

Meaning 256 x 40 = 10240 max possible hp attainable via this nwnx method.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Sun Jun 20, 2010 2:29    Post subject: Just tested more Reply with quote

More testing reveals that yes... if you attempt to add more than 255 hp to a lvlstatlist hitdice value, it will roll over.

I increased mine by doing about 26 clicks of a macro +hp 1 and the result was me reverting from 267 hp, back down to 17 or something.

Tried the SetHPGainedAt Level equivelant too.

Causes a crash if you try to set hp gained for a level you dont have.
Also does not allow setting of values over 255. My test was to raise from 17 hp, to 300, it raised me to 53, Im guessing it went to 255, or 256, and then rolled back to 50ish.
Back to top
View user's profile Send private message
Fireboar



Joined: 17 Feb 2008
Posts: 323

PostPosted: Sun Jun 20, 2010 19:39    Post subject: Reply with quote

Modifying HP at a level higher than you would crash the server because it's trying to set a key to a value that relies on the key existing in the first place (which it doesn't until you reach the given level). Some safety check seems in order here.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Mon Jun 21, 2010 9:57    Post subject: Reply with quote

And don't forget, you can have different HitDie for each level.
This could affect what you're trying to achieve as well.
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Mon Jun 21, 2010 16:38    Post subject: another trial Reply with quote

Just tried the SetClassLevelByPosition etc method.

It does warn against attempting to raise levels via this method, because it will crash server if it tries to raise the level.

It does successfully raise the level of the player, while successfully skipping the levelup screen.

Of course the crash itself happens at the 'ExportCharacter' function call.

Meaning that the saving of the character crashes the server.
When examining the error in detail, the error actually occurs in nwnserver.exe not in the module/plugin.

This suggests that the server crashed because it didnt have the full information, eg - the arraylist for level 2 didnt exist, but since our level said we were level 2, the server hiccuped because it couldnt find it.


Possible resolution?

How about modifying the Method in the funcs dll, to add the lvlstatlist entry for the level that the player is gaining?

Eg - Request to set level to 4, some validation to check if the lvlstatlist for level 4 exists, if yes - set the level - this shouldnt cause a crash.
if no - Add some generic entries into the lvlstatlist, just as placeholders.

In theory, if the 'objects' exist in the lvlstatlist, when it tries to export, then it should prevent the server from crashing.

In theory.

If this could be made to allow raising of level, while bypassing the levelup screen, it would be a powerful tool.
Would allow me to have access to the hitdice on each of the levelstatlist entries, opposed to just 1.
Back to top
View user's profile Send private message
xardex



Joined: 02 Mar 2010
Posts: 40

PostPosted: Tue Jun 22, 2010 16:01    Post subject: Re: another trial Reply with quote

Baaleos wrote:
Just tried the SetClassLevelByPosition etc method.

It does warn against attempting to raise levels via this method, because it will crash server if it tries to raise the level.

...

Of course the crash itself happens at the 'ExportCharacter' function call.

...


You just saved me from the hell that is letoscript.

Code:
#include "nwnx_funcs"

void main()
{
    object oPC = GetLastPCRested();
    effect eF = ExtraordinaryEffect(EffectModifyAttacks(1));
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eF, oPC);
    NWNXFuncs_RemoveAllFeats(oPC);
    NWNXFuncs_SetAllSkillsToZero(oPC);
    NWNXFuncs_AddFeat(oPC, FEAT_EPIC_DODGE);
    NWNXFuncs_SetClassByPosition(oPC, 1, CLASS_TYPE_DRUID);
    NWNXFuncs_ModSkill(oPC, SKILL_DISCIPLINE, 30);
    NWNXFuncs_ModHitPointsByLevel(oPC, 66, 1);
    NWNXFuncs_SetAbilityScore(oPC, ABILITY_STRENGTH, 66);
    NWNXFuncs_SetCurrentHitPoints(oPC, 6);
    ExportSingleCharacter(oPC);
}


Works exactly as it should on my vista 64bit.
No crash even if done multiple times, no crash when exporting, no crash when logging off. No crash at all! Very Happy
Finally I can press that tempting "Delete" button on the dreadful letoscript! Twisted Evil
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Tue Jun 22, 2010 22:52    Post subject: Promising function Reply with quote

One of the reasons that the SetLevelByPosition crashes when putting to a level higher than your own, is because it skips the process of building the lvlstatlist. (in my opinion)


However, I just stumbled onto a few functions here, which 'may' be of use.

LevelDown@CNWSCreatureStats
LevelUp@CNWSCreatureStats
LevelUpAutomatic@CNWSCreatureStats

The levelup method seems to take a lvlstatlist object as an input, and then performs all the necessary functions on it, to create a genuine levelup process. - Note I havent tested it, mainly for lack of knowledge how to impliment it. Ive only managed to hook functions so far.

The LevelUp, and LevelDown are probably as expected, give and take xp.

Im hoping that LevelUpAutomatic might be something spectacular, allowing instant levelups, without the need for a player to level up manually.
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Wed Jun 23, 2010 10:36    Post subject: Re: Promising function Reply with quote

Baaleos wrote:
One of the reasons that the SetLevelByPosition crashes when putting to a level higher than your own, is because it skips the process of building the lvlstatlist. (in my opinion)


However, I just stumbled onto a few functions here, which 'may' be of use.

LevelDown@CNWSCreatureStats
LevelUp@CNWSCreatureStats
LevelUpAutomatic@CNWSCreatureStats

The levelup method seems to take a lvlstatlist object as an input, and then performs all the necessary functions on it, to create a genuine levelup process. - Note I havent tested it, mainly for lack of knowledge how to impliment it. Ive only managed to hook functions so far.

The LevelUp, and LevelDown are probably as expected, give and take xp.

Im hoping that LevelUpAutomatic might be something spectacular, allowing instant levelups, without the need for a player to level up manually.

Wouldn't LevelUpAutomatic@CNWSCreatureStats relate to NPC's (etc) that use 'packages' to determine what choices to make for each LevelUp?
Back to top
View user's profile Send private message
Baaleos



Joined: 02 Sep 2007
Posts: 830

PostPosted: Wed Jun 23, 2010 11:42    Post subject: Ah Reply with quote

Ah...yeah.
I just checked, the
The VirtualMachine Command for LevelupHenchmen does call that levelup automatic function.

Guess it would have been too much to expect for an auto level function to be available for players. Lol
Back to top
View user's profile Send private message
Terra_777



Joined: 27 Jun 2008
Posts: 216
Location: Sweden

PostPosted: Wed Jun 23, 2010 13:31    Post subject: Reply with quote

You can level up a PC using the AutoLevelUp ingame function and then set the level to its correct parameters using nwnx_funcs. Very Happy
_________________
I dun have any signature, I'm happy anyway.
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 ... 9, 10, 11 ... 27, 28, 29  Next
Page 10 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