Perception Script Help
Zephirius
Member Posts: 419
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. 
Code:
Edit: I removed the dice roll and it seems to work ok now.
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