Jump to content

Advanced scripter needed...


Andyno

Recommended Posts

I'm trying to achieve 3 options in one script:

1. if the player kills something, a custom sound will play

2. if the player scores a critical hit, another sound will play

3. if the player dismember or blows someone's head off, yet another sound will play

 

Of course, point 3. should be advanced to point 1. So if player will blow someone's head off, there's no chance that first option will happen - only sound 3 will play. Also, if the player will kill 2 enemies at the same time, there should be zero probability that 2 sounds will play.

 

Here's some script that should work as some kind of template.

As you can see, there're only first 2 options included, but only one of them works - option 1... although still with chance that 2 sounds will play...

 

short Critical
short SayCritical
short killed
short SayKilled
ref rCurrentRef

Begin GameMode 

set rCurrentRef to GetFirstRef 200 1 0

else
endif

Label 10
if rCurrentRef
if rCurrentRef.GetDead 
if rCurrentRef.GetItemCount Token
else
rCurrentRef.AddItem Token 1 1

if rCurrentRef.IsKiller Player

set killed to 1 + 0.02 * GetRandomPercent  ;just two possibilities yer or no 50/50
elseif rCurrentRef.GetLastHitCritical
set Critical to 1 + 0.02 * GetRandomPercent  ;just two possibilities yer or no 50/50
endif
endif
endif
set rCurrentRef to Pencil01 ; Prevent apple bug
set rCurrentRef to GetNextRef
Goto 10
endif

if killed == 1 ;50/50 response
set killed to 0
set Saykilled to 1 + 0.02 * GetRandomPercent
elseif killed == 2
set killed to 0
endif

if Critical == 1
set critical to 0
set SayCritical to 1 + 0.02 * GetRandomPercent
elseif Critical == 2
set critical to 0
endif
;==============part where the player actually says something
if SayCritical == 1
set SayCritical to 0
PlaySound sound1
elseif SayCritical == 2
set SayCritical to 0
PlaySound sound1
endif

if SayKilled == 1
set SayKilled to 0
PlaySound sound2
elseif SayKilled == 2
set SayKilled to 0
PlaySound sound2
endif

End

Link to comment
Share on other sites

1. I don't know what this script is attached to.

2. The Geck wiki says GetLastHitCritical only works in the OnHit/OnHitWith blocks.

 

With that said, maybe you will find this useful:

 

int soundToPlay
ref targetHit

Begin OnHit
Set targetHit to GetOwnerLastTarget
If ((targetHit.GetDead == 1) && (targetHit.IsKiller player == 1))
	Set soundToPlay to 1
	If targetHit.GetKillingBlowLimb == 13
		Set soundToPlay to 3
	ElseIf targetHit.GetLastHitCritical
		Set soundToPlay to 2
	EndIf
EndIf 
End

Begin GameMode
If soundToPlay > 0
	If soundToPlay == 3
		playSound dismemberKill
	ElseIf soundToPlay == 2
		playSound criticalKill
	ElseIf soundToPlay == 1
		playSound normalKill
	EndIf	
	Set soundToPlay to 0
EndIf
End

Link to comment
Share on other sites

Thanks for your script suggestion.

But I don't know how to use it - should I attach it to a quest or NPCs/Creatures?

 

BTW, my script is attached to a quest. Also the script is reffering to "token" - this is a non-playable bandana which is automatically added to target's inventory. Actually, the script is not mine - AlexScorpion helps me with that... but he got stuck, so I asked for help here...

 

PS: I was trying to send you a PM, but for some reason it was not possible.

Link to comment
Share on other sites

I imagined the script was for a weapon. If you rework the OnHit block to use OnHitWith instead the script could be attached to an NPC. If you are trying to keep it on the token so that it can be on any NPC, then I do not know how to do that. Maybe NVSE could provide that capability, but I am not familiar with NVSE.
Link to comment
Share on other sites

I forgot to write that AlexScorpion's script is for NVSE...

 

I also forgot to mention that I need it with 50% probability - so there would be 50% probability that the player remains silent.

I'm sorry about that. Can you add this feature to your script, please.

 

I just noticed that dismember is only for brain... if I add another body parts, for example left arm and left leg, will it work?

 

If targetHit.GetKillingBlowLimb == 3
     Set soundToPlay to 3
If targetHit.GetKillingBlowLimb == 7
     Set soundToPlay to 3

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...