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
Emergency Flare
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#1
Emergency Flare

Hello everyone

So this is a little thing I have wanted to do for a while and now I finally got it everything I need and got it working so I want to share it with the forum.

So this is an Emergency flare that spawns on a script area that will light up areas for you but will burn out after a certain amount of time which makes it an alternate portable light source that has some dynamics in it Smile

Picture of it in action
[Image: dq6gbo.jpg]

This package comes with a Flare model, Flare sound and some burning flare particles. And if you want to use it you need to place each folder in it's certain category. Flare goes in to Entities, Flare_sound to sound folder and flare_particles goes into the particle folder (remember to add these components to your CS folder if you are going to use it Smile

Here's the code to make it work

Put this code inside void OnStart()
SpawnFlareAtArea("EmergencyFlare", "SpawnFlare", 0.79f);

So I'm going to break down this code so you can change it yourself.

EmergencyFlare: is the name of the Flare (it's not that relevant so just keep it.)
SpawnFlare: is the name of the Script Area you want to spawn the flare.
0.79f: is the Burn Time for the Flare, you can change it to what ever you want (Remember that the higher the number is the longer it will burn and right now it burns for around 1 minute)

Here's the rest of the code that you just have to copy and paste in to your .hps
//////////////////////////
//Emergency Flare Script//
const string _FlareOBJ = "Flare.ent";
void SpawnFlareAtArea(string &in flareName, string &in areaTarget, float burnTime)
{
    CreateEntityAtArea(flareName, _FlareOBJ, areaTarget, true);
    SetLocalVarFloat(flareName+"_time", burnTime >= 1.0f ? 0.999f : burnTime);
    SetEntityPlayerInteractCallback(flareName, "InteractFlare", true);
    AddDebugMessage("Flare Spawned", true);
}

void InteractFlare(string &in entity)
{
    CreateParticleSystemAtEntity("PFlare", "ps_flare_sparkles", entity, false);
    FadeLightTo(entity+"_FlareLight", 1.0f, 0.1f, 0.0f, 0.7f, -1, 1.5f);
    PlaySoundAtEntity("SFlare", "flare_loop.snt", entity, 1, false);
    BurnLoop(entity);
    AddDebugMessage("Picked :" +entity, true);
}

void BurnLoop(string &in timer)
{
    if(GetLocalVarFloat(timer+"_time") <= 0.0f)
    {
        StopFlareParticles("PFlare", "SFlare");
        return;
    }
    AddLocalVarFloat(timer+"_time", -0.00035f);
    AddTimer(timer, 0.0166f, "BurnLoop");
    AddDebugMessage("Time: "+GetLocalVarFloat(timer+"_time"), false);
}

void StopFlareParticles(string &in ParticleName, string &in SoundName)
{
        DestroyParticleSystem(ParticleName);
        StopSound(SoundName, 1.5f);
        FadeLightTo("EmergencyFlare"+"_FlareLight", 0, 0, 0, 0, -1, 1);
}
//End Flare Script//
/////////////////////

If you have any questions feel free to ask them and I will be glad to answer Smile

CREDIT
Traggey for making me the Flare model (since my own sucked x))
DarkAdders for making the particles system for the flare (also since my own sucked)
Palistov for the source and gave me the inspiration and knowledge to do this
Frictional Games for making the Flare sound (it's from penumbra)

DOWNLOAD V1.1
Updated it by changing side of the flare so it don't collide with the lantern

(This post was last modified: 06-18-2012, 08:32 PM by SilentStriker.)
06-17-2012, 10:50 AM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#2
RE: Emergency Flare

Do you have to have a total conversion?

Hi.
06-17-2012, 11:23 AM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#3
RE: Emergency Flare

Nope, since it's not a lantern it works on any CS and any FC Smile It's just an entity I played around with so when you grab it you will hold it like a lantern then you can throw it away and have a flare lighting up an area without you holding it ^^ That's why I said it's an alternative light source Wink

(This post was last modified: 06-17-2012, 11:26 AM by SilentStriker.)
06-17-2012, 11:26 AM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#4
RE: Emergency Flare

(06-17-2012, 11:26 AM)SilentStriker Wrote: Nope, since it's not a lantern it works on any CS and any FC Smile It's just an entity I played around with so when you grab it you will hold it like a lantern then you can throw it away and have a flare lighting up an area without you holding it ^^
Oh good, so it's an entity that just lights up when you touch it


good thing i can use it in a custom story but that's the flaw, is there no way to light it up when you want to instead?


looks sweet though Smile

Hi.
06-17-2012, 11:27 AM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#5
RE: Emergency Flare

(06-17-2012, 11:27 AM)CrazyArts Wrote:
(06-17-2012, 11:26 AM)SilentStriker Wrote: Nope, since it's not a lantern it works on any CS and any FC Smile It's just an entity I played around with so when you grab it you will hold it like a lantern then you can throw it away and have a flare lighting up an area without you holding it ^^
Oh good, so it's an entity that just lights up when you touch it

good thing i can use it in a custom story but that's the flaw, is there no way to light it up when you want to instead?

looks sweet though Smile
Well since it's a flare you are supposed to touch it and light it Wink but if you change the SetEntityPlayerInteractCallback(flareName, "InteractFlare", true);

to maybe
AddEntityCollideCallback or something and then change the syntax on InteractFlare then you can have it light up when you want instead of touching it. But it's supposed to light up when YOU touch it since flares don't start burning by themselves Wink (But if you want to have like a flare laying in a corner already burned then you can make it start burning from the beginning pretty much but remember that it burns out after a certain amount of time

06-17-2012, 11:31 AM
Find
MaZiCUT Offline
Senior Member

Posts: 536
Threads: 31
Joined: Jun 2012
Reputation: 17
#6
RE: Emergency Flare

(06-17-2012, 11:31 AM)SilentStriker Wrote:
(06-17-2012, 11:27 AM)CrazyArts Wrote:
(06-17-2012, 11:26 AM)SilentStriker Wrote: Nope, since it's not a lantern it works on any CS and any FC Smile It's just an entity I played around with so when you grab it you will hold it like a lantern then you can throw it away and have a flare lighting up an area without you holding it ^^
Oh good, so it's an entity that just lights up when you touch it

good thing i can use it in a custom story but that's the flaw, is there no way to light it up when you want to instead?

looks sweet though
Well since it's a flare you are supposed to touch it and light it Wink but if you change the SetEntityPlayerInteractCallback(flareName, "InteractFlare", true);

to maybe
AddEntityCollideCallback or something and then change the syntax on InteractFlare then you can have it light up when you want instead of touching it. But it's supposed to light up when YOU touch it since flares don't start burning by themselves Wink (But if you want to have like a flare laying in a corner already burned then you can make it start burning from the beginning pretty much but remember that it burns out after a certain amount of time
No i don't think a flare just lights up when you touch it, i meant what if i want to carry it around for a little while until i light it up, or maybe there can be different places with proper material to light them up? Like i have a flare that's not lit, then i find this gas leak and theres an area around that gas leak called LightFlare and when the flare comes in contact with it , it lights up Big Grin

Hi.
06-17-2012, 11:42 AM
Website Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#7
RE: Emergency Flare

Well then you change the SetEntityPlayerInteract to AddEntityCollideCallback but the problem then you need to change a bit in the code, for example every part of the code were it says entity pretty much x)

06-17-2012, 12:08 PM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#8
RE: Emergency Flare

(06-17-2012, 12:08 PM)SilentStriker Wrote:
PHP Code: (Select All)
if(!GetPropIsInteractedWith(timer))
    {
        
SetEntityPlayerInteractCallback(timer"InteractFlashLightHUDobj"true);
        
    } 
Fix that. You've got an artifact from my source in there Wink

06-18-2012, 12:29 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#9
RE: Emergency Flare

Oops I thought I had removed that ^^

06-18-2012, 09:09 AM
Find
kartanonperuna Offline
Posting Freak

Posts: 755
Threads: 44
Joined: Oct 2011
Reputation: 8
#10
RE: Emergency Flare

Nice.

Voice actor

Painful shadows



07-16-2012, 03:55 PM
Website Find




Users browsing this thread: 1 Guest(s)