03-22-2014, 05:18 AM
Hey guys. I just made a Lantern Overheat script a while ago and decided to probably make it a little interesting so that each time you turned it on the overheating period will be longer.
SCRIPT:
But if we see the workflow that means that when it's picked up, a callback will define what is overheating and then the script automatically starts a 90 second timer. And if I were to turn it on it'll add 0.30f to the LocalVarFloat. And it checks whether it's longer or not.
And this is where the problem started. It's more what have to do with workflow. I have a 90 second timer but the thing is that if in that timer I do not turn on the lantern then the script won't be useful.
So the question is that, What is the thing that I could do so that the Lantern script will be executed in that 90 second timer since turning it on is the up to the Player and the intro takes at least 90 - 120 seconds.
SCRIPT:
Spoiler below!
PHP Code:
void OnStart()
{
SetLocalVarFloat("OverheatLantern", 0);
SetLocalVarInt("TimerDetect", 0);
SetEntityCallbackFunc("ModLantern", "DefineLanternOverheat");
AddTimer("mypenis", 90.0f, "Overheat");
}
///---LANTERN OVERHEAT SCRIPT---///
void DefineLanternOverheat(string &in asEntity, string &in type)
{
if(GetLanternActive() == true)
{
AddLocalVarInt("TimerDetect", 1);
AddTimer("TIMEROVERHEAT", 60.0f, "TimerLantern");
AddDebugMessage("I have one message for you.", false);
}
else if(GetLanternActive() == false)
{
if(GetLocalVarInt("TimerDetect") == 1)
{
RemoveTimer("TIMEROVERHEAT");
}
}
}
void TimerLantern(string &in asTimer)
{
AddLocalVarFloat("OverheatLantern", 0.30f);
}
void Overheat(string &in asTimer)
{
if(GetLocalVarFloat("OverheatLantern") == 0.0f && GetLocalVarInt("TimerDetect") == 0)
{
AddTimer("", 120.0f, "OverheatTimerStart");
SetLanternActive(false, true);
SetLanternDisabled(true);
}
else if(GetLocalVarFloat("OverheatLantern") == 0.30f && GetLocalVarInt("TimerDetect") == 1)
{
AddTimer("", 150.0f, "OverheatTimerStart");
SetLanternActive(false, true);
SetLanternDisabled(true);
}
else if(GetLocalVarFloat("OverheatLantern") == 0.60f && GetLocalVarInt("TimerDetect") == 2)
{
AddTimer("", 180.0f, "OverheatTimerStart");
SetLanternActive(false, true);
SetLanternDisabled(true);
}
else if(GetLocalVarFloat("OverheatLantern") == 0.90f && GetLocalVarInt("TimerDetect") == 3)
{
AddTimer("", 210.0f, "OverheatTimerStart");
SetLanternActive(false, true);
SetLanternDisabled(true);
}
AddDebugMessage("...Dickbutt", false);
}
void OverheatTimerStart(string &in asTimer)
{
SetLanternDisabled(false);
}
///---LANTERN OVERHEAT SCRIPT---///
But if we see the workflow that means that when it's picked up, a callback will define what is overheating and then the script automatically starts a 90 second timer. And if I were to turn it on it'll add 0.30f to the LocalVarFloat. And it checks whether it's longer or not.
And this is where the problem started. It's more what have to do with workflow. I have a 90 second timer but the thing is that if in that timer I do not turn on the lantern then the script won't be useful.
So the question is that, What is the thing that I could do so that the Lantern script will be executed in that 90 second timer since turning it on is the up to the Player and the intro takes at least 90 - 120 seconds.