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 ... 24, 25, 26 ... 42, 43, 44  Next
 
Post new topic   Reply to topic    nwnx.org Forum Index -> Windows development
View previous topic :: View next topic  
Author Message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Wed Aug 30, 2017 1:01    Post subject: Reply with quote

you are right Embarassed
edit, actualy item is gave to the thief, just gold
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
DarkSet



Joined: 06 Jun 2016
Posts: 98

PostPosted: Wed Aug 30, 2017 9:26    Post subject: Reply with quote

Oh, by copyitem, yes
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 02, 2017 8:20    Post subject: Reply with quote

So Im working a second day on making GetLastAttackSneak work. Because it is not working properly.

I can make it work in OnPhysicalAttacked event, and I can add much more, basically I can enable you to real all the combat-related informations in this event from whether the attack was hit/miss, critical hit, sneak attack, death attack, deflected by Deflect Arrow feat, how much was roll, ab, threat roll and few more informations.
Usefulness of this isn't big because these informations cannot be changed - at the time this event fires, all the attacks in flurry were already calculated, but still can come handy.

But here is a thing - I was thinking what are you want this function for. I realized you most likely want to use it on player in conjuction with scripted OnDamage event using onhitspellcast on skin/armor or Baaleos plugin.

That leaves me two options, either work harder and enable this for OnDamaged as well (which would be super hard). Or fire new script for player when he is OnPhysicallyAttacked (maybe 70_mod_attacked or something). I can make it possible to retrieve GetTotalDamageDealt() and GetDamageDealtByType() in this event as well. So basically it should solve 2 issues at once - one script for OnAttacked and OnDamaged. You won't be able to modify the damage dealt or anything, but that is not possible in vanilla OnDamaged script anyway so it should suffice.

Anyway, can you tell me what you want GetLastAttackSneak for exactly? Might help me decide how to code 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: Sat Sep 02, 2017 8:26    Post subject: Reply with quote

Quote:
So basically it should solve 2 issues at once - one script for OnAttacked and OnDamaged

One script will be run for 2 events on the player? or is events for all creatures?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 02, 2017 8:55    Post subject: Reply with quote

Antegate wrote:
Quote:
So basically it should solve 2 issues at once - one script for OnAttacked and OnDamaged

One script will be run for 2 events on the player? or is events for all creatures?

Current working code does this:
1) Fires 70_mod_attacked for player in OnPhysicalAttacked.
2) Enables to read all combat informations including damage in OnPhysićalAttacked event (monster or pc doesn't matter]

edit: seems that while I can read the damage in this event, it is the full damage ammount without taking resist/immunities in consideration. Which then makes it bit useless.

so is the GetLastAttackSneak function actually uselfull in OnPhysicalAttacked event? or you need it in OnDamaged and if yes then why?
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect


Last edited by ShaDoOoW on Sat Sep 02, 2017 12:33; edited 1 time in total
Back to top
View user's profile Send private message
Antegate



Joined: 20 Apr 2012
Posts: 100

PostPosted: Sat Sep 02, 2017 12:30    Post subject: Reply with quote

Quote:
Enables to read all combat informations including damage in OnPhysićalAttacked event (monster or pc doesn't matter]


Sorry, I do not understand English well enough.

I mean
The player and the creature will have this event or only the player?

and else if - yes

Could you add the opportunity to learn the success of passing the AOO here?
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 02, 2017 12:56    Post subject: Reply with quote

npcs has their OnAttacked plugin, no need to fire again

don't understand what you want with AOO

another question: do you prefer modifiers or overrides or both?

Currently there is feature to override saving throws, but maybe it makes it unneccessary complicated to add a bonus +3 for example. Modifier that would be added into original result might be better.
_________________
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: Sat Sep 02, 2017 13:16    Post subject: Reply with quote

Quote:
don't understand what you want with AOO

http://www.d20srd.org/srd/combat/specialAttacks.htm#grappleChecks

Quote:
another question: do you prefer modifiers or overrides or both?
Currently there is feature to override saving throws, but maybe it makes it unneccessary complicated to add a bonus +3 for example. Modifier that would be added into original result might be better.

Maybe the modifier is really better
Back to top
View user's profile Send private message
DarkSet



Joined: 06 Jun 2016
Posts: 98

PostPosted: Sat Sep 02, 2017 13:26    Post subject: Reply with quote

this on atack and on damage evenst you are talking about - are they caught on attack or on successfull hit (if attack roll beat AC) or only on physical damage delt?

Because for now vanilla OnHit events on items fire only if physical damage was delt, and even if attack was successfull, but physical damage was 0 - event does not run. That's bad Sad
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 02, 2017 14:01    Post subject: Reply with quote

DarkSet wrote:
this on atack and on damage evenst you are talking about - are they caught on attack or on successfull hit (if attack roll beat AC) or only on physical damage delt?

Because for now vanilla OnHit events on items fire only if physical damage was delt, and even if attack was successfull, but physical damage was 0 - event does not run. That's bad Sad

Former. It is the same event as npcs has which fires when npc is attacked, hit or miss. Event fires before OnDamaged.

Problem is, and this is why is so hard to make GetLastAttackSneak work in OnDamaged that:

1) all the attacks in flurry are already calculated before any event fires, theefore it is not possible to modify the attack result, only damage can be modified as the attack calculates raw damage which is then reduced by resists/immunities in OnDamaged event

2) after the attacks in flurry were calculated, each attack in flurry will fire OnPhysicalAttacked event (npc only) and few miliseconds later each attack in flurry will fire OnDamaged event (npc only). So if the creature has 2 attacks in first flurry this happens:
onattacked
onattacked
ondamaged
ondamaged
onhitcast
onhitcast
Thats a problem because any attempt to read LastAttack datas in OnDamaged will read values from the second attack in flurry.
_________________
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: Sat Sep 02, 2017 18:16    Post subject: Reply with quote

Doesn't nwn have an internal function that assigns sneak attack damage to normal physical damage? I believe what he ultimately wants the function for is just to know how much damage a sneak attack did compared to the entire result of physical damage obtained by base+strength+massive criticals+weapon bonus physical damage.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sat Sep 02, 2017 22:40    Post subject: Reply with quote

highv priest wrote:
Doesn't nwn have an internal function that assigns sneak attack damage to normal physical damage? I believe what he ultimately wants the function for is just to know how much damage a sneak attack did compared to the entire result of physical damage obtained by base+strength+massive criticals+weapon bonus physical damage.


That would be impossible to do.

I guess I can store the damage from sneak, but in OnPhysicalAttacked the damage values are raw and might not match the actuall damage because damage resist/immunities weren't calculated yet.

And once the resist/immunity is taken into consideration it is impossible to determine it because the resist/immunity apply on full base damage including sneak attack.
_________________
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: Sat Sep 02, 2017 23:05    Post subject: Reply with quote

ShaDoOoW wrote:
highv priest wrote:
Doesn't nwn have an internal function that assigns sneak attack damage to normal physical damage? I believe what he ultimately wants the function for is just to know how much damage a sneak attack did compared to the entire result of physical damage obtained by base+strength+massive criticals+weapon bonus physical damage.


That would be impossible to do.

I guess I can store the damage from sneak, but in OnPhysicalAttacked the damage values are raw and might not match the actuall damage because damage resist/immunities weren't calculated yet.

And once the resist/immunity is taken into consideration it is impossible to determine it because the resist/immunity apply on full base damage including sneak attack.


Sounds to me then the best result would be to bypass nwns normal damage calculations entirely and just softcode it. Technically speaking if your code is decently efficient the resource usage should be almost identical.
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Sun Sep 03, 2017 2:07    Post subject: Reply with quote

ShaDoOoW wrote:
That would be impossible to do.

I guess I can store the damage from sneak, but in OnPhysicalAttacked the damage values are raw and might not match the actuall damage because damage resist/immunities weren't calculated yet.

And once the resist/immunity is taken into consideration it is impossible to determine it because the resist/immunity apply on full base damage including sneak attack.


I made few tests. Seems I was wrong. The damage values in OnPhysicalAttacked are already after resist/immunity modifications.

highv priest wrote:

Sounds to me then the best result would be to bypass nwns normal damage calculations entirely and just softcode it. Technically speaking if your code is decently efficient the resource usage should be almost identical.

If you mean softcode inside plugin using c++ then yes and I was already thinking about it, but I was not able to figure out how to keep combat debugging messages, therefore I gave up on this, maybe later but this is definitely not in plan right now.

Right now, I am polishing code, revisiting features and adding few last things that would be needed to rework PRC using my plugin.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect
Back to top
View user's profile Send private message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Mon Sep 04, 2017 10:09    Post subject: Reply with quote

Antegate wrote:
Quote:
don't understand what you want with AOO

http://www.d20srd.org/srd/combat/specialAttacks.htm#grappleChecks

Hmm..

Ok so the problem is that GetLastAttackType doesnt return SPECIAL_ATTACK_ATTACK_OF_OPPORTUNITY (engine knows this value but function intentionally doesn't reveal it).

I already added code that will enable to read all combat attack values including this (AoO is stored as AttackType = 65002;) so you will be able to determine that the attack was AoO and if it was sucessful or not and how much damage it did.

But that will be long time after you broadcast AOO. Assuming the AOO even gets passed in.

Which might not happen, first problem is that there is a max AOO limit (default 1). I could check this limit in the plugin code before trying to broadcast aoo, and pass value 0 if the limit disallows to broadcast AOO at all.

Then there is the 70_s2_aoo script which has its own conditions when to cancel AOO to happen and that is a bit problematic. I guess it would be possible to determine whether the AOO was actually added or not but very hard to do. Not going to deal with that right now.

Either way I don't think it is possible to code Grapple the way it is described in d20srd.org.

In NWN attack is not instant and standalone action like in Diablo where 1 click is 1 attack (something I would like to change someday but this would be extremely complicated). Character automatically performs multiple attacks (if he has more than 1) per round divided into 3 flurries.

OnPhysicalAttacked and OnDamaged are fired after all the attacks in same flurry were calculated, thus you can't change anything in these events.

Furthermore, the AoO that is granted in flurry 1 might be actually performed in flurry 2 or flurry 3.

So, when you use NWNXPatch_BroadcastAttackOfOpportunity it can take 1-3 seconds before the actual AoO is performed (if its even passed in) and some event fires for you to be able to read that it happened.

I suppose you need the value immediatelly, ie. player uses feat on creature. Creature is supposed to perform AoO immediately (which is not instant as explained) and then you code something based on result.

This is not possible, because the AoO will happen much later.
_________________
Community Patch / NWNX Patch / NWNX Files / NWNX Connect


Last edited by ShaDoOoW on Mon Sep 04, 2017 10:56; edited 1 time in total
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 ... 24, 25, 26 ... 42, 43, 44  Next
Page 25 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