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 ... 29, 30, 31 ... 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: Thu Sep 21, 2017 23:25    Post subject: Reply with quote

ShaDoOoW wrote:
I take back. OnDamaged for PC works only for combat damage but not from damage from spells/scripts.

Is it possible to make so that spells worked too?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Thu Sep 21, 2017 23:31    Post subject: Reply with quote

ShaDoOoW wrote:
I take back. OnDamaged for PC works only for combat damage but not from damage from spells/scripts.

Ok I managed to bring this functionality.

This however raise a question.

Is it worth to trigger 70_mod_damaged for combat damage when it can be read in 70_mod_attacked already?
_________________
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 21, 2017 23:39    Post subject: Reply with quote

Let's say i want to added an additional effect from spell or from trap after damaged without modifying the script this spell, i can do it in 70_mod_attacked?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Sep 22, 2017 1:06    Post subject: Reply with quote

Valbor wrote:
Let's say i want to added an additional effect from spell or from trap after damaged without modifying the script this spell, i can do it in 70_mod_attacked?

Well first of all.

nwnx_patch doesn't allow to change damage being done (this is because it won't work properly in most cases anyway)

Now for your question - no, but you can't really do that in 70_mod_damaged either - you don't know the damage comes from spell or combat.

My proposed change would actually make this easier for you, at least for player (the change would not have impact on NPCs for backwads compatibbility reasons).

What I propose is:
for combat damage, run only 70_mod_attacked
run 70_mod_damaged only for non-combat damage (basically ApplyEffectToObject only).

And for 70_mod_damaged it would be possible to modify damage being done or determine spell_id (for trap you just want to check if oDamager is OBJECT_TYPE_TRIGGER which can be done already in OnDamaged).
_________________
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: Fri Sep 22, 2017 7:42    Post subject: Reply with quote

I'm of a wrong idea led to what i need, i would like to make to say the domain of death could block 1 time a day fatal damage from any source previously putting immortality on 0.1 second before applying the damage no matter what attack or spell or trap, etc. this is for the NPC i already made, but with the plugin Baaleos it was impossible to do because the deadly damage it generally did not work well and similar ideas i have a few. In your opinion how can i implement this and where to start?
Back to top
View user's profile Send private message
Antegate



Joined: 20 Apr 2012
Posts: 100

PostPosted: Fri Sep 22, 2017 8:17    Post subject: Reply with quote

Quote:

What I propose is:
for combat damage, run only 70_mod_attacked
run 70_mod_damaged only for non-combat damage (basically ApplyEffectToObject only).

And for 70_mod_damaged it would be possible to modify damage being done or determine spell_id (for trap you just want to check if oDamager is OBJECT_TYPE_TRIGGER which can be done already in OnDamaged).

exactly what need =)
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Sep 22, 2017 8:23    Post subject: Reply with quote

Valbor wrote:
I'm of a wrong idea led to what i need, i would like to make to say the domain of death could block 1 time a day fatal damage from any source previously putting immortality on 0.1 second before applying the damage no matter what attack or spell or trap, etc. this is for the NPC i already made but with the plugin Baaleos it was impossible to do because the deadly damage it generally did not work well and similar ideas i have a few. In your opinion how can i implement this and where to start?
I think that this can be done in 70_mod_damaged easily at least if it worked from non-combat damage which doesn't right now. (not 100% sure because the differences between PC, NPC, combat and non-combat damage makes this really complicated but since your idea doesn't require modify or block damage values it should work).

But that will be fixed in next version.

My suggestion would however caused that you would have to code this in 2 scripts instead of one - 70_mod_attacked (for damage from combat) and 70_mod_damaged (for non-combat damage).

Your example is great, now I realize my goal of making things easier would work only in half the cases anyway.

BTW I just realized there is already another way to do this.
Next nwnx_patch version will allow builder to rin 70_mod_effects for any vanilla effect and bypass the event. This means that if you set effect_damage to run this event, you will be basically able to catch ondamaged event in another way and possibly better way. Since the event enables to retriee original effect, you can determine: effect creator (damager), effect spell id (to determine it comes from spell), if the effect comes from combat or not, melee or ranged combat and damage values. And mainly completely block the original engine code to run. Since I just now realized the event could be used for this I can try to enable to alter the effect that triggered the event.
_________________
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: Fri Sep 22, 2017 8:27    Post subject: Reply with quote

Ok thanks, i'll waiting for the updates Very Happy
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Sep 22, 2017 11:54    Post subject: Reply with quote

NWNCX_Patch and NWNX_Patch v1.33

DOWNLOAD

Fixes to the plugin:
- fixed SetEffectInteger used with negative values

Revisited fixes/features:
- added logging into effect functions
- added prefix NWNXPatch_ into all functions in 70_inc_nwnx library
- functions for overriding base saving throws removed and replaced by one function for all 3 saving throw types

New features, fixes and improvements:
- fixed bug that restored uses of certain feats incorrectly under specific circumstances
- greatly improved way how decrementing spell uses works when unequipping items with bonus spell slots
- EffectDamage no longer ignores nDamagePower parameter
- plugin runs script 70_mod_hlight if player attempts to highlight all objects (the TAB key feature)
- enabled to capture effect event 70_mod_effects for any vanilla effect, refers to effects.2da
- OnDamaged event for player will run also for non-combat damage
- enabled immunity to dying, creature with variable int "IMMUNITY_DYING" 1 will not drop unconscious on hitpoints 0 to -9
- Eye of the Gruumsh level will be calculated into number of Greater Rage feat uses
- enabled to make new spellcasting class casting custom type of spells (such as invocations, powers etc.)
- reworked the way how prestige classes affects spellcasting progression, refers to cls_prog_*.2da

New custom functions:
NWNXPatch_AddFeat
NWNXPatch_RemoveFeat
NWNXPatch_SetFeatTotalUses - enables to override maximum uses for specified feat (ie. over the value set in feat.2da)
NWNXPatch_TransferEffectValues
NWNXPatch_GetDamageDealtSpellId - enables to determine if the damage was applied by spell, use in OnDamaged event
+ new functions using already existing nwnx_patch features (variables):
NWNXPatch_SetSavingThrowBase
NWNXPatch_SetSavingThrowModifier
NWNXPatch_SetNumberOfEpicDodges
NWNXPatch_GetNumberOfEpicDodges
NWNXPatch_SetNumberOfDeflectArrows
NWNXPatch_GetNumberOfDeflectArrows

Notes:

1) Apology for functions name changes and saving throw functions rework. Might make your scripts run errors, but having functions with and without NWNXPatch_ prefix in same library was messy. In case of saving throw functions, it is better to have 2 functions than 6 because toolset builtin script compiler has limit to the number of identifiers.

2) I didn't make the change with OnDamaged event. Combat damage will still try to run script 70_mod_damaged. It is probably redundant as the damage can be read in 70_mod_attacked, but Valbor example convinced me its better this way.

3) Note that the bug with incorrectly restoring feat uses is fixed only for vanilla means. If you use function NWNXPatch_SetFeatTotalUses bug will happen again - it is advised to store and restore feat uses with your own script/persistency.

4) The fix for losing spell uses fixes fact that each time player unequipped item granting bonus spell slots for sorcerer/bard, spell slots were reduced by 1 no matter the item didn't provide its benefits. Also fixed connected bug that caused incorrectly losing spell uses when unequipping item with ability bonus as long as player had equipped another item granting bonus spell slots.

However, this bugfix so far from backwards compatibility reasons still decrement spell uses if this item is equipped for first time in game and unequipped before player rests (and make the item provide its benefits).

5) The new feature to run 70_mod_effects is described in advanced effect tutorial. As was explained in my previous post this feature could be also used to make OnDamaged event with a possibility to modify damage being done. For this, use new function NWNXPatch_TransferEffectValues - this is new and not mentioned in the tutorial yet, read comments in 70_mod_effects for further info.

6) New custom spellcaster features. When browsing PRC I quickly realized that while nwnx_patch enables to make custom spellcasters, it wouldn't be suitable for many custom spellcasters from PRC. Mainly because till now nwnx_patch divided spellcasters only to arcane and divine. Thus if someone would want to create a new base spellcaster Warlock who should cast invocations, prestige classes enhacing arcane spells would improved warlock spells as well. While this might be actually desired by many builders there also weren't way how to make a custom prestige class that would enhance warlock spells but not sorcerer spells. This took a long time to invent but I figured it out.
classes.2da now has two new columns
SpellType: column determine type of spells cast by this class, if **** the type of spell will match with bitflag 128 in CastType column, otherwise set to any string such as "Invocation". You can also set it to "Divine" or "Arcane" if you want to use opposite bitflag in CastType. That would allow to make a divine spellcaster that has arcane spell failure or arcane spellcaster that doesn't Embarassed )
SpellProgTable: column controlls name of 2da that will be used by nwnx_patch to read spellcasting progression. Recommended prefix is cls_prog_*.2da. This is optional and it is not used for PM by default. As long as you are satisfied with columns ArcSpellMod and DivSpellMod there is no reason to use this. If you want extra options however, you will be suprised what you can do in this 2da.

This 2da has specific structure. First of all, values are determined for exact level of the class. This means you can specify spellcasting progression for each level. Thus you can make a class that will improve spellcasting progression from level 5 onwards. Also the 2da specifies exact value that gets added, not modifier, thus it is possible to make a class which will improve spellcasting progression by 2 for each 1 level etc.

Also, with colum AffectTwo if set to 1, class will improve spell progression of two classes of same type of spells (ie wiz+sorc, cler+druid), this is normally not the case and only highest class is affected.

Arcane column controlls progression of arcane spellcasters (bard, sorc, wizard), Divine column controlls progression of divine spellcasters (cleric,druid,palading,ranger). If you have spellcasters with custom type of spells such as the mentioned Warlock example, simply add new column with name matching the value of SpellType in classes.2da (that would be 'Invocation' for warlock).

Plugin package contains 4 example 2das with progression unfortunately I forgot to include only one example with custom type of spells.

Let me know if its comprehensible.
_________________
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: Fri Sep 22, 2017 11:56    Post subject: Reply with quote

Thanks
very cool))))
Back to top
View user's profile Send private message
Valbor



Joined: 26 Dec 2016
Posts: 145

PostPosted: Fri Sep 22, 2017 13:15    Post subject: Reply with quote

70_mod_damaged now works as i need, thanks Very Happy

And there is a proposal concerning the function NWNXPatch_SetFeatTotalUses maybe in this add the number of epic dodges and deflect arrow, also as defensive roll? and the function to determine how many uses are left on a particular feat.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Fri Sep 22, 2017 16:18    Post subject: Reply with quote

Valbor wrote:
70_mod_damaged now works as i need, thanks Very Happy

And there is a proposal concerning the function NWNXPatch_SetFeatTotalUses maybe in this add the number of epic dodges and deflect arrow, also as defensive roll? and the function to determine how many uses are left on a particular feat.
yes and no - yes because that you will see a value 10 if you set epic dodge to 10, no because since all these feats are passive normally, engine doesn't decrement them in normal sense and uses separate counter (counter that can be modified by variables already).

So unless you want to rework the feat completely to do something else this is not usefull. If you add uses into passive feat and try to use that feat then:
- if the feat has SPELLID it will trigger spell and spell will run script where you can code feat behavior
- if not, feat will be considered special attack and will trigger 70_s2_specattk, that doesn't suit epic dodge very well but could be used for devastating critical nicely
_________________
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: Fri Sep 22, 2017 19:35    Post subject: Reply with quote

Quote:
SpellType: column determine type of spells cast by this class, if **** the type of spell will match with bitflag 128 in CastType column, otherwise set to any string such as "Invocation". You can also set it to "Divine" or "Arcane" if you want to use opposite bitflag in CastType. That would allow to make a divine spellcaster that has arcane spell failure or arcane spellcaster that doesn't Embarassed )
SpellProgTable: column controlls name of 2da that will be used by nwnx_patch to read spellcasting progression. Recommended prefix is cls_prog_*.2da. This is optional and it is not used for PM by default. As long as you are satisfied with columns ArcSpellMod and DivSpellMod there is no reason to use this. If you want extra options however, you will be suprised what you can do in this 2da.

This 2da has specific structure. First of all, values are determined for exact level of the class. This means you can specify spellcasting progression for each level. Thus you can make a class that will improve spellcasting progression from level 5 onwards. Also the 2da specifies exact value that gets added, not modifier, thus it is possible to make a class which will improve spellcasting progression by 2 for each 1 level etc.

Also, with colum AffectTwo if set to 1, class will improve spell progression of two classes of same type of spells (ie wiz+sorc, cler+druid), this is normally not the case and only highest class is affected.

Arcane column controlls progression of arcane spellcasters (bard, sorc, wizard), Divine column controlls progression of divine spellcasters (cleric,druid,palading,ranger). If you have spellcasters with custom type of spells such as the mentioned Warlock example, simply add new column with name matching the value of SpellType in classes.2da (that would be 'Invocation' for warlock).


in classes.2da colum DivSpellLvlMod/ArcSpellLvlMod == 0 if using SpellProgTable column?
Back to top
View user's profile Send private message
Antegate



Joined: 20 Apr 2012
Posts: 100

PostPosted: Fri Sep 22, 2017 20:11    Post subject: Reply with quote

It only remains to make a choice of spells when adding prestige and will be almost DND Smile)
Back to top
View user's profile Send private message
highv priest



Joined: 01 Mar 2013
Posts: 111

PostPosted: Fri Sep 22, 2017 20:27    Post subject: Reply with quote

ShaDoOoW wrote:
NWNCX_Patch and NWNX_Patch v1.33

DOWNLOAD

Fixes to the plugin:
- fixed SetEffectInteger used with negative values

Revisited fixes/features:
- added logging into effect functions
- added prefix NWNXPatch_ into all functions in 70_inc_nwnx library
- functions for overriding base saving throws removed and replaced by one function for all 3 saving throw types

New features, fixes and improvements:
- fixed bug that restored uses of certain feats incorrectly under specific circumstances
- greatly improved way how decrementing spell uses works when unequipping items with bonus spell slots
- EffectDamage no longer ignores nDamagePower parameter
- plugin runs script 70_mod_hlight if player attempts to highlight all objects (the TAB key feature).


Fantastic! This opens up possibilities of using nwn on tablets! One step closer to being mobile game compatible! This might just be what keeps nwn alive....
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 ... 29, 30, 31 ... 42, 43, 44  Next
Page 30 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