Perception Script Help
![Zephirius](https://forums.beamdog.com/uploads/userpics/KEYH4THWCWVZ/n6VV98LH2SN2M.gif)
In my script I want the NPC (a golem) to play a few .wav files when he perceives the PC. I've really never tinkered around with the whole OnPerception thing, so I'm kinda of flailing around here. ![:# :#](https://forums.beamdog.com/resources/emoji/grimace.png)
Code:
Edit: I removed the dice roll and it seems to work ok now.
![:# :#](https://forums.beamdog.com/resources/emoji/grimace.png)
Code:
void main() { if ( !GetLastPerceptionSeen() ) return; object oPC = GetLastPerceived(); if (d20() > 5) { AssignCommand(oPC, PlaySound("computer_03")); DelayCommand(0.9, AssignCommand(oPC, PlaySound("six"))); DelayCommand(0.9, AssignCommand(OBJECT_SELF, SpeakString("Six...?"))); } }
Edit: I removed the dice roll and it seems to work ok now.
void main() { if ( !GetLastPerceptionSeen() ) return; object oPC = GetLastPerceived(); AssignCommand(oPC, PlaySound("computer_03")); DelayCommand(0.9, AssignCommand(oPC, PlaySound("six"))); DelayCommand(0.9, AssignCommand(OBJECT_SELF, SpeakString("Six...?"))); }
0
Comments