Frictional Games Forum (read-only)
Lantern Overheating (Intermediate) - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Lantern Overheating (Intermediate) (/thread-24901.html)



Lantern Overheating (Intermediate) - PutraenusAlivius - 03-22-2014

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:
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 asEntitystring &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(falsetrue);
    
SetLanternDisabled(true);
    }
    
    else if(
GetLocalVarFloat("OverheatLantern") == 0.30f && GetLocalVarInt("TimerDetect") == 1)
    {
    
AddTimer(""150.0f"OverheatTimerStart");
    
SetLanternActive(falsetrue);
    
SetLanternDisabled(true);
    }

    else if(
GetLocalVarFloat("OverheatLantern") == 0.60f && GetLocalVarInt("TimerDetect") == 2)
    {
    
AddTimer(""180.0f"OverheatTimerStart");
    
SetLanternActive(falsetrue);
    
SetLanternDisabled(true);
    }

    else if(
GetLocalVarFloat("OverheatLantern") == 0.90f && GetLocalVarInt("TimerDetect") == 3)
    {
    
AddTimer(""210.0f"OverheatTimerStart");
    
SetLanternActive(falsetrue);
    
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.


RE: Lantern Overheating (Intermediate) - DnALANGE - 03-22-2014

Lol @ : ("...Dickbutt...
Nice feature man, you Always come up with cool stuff.
Too bad i stopped working on the HPL...
Otherwise i would use it!


RE: Lantern Overheating (Intermediate) - Wapez - 03-22-2014

Hi,

I feel like I'm almost getting the hang of this, but could you please specify what your custom variables are for?

TimerDetect, OverheatLantern

Also, what's up with the first 90 seconds timer? Is the lantern supposed to overheat after exactly 90 seconds?

It might just be me being tired and stupid, but I'd like to try and help you.


RE: Lantern Overheating (Intermediate) - PutraenusAlivius - 03-23-2014

(03-22-2014, 02:05 PM)Wapez Wrote: Hi,

I feel like I'm almost getting the hang of this, but could you please specify what your custom variables are for?

TimerDetect, OverheatLantern

Also, what's up with the first 90 seconds timer? Is the lantern supposed to overheat after exactly 90 seconds?

It might just be me being tired and stupid, but I'd like to try and help you.

The TimerDetect is for detecting the timer that will overheat so that if the Player turned on the lantern and immediately turned it off the overheat won't take effect.

The OverheatLantern is for detecting the overheating period. 0.30 is 120 seconds, 0.60 is 150 seconds and so on.

The 90 second timer is for defining how long the overheating period should be and the requirements.

@DnALange
I like to put funny things in my script.


RE: Lantern Overheating (Intermediate) - PutraenusAlivius - 03-23-2014

Sorry to double post, but since the 90 second timer is used for defining, can I create a new function instead? That would be more viable and efficient.


RE: Lantern Overheating (Intermediate) - Apfel - 03-23-2014

Hi there,


I just had a short look at your script, but I would start creating a lantern overheat with the following function:


void SetLanternLitCallback(string& asCallback);

Sets the function to call when the player uses his lantern.
Callback syntax: MyFunc(bool abLit)


RE: Lantern Overheating (Intermediate) - PutraenusAlivius - 03-23-2014

(03-23-2014, 04:03 PM)Apfel Wrote: Hi there,


I just had a short look at your script, but I would start creating a lantern overheat with the following function:


void SetLanternLitCallback(string& asCallback);

Sets the function to call when the player uses his lantern.
Callback syntax: MyFunc(bool abLit)

Eh I should of used that. But nevermind.