Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lantern Overheating (Intermediate)
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#1
Lantern Overheating (Intermediate)

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: (Select All)
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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 03-22-2014, 05:33 AM by PutraenusAlivius.)
03-22-2014, 05:18 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#2
RE: Lantern Overheating (Intermediate)

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!
03-22-2014, 02:03 PM
Find
Wapez Offline
Senior Member

Posts: 360
Threads: 37
Joined: Mar 2012
Reputation: 19
#3
RE: Lantern Overheating (Intermediate)

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.

Founder & Legally Accountable Publisher of Red Line Games.
Environment & Gameplay Designer and Scripter.
http://moddb.com/mods/in-lucys-eyes
03-22-2014, 02:05 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#4
RE: Lantern Overheating (Intermediate)

(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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 03-23-2014, 01:15 AM by PutraenusAlivius.)
03-23-2014, 01:11 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#5
RE: Lantern Overheating (Intermediate)

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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-23-2014, 02:26 PM
Find
Apfel Offline
Junior Member

Posts: 19
Threads: 3
Joined: Jun 2011
Reputation: 1
#6
RE: Lantern Overheating (Intermediate)

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)
03-23-2014, 04:03 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: Lantern Overheating (Intermediate)

(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.

"Veni, vidi, vici."
"I came, I saw, I conquered."
03-23-2014, 04:16 PM
Find




Users browsing this thread: 1 Guest(s)