RE: Scripting noob, help needed!
Okay, so first of all, this was great, problem was the sound of the saw didn't stop, so this is how I changed the script:
void OnStart()
{
AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
}
void SawGruntAlert(string &in asItem, string &in asEntity)
{
SetEntityActive("wooden_boards_block_1", false);
SetEntityActive("wooden_boards_block_broken_1", true);
PlaySoundAtEntity("", "23_saw2.snt", "Player", 0, false);
AddTimer("", 1, "TimerFunc");
AddTimer("StopSoundTimer", 1, "TimerFunc2");
}
void TimerFunc(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
}
void TimerFunc2(string &in asTimer)
{
StopSound("23_saw2.snt", 0);
}
But it didn't do anything.
Second, I wanted to start an ambience sound file playing from the beginning of the map so this is what I added:
void OnStart()
{
FadeInSound("amb_guardian.snt", 0, abPlayStart);
}
{
AddUseItemCallback("", "bone_saw_2", "wooden_boards_block_1", "SawGruntAlert", true);
}
void SawGruntAlert(string &in asItem, string &in asEntity)
{
SetEntityActive("wooden_boards_block_1", false);
SetEntityActive("wooden_boards_block_broken_1", true);
PlaySoundAtEntity("", "23_saw2.snt", "Player", 0, false);
AddTimer("", 1, "TimerFunc");
AddTimer("StopSoundTimer", 1, "TimerFunc2");
}
void TimerFunc(string &in asTimer)
{
SetEntityActive("servant_grunt_1", true);
}
void TimerFunc2(string &in asTimer)
{
StopSound("23_saw2.snt", 0);
}
Once i add the fade in sound the map crashes.
Third of all although I don't want to learn how to do it all could you post whatever script you would need to make the sawing animation with the sound? that would be a lot cooler than just what it is now. thx.
|