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_Patch
Goto page Previous  1, 2, 3 ... 31, 32, 33 ... 42, 43, 44  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
Valbor



Joined: 26 Dec 2016
Posts: 145

PostPosted: Tue Sep 26, 2017 13:07    Post subject: Reply with quote

Please tell me how can i modify received damage in 70_mod_attacked or 70_mod_damaged? from physic attack. I put it in both scripts but nothing happens NWNXPatch_SetTotalDamageDealtByType(oAttacker, DAMAGE_TYPE_COLD, 1);
or can you show an example Smile
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Sep 26, 2017 13:28    Post subject: Reply with quote

Valbor wrote:
Please tell me how can i modify received damage in 70_mod_attacked or 70_mod_damaged? from physic attack. I put it in both scripts but nothing happens NWNXPatch_SetTotalDamageDealtByType(oAttacker, DAMAGE_TYPE_COLD, 1);
or can you show an example Smile

you can't

function NWNXPatch_SetTotalDamageDealtByType says it can only be used in 70_s2_specattk event

I already experimented with this functionality but I was only able to enable it for OnDamaged event triggered for player not for NPC which is not enough I suppose...

EDIT: option would be to use effects.2da enable 70:mod_effects for damage and do it there but then you wont know if the attack wass critical hit etc....
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Tue Sep 26, 2017 14:39    Post subject: Reply with quote

ShaDoOoW wrote:
Valbor wrote:
Please tell me how can i modify received damage in 70_mod_attacked or 70_mod_damaged? from physic attack. I put it in both scripts but nothing happens NWNXPatch_SetTotalDamageDealtByType(oAttacker, DAMAGE_TYPE_COLD, 1);
or can you show an example Smile

you can't

function NWNXPatch_SetTotalDamageDealtByType says it can only be used in 70_s2_specattk event

I already experimented with this functionality but I was only able to enable it for OnDamaged event triggered for player not for NPC which is not enough I suppose...

EDIT: option would be to use effects.2da enable 70:mod_effects for damage and do it there but then you wont know if the attack wass critical hit etc....


Even Baaleos's plugin doesn't accurately retrieve physical damage. Modifying damage in this game is so fucked XD.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Sep 26, 2017 16:04    Post subject: Reply with quote

highv priest wrote:
Even Baaleos's plugin doesn't accurately retrieve physical damage. Modifying damage in this game is so fucked XD.

Its complicated. There are two types of damage, combat and noncombat, each is handled differently, for example noncombat damage is already "processed" through damage immunities, resistances, reduction - thus damage you might want to add might not be accurate - you want to add 1 cold before it gets reduced by cold resistance which is not the case, thus adding this functionality into these events is not even worth it i think

and then there is a discrepacy between NPC OnDamaged event and PC (npc triggers after damage was done, PC before)

non-combat damage can be adjusted, doable from 70_mod_effects function TransferEffectValues
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Valbor



Joined: 26 Dec 2016
Posts: 145

PostPosted: Tue Sep 26, 2017 16:14    Post subject: Reply with quote

You will be able softcoded to the Defense Roll if it possible?
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Tue Sep 26, 2017 16:27    Post subject: Reply with quote

ShaDoOoW wrote:
highv priest wrote:
Even Baaleos's plugin doesn't accurately retrieve physical damage. Modifying damage in this game is so fucked XD.

Its complicated. There are two types of damage, combat and noncombat, each is handled differently, for example noncombat damage is already "processed" through damage immunities, resistances, reduction - thus damage you might want to add might not be accurate - you want to add 1 cold before it gets reduced by cold resistance which is not the case, thus adding this functionality into these events is not even worth it i think

and then there is a discrepacy between NPC OnDamaged event and PC (npc triggers after damage was done, PC before)

non-combat damage can be adjusted, doable from 70_mod_effects function TransferEffectValues


Is there really not just a core function somewhere that can be modified? Sneak attack has to be adding damage to some kind of integer before it's actually applied. Likewise the base damage on weapons has to be added somewhere.

There has to be some kind of function somewhere that is retrieving all of these variables in order to process them altogether instead of just applying them one at a time.

I don't know what it is in nwn, but literally every other game I've ever messed with damage that one function does exist.

On a further note! Baaleos's plugin is the opposite of what you said. When -combat damage- is being applied the damage immunities/resistances/reductions already happened. If -spell- damage(what I believe is non-combat by your definition) is applied then it is NOT already processed.

I came into this issue when I tried making acid spells give vulnerability to fire or cold(depending on RDD fire immune or not). The acid spells would always apply full vulnerability even if some of the damage was resisted.

This is why I mentioned it's fucked. Even your statements do not match with results from Baaleos's plugin.

EDIT = Baaleos had modified effect damage if it helps you any. There is 2 different ones in his system CreatureDoDamage and EffectDamage and he chose the latter. Since his hook does apply for combat and non-combat it can be inferred that nwn is processing effectdamage for both, but the physical part of the damage is NOT being processed by effectdamage(as his hook does not pick it up).
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Sep 26, 2017 17:31    Post subject: Reply with quote

Quote:
Is there really not just a core function somewhere that can be modified? Sneak attack has to be adding damage to some kind of integer before it's actually applied. Likewise the base damage on weapons has to be added somewhere.
This is also complicated, the function is calculating attack roll and damage in same time and then applies immunities/resistances/reductions.

That makes hooking the function complicated. If you add some damage at the beginning, it might get overriden, and at the end of the function its already after immunities/resistances which is not correct again. The best way would therefore be to completely recode the engine function in plugin which is very difficult to do due to lot of code needed to decrypt/understand/duplicate not to mention the function has combat debugging support which crashes for me when I tried to duplicate it in nwnx. And breaking combat debugging is not an option for this project.

highv priest wrote:
On a further note! Baaleos's plugin is the opposite of what you said. When -combat damage- is being applied the damage immunities/resistances/reductions already happened. If -spell- damage(what I believe is non-combat by your definition) is applied then it is NOT already processed.
Thas what I said or at least meant if its not understandable.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Wed Sep 27, 2017 6:28    Post subject: Reply with quote

ShaDoOoW wrote:
This is also complicated, the function is calculating attack roll and damage in same time and then applies immunities/resistances/reductions.

That makes hooking the function complicated. If you add some damage at the beginning, it might get overriden, and at the end of the function its already after immunities/resistances which is not correct again.


I don't understand why it's a problem if the damage is applied after resistances and immunities were checked? I feel like whatever situation a dev would use this for would be to do 1 of 4 things.

1. Code a class or race to heal from a damage type(which is fine with reductions and immunities as a semi intelligent person would not bother with resistances and immunities to an element they heal from).

2. Increase damage against very situational things(IE bonus damage against skeletons only for maces). In this situation the immunity and resistances is also fairly irrelevant as the dev of the server is the one applying resistances and immunities. So he can control this.

3. Fix EffectDamageIncrease to actually respect resistances and immunities(lol).

4. Create special conditions based on how much damage is dealt(note actually was -dealt-, not was started) such as if 10+ cold damage hits they get chilled.

In all of those situations the damage being controllable after resistance and immunity checks is fairly irrelevant and at worst is a minor inconvenience.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Sep 27, 2017 9:16    Post subject: Reply with quote

Hey so it seems the problem Antegate reported with cls_prog_*.2da exists in v 1.33 as well.

The code is correct but somehow the string char *CustomSpellType; gets overriden by engine and functions then read weird values like "grass" instead of "Arcane" or "Divine" which then result in incorrect values and might even cause crashing when you shutdown server.

My attempts to fix this failed, source is here if someone with more experiences with c++ can look into it.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Antegate



Joined: 20 Apr 2012
Posts: 100

PostPosted: Wed Sep 27, 2017 11:45    Post subject: Reply with quote

Quote:
My attempts to fix this failed, source is here if someone with more experiences with c++ can look into it.

what a pity if nothing can be done Sad(
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Wed Sep 27, 2017 18:00    Post subject: Reply with quote

ShaDoOoW wrote:
Hey so it seems the problem Antegate reported with cls_prog_*.2da exists in v 1.33 as well.

The code is correct but somehow the string char *CustomSpellType; gets overriden by engine and functions then read weird values like "grass" instead of "Arcane" or "Divine" which then result in incorrect values and might even cause crashing when you shutdown server.

My attempts to fix this failed, source is here if someone with more experiences with c++ can look into it.


I can't duplicate the problem, is it maybe because you have haks and I do not?

If it's returning grass it sounds like the engine is loading one of the .2da's side by side or perhaps there is an overflow. Could be the surfacemat.2da in particular as it contains a "Grass" entry. This could pertain to the auto2da loader built into nwserver that is loading placemat.2da every pathfind check.
There is also a limit to how many 2das the loader will save at one time and it may be overwriting the progression 2da with the placemat.2da in that situation.

I noticed there is no allocs in GetSpellProgressionModifier and you stated the problem you had was with CustomSpellType being re-assigned illegally. I don't think you would need allocs for a function that isn't overwriting anything so my advice would be to add a recursive variable such as CustomSpellTypeB and have it check them in an OR for each successive check of it. Then add the end register them null to avoid corruption.

EDIT = Alternatively perhaps have it by an int of 1, 2, or 3(1 = arcane, 2 = divine, and 3 = other) instead of a string when you're in a situation where 2das are involved.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Sep 27, 2017 18:37    Post subject: Reply with quote

I think I have solution, I simply dropped variable cls_spell_type[255]; and no longer storing spell type for each class. Instead it gets loaded from 2da inside function. So far it seems it got fixed but this time I make extensive testing.

I was thinking how to make this more efficient: is this feature (class progression for prestige classes) essential for NPCs ? If I called original function for NPCs it might get much more efficient. NPCs should not be even able to use this and builder should always try to make creature to use vanilla classes/feats only because of AI issues and becaus custom feats are usually coded in module events which not always fire for NPCs.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Valbor



Joined: 26 Dec 2016
Posts: 145

PostPosted: Thu Sep 28, 2017 9:25    Post subject: Reply with quote

ShaDoOoW wrote:
you can't

function NWNXPatch_SetTotalDamageDealtByType says it can only be used in 70_s2_specattk event

I already experimented with this functionality but I was only able to enable it for OnDamaged event triggered for player not for NPC which is not enough I suppose...

EDIT: option would be to use effects.2da enable 70:mod_effects for damage and do it there but then you wont know if the attack wass critical hit etc....

Maybe in hardcoded from Defensive roll feat is helpful information on how to reduce damage from attacks?

Also NWNXPatch_SetTotalDamageDealtByType(oAttacker, DAMAGE_TYPE_COLD, 1); in 70_mod_attacked or 70_mod_damaged partially works.
This modifies cold damage by 1 every second attack even if the weapon is not enchanted by this, for example my PC and NPC. http://pixs.ru/showimage/Test0000hp_2181328_27681653.png
if you only managed to make it functional i would be happy Smile
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Sep 28, 2017 11:50    Post subject: Reply with quote

NWNCX_Patch and NWNX_Patch v1.33c

DOWNLOAD

Fixes to the plugin:
- fixed random crash issue happening when (re)loading savegame or closing server
- fixed class spell progression from 1.33b
- fixed issue where empowered spell feat couldn't be taken at lvl 3 wizard/4sorcerer

Revisited fixes/features:
- column AffectTwo in cls_prog_*.2da renamed to ProgOption, cls_prog_palema + example 2das updated to reflect this (Note: if you don't rename it in your 2das it will still work as plugin doesn't check column name, just position)

New features, fixes and improvements:
- enabled custom spontaneous spellcasters to take feats requiring minimal spell level (such as empower spell feat)


Notes:
That crash issue was hidden nicely and it wasn't new one, it is there basically from start. The crash was happening completely randomly sometimes it happened after 6th time I loaded savegame sometimes 20th. But it was happening although I don't understand why. Anyway, reworked the code and it seems to be fixed now. If you experience any more crash let me know.

Class progression should work properly now. Tested almost all combinations, reloading game, levelling up, delevelling up all fine. I think the reason why it got bugged was some interaction between CExoString and c++ function strcmp. So I reworked it to use NWN engine string comparsion code.

Still thinking about running vanilla functions for non-players. Might improve efficiency a lot and NPCs shouldn't need to get spell progression or use custom spellcasting classes.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
Antegate



Joined: 20 Apr 2012
Posts: 100

PostPosted: Thu Sep 28, 2017 14:19    Post subject: Reply with quote

Thanks
Back to top
View user's profile Send private message
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 ... 31, 32, 33 ... 42, 43, 44  Next
Page 32 of 44

 
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