Frictional Games Forum (read-only)
How to make Candle Go out? - 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: How to make Candle Go out? (/thread-11454.html)

Pages: 1 2


RE: How to make Candle Go out? - GreyFox - 11-22-2011

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Start", "CollideStart", true, 1);
}

void CollideStart(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_1", false, true);
}

Theres my script... It's just a test so I can do this later on.

And what do you mean just put it in the void OnStart Parameters

Code:
////////////////////////////
// Run first time starting map
void OnStart(Here?)
{
Or Here?
}

Thanks
-Grey Fox



RE: How to make Candle Go out? - Your Computer - 11-22-2011

(11-22-2011, 02:10 AM)GreyFox Wrote: Mind Posting your Script real quick? Very odd, and I have a second question if you wouldn't mind.

Can you Make something happen When you enter the Map. IE The way I've been doing it is, I Want a Timer right at the start of the map I Make a Script area (At the 1st playerstartarea) and Name it Start

Is there a way where I don't need that and Can just add anything? (it gets quite alot of scripting when you have to type similar things 15 times)

All my script had was SetLampLit in OnStart.

As for your other question, why not just add the timer in OnEnter?

(11-22-2011, 02:51 AM)GreyFox Wrote: Theres my script... It's just a test so I can do this later on.

In that case you may want to add a debug message in the collide callback to see if it gets triggered. Is "Start" a Script area or PlayerStart area? PlayerStart areas don't "support" entity collisions.


RE: How to make Candle Go out? - GreyFox - 11-22-2011

debug messages only show up in a dev enviorment correct?

and "Start" is a Script/Trigger Area.

Thanks
-Grey Fox



RE: How to make Candle Go out? - Statyk - 11-22-2011

(11-22-2011, 12:36 PM)GreyFox Wrote: debug messages only show up in a dev enviorment correct?

and "Start" is a Script/Trigger Area.

Thanks
-Grey Fox
Type something like this in your .hps:
//______________________

void OnStart()
{
AddTimer("", TIME, "CALLBACK_FUNC_NAME");
}

void CALLBACK_FUNC_NAME(string &in asTimer)
{
//What happens after the time runs out.
}



RE: How to make Candle Go out? - GreyFox - 11-23-2011

I Found out why it wasn't work.

My .HPS was named Entance, instead of Entrance... Damn do I feel retarded. haha

I Have another question though.

I Don't use levers alot, and I Have a Bathroom, and I though it'd be cool if you could turn the water on and off.

So I go the lever turning the water on just not off. would you mind helping me get it so when I pull up on the leave the particle system disappears.

Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddTimer("", 5, "Light");
SetEntityConnectionStateChangeCallback("Button1", "StartWater");
}

void Light(string &in asTimer)
{
    SetLampLit("modern_mine_flour_light_shadowH_6", false, false);
}

void StartWater(string &in asEntity, int alState)
{
    if (alState == 1)
    {
    CreateParticleSystemAtEntity("", "ps_water_stream.ps", "WaterPS1", false);
        return;
    }
}

Thanks
-Grey Fox


RE: How to make Candle Go out? - Your Computer - 11-23-2011

(11-23-2011, 02:09 AM)GreyFox Wrote: I Don't use levers alot, and I Have a Bathroom, and I though it'd be cool if you could turn the water on and off.

So I go the lever turning the water on just not off. would you mind helping me get it so when I pull up on the leave the particle system disappears.

One thing you should get used to doing is providing an internal name where allowed. You can't destroy a particle system if you don't have any way of differentiating it from the rest.

PHP Code:
void StartWater(string &in asEntityint alState)
{
    
/* 
     *  You should consider naming your areas asEntity + "_area" like i have done with
     *     the particle systems. You should be able to understand what i mean by that.
     *  In this way you can use this function for all bathroom "levers."
     */
    
if (alState == 1)
        
CreateParticleSystemAtEntity(asEntity "_ps""ps_water_stream.ps"asEntity "_area"false);
    else
        
DestroyParticleSystem(asEntity "_ps");