Controlled PC Scripts

Does anyone know if a PC that is currently controlled by the player runs any scripts on events? If so, which ones? I experimented with “gb_assoc” scripts as well as “Companion_Possessed” set in nwn2_scriptsets.2da - to no avail…
Halp? Pls?

iirc,

a player-controlled character (PC or Companion) should fire events heartbeat, death, and userdefined

per Nwn2_Scriptsets.2da row #4:

gb_player_heart
gb_comp_death
gb_player_ud

(the other events don’t fire at all for player-controlled chars)

 
/iirc

I kinda need do detect when the PC is attacked… Any idea why editing Nwn2_Scriptsets.2da doesn’t seem to work? Is is hard-coded or something?

i tried to do that myself sometime ago… was trying to bypass the tendency of my controlled character to automatically counter-attack (when attacked) by melee

i gave up: no event

 
am sure it’s hardcoded – only hb, death, and ud events fire for controlled chars.  :(

Have you tried doing the reverse? Detecting when an npc is performing an attack?

What I need is to make this bad boy play his attack animations. Any kind of work-around would work, but I figured editing on_attacked scripts was the easiest. It works perfectly fine for everyone except for the PC… So it’s good for cutscenes, or characters in the background, but not for opponents :-/

test

1 Like

The only idea that comes to me right now is to try the combat round end script… Maybe if I could make the script check whether or not the attack target is the controlled PC I could just make the rider fire his attack animation every X seconds depending on how many attacks per turn he has. Far from perfect, though :frowning:

So cooll !! :+1:

Is the problem that the PC doesn’t counter-attack? Or is it because he’s riding a horse and the animations are not available?
I know, I only released an alpha version of the human male rider animations, but so far I didn’t encounter the problem you describe. Or maybe you’re using a vfx for the mounted appearance?

Rider’s a VFX

For some reason GetAttackTarget and GetAttemptedAttackTarget both return OBJECT_INVALID… Am I doing something wrong?

in my experience the combat-engine is notoriously difficult to get info from or put info into … if something works, great. But if it doesn’t,

???

 
so i suspect this would need a real combat animation …

those Get*Target() functions can fail if an ‘attack’ hasn’t been initiated yet, or if the target has been cleared (eg. dead perhaps, endcombatround perhaps)

https://nwnlexicon.com/index.php?title=Category:Combat_Information_Functions

Yeah, so the commands do return the actual target if I delay them by 0.1s. I got it to kinda work, but not quite. Mostly because there’s a delay between the combat round end and the first attack of the next round. I don’t know if the duration of said delay is constant. Or why is it there to begin with.
Other than that it serves its function… It checks who the target is on each attack. Kinda :stuck_out_tongue:

lol   :upside_down_face:

Lol indeed. It worked out pretty well in the end:

I did some testing and it would seem the delay I mentioned is 0.5s.

3 Likes