RE: A complex script problem
void GlassJarHeaterWithBlood(string &in asItem, string &in asEntity)
{
SetEntityActive("glass_container_blood_static_1", true);
RemoveItem(asItem);
PlaySoundAtEntity("placeglass", "26_place_glass", asEntity, 0.0f, false);
//Delay the boil a bit
AddTimer("BloodInPlace", 1, "TimerBloodInPlace");
}
void TimerBloodInPlace(string &in asTimer)
{
SetLocalVarInt("BloodOnBurner", 1);
//Check if blood is ready to boil!
CheckBoilBlood();
}
//------------------------------------------
void TurnSpecialBurner(string &in asEntityName, int alState)
{
if(alState == 1)
{
PlaySoundAtEntity("bruner_on","26_burner_ignite.snt", "AreaBurner", 0, false);
CreateParticleSystemAtEntity("burnerfire", "ps_fire_lab_burner.ps", "AreaBurner", true);
PlaySoundAtEntity("burnerfire","26_burner_loop.snt", "AreaBurner", 1, true);
SetLocalVarInt("BurnerReady", 1);
AddTimer("burnerfullspeed",2, "TimerBurnerFullSpeed");
}
else if(alState == -1)
{
PlaySoundAtEntity("bruner_off","26_burner_ignite.snt", "AreaBurner", 0.15f, false);
DestroyParticleSystem("burnerfire");
StopSound("burnerfire", 1);
RemoveTimer("burnerfullspeed");
SetLocalVarInt("BurnerReady", 0);
}
AddDebugMessage("Burner state: "+ alState, false);
}
void TimerBurnerFullSpeed(string &in asTimer)
{
SetLocalVarInt("BurnerReady", 1);
//Check if blood is ready to boil!
CheckBoilBlood();
}
//------------------------------------------
void CheckBoilBlood()
{
//If the burner is a full speed, blood is in place and blood is not boiled yet, then
if(GetLocalVarInt("BurnerReady")==1 && GetLocalVarInt("BloodOnBurner")==1 && GetLocalVarInt("BloodBoiled")==0)
{
SetLocalVarInt("BloodBoiled", 1);
CreateParticleSystemAtEntity("bloodboil", "ps_glass_container_blood_bubbles.ps", "AreaBloodBoil", false);
PlaySoundAtEntity("bloodboil","puzzle_boil.snt", "AreaBloodBoil", 1, false);
AddTimer("boileffectdone", 3, "TimerBoilEffectDone");
}
}
void TimerBoilEffectDone(string &in asTimer)
{
DestroyParticleSystem("bloodboil");
StopSound("bloodboil",1);
AddTimer("fadeoutblood", 0.3, "TimerBoilEffectFadeOutBlood");
SetPropActiveAndFade("boiled_blood", true, 0.5);
PlaySoundAtEntity("boildone","puzzle_acid", "AreaBloodBoil", 0, false);
}
void TimerBoilEffectFadeOutBlood(string &in asTimer)
{
SetPropActiveAndFade("glass_container_blood_static_1", false, 0.5);
}
|