12-14-2010, 05:22 AM
Hello,
Below is the code I am using. I am trying to make a sound play when the player makes contact with a certain area. When the player makes contact with this area, the sound will play from the location of another entity (in this case another script area).
Below is the code I am currently using. I have been reading through the tutorials and teaching myself as I go, so far it has gone well however I am stuck at the moment. I can't see where I am going wrong at all.
If you could help fix up my script and explain where I went wrong I would be very grateful.
Thanks for all the help
Below is the code I am using. I am trying to make a sound play when the player makes contact with a certain area. When the player makes contact with this area, the sound will play from the location of another entity (in this case another script area).
Below is the code I am currently using. I have been reading through the tutorials and teaching myself as I go, so far it has gone well however I am stuck at the moment. I can't see where I am going wrong at all.
Code:
void OnStart()
{
AddTimer("Timer_1", 2, "MonsterSpawn");
AddEntityCollideCallback("player", "Child_Cry_1", "Collide_Area", true, 1);
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}
void Collide_Area(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("BabyCry", "scare_Baby_Cry.snt", "child_cry_scare", 0, false);
}
If you could help fix up my script and explain where I went wrong I would be very grateful.
Thanks for all the help