Frictional Games Forum
[SOLVED] Lights on script - Printable Version

+- Frictional Games Forum (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: [SOLVED] Lights on script (/thread-29654.html)



[SOLVED] Lights on script - Aletho - 02-24-2015

Hey guys!

I'm a bit rusty in creating custom stories, I've just returned to doing it because of a project in school. I'm trying to create a script area where the lights throughout the building becomes lit, in a sequence. My problem is that nothing happens when the player enters the script area, it won't even activate the first torch.

What am I missing? Probably something very simple Big Grin

here's the script:
Spoiler below!

void OnStart()

{
SetPlayerMoveSpeedMul(1);
}




void OnEnter()
{
SetPlayerMoveSpeedMul(1);
}

// Functions
void Teleport1(string &in asParent, string &in asChild, int alState)
{

}

void TorchOnSchool(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("torch_start1", true);
AddTimer("torch_start23", 2, "LightsOnSchool");
AddTimer("torch_start45", 4, "LightsOnSchool");
AddTimer("torch_start67", 6, "LightsOnSchool");
}

void LightsOnSchool(string &in asTimer)
{
if(asTimer == "torch_start23")
{
SetEntityActive("torch_start2", true);
SetEntityActive("torch_start3", true);
}
if(asTimer == "torch_start45")
{
SetEntityActive("torch_start4", true);
SetEntityActive("torch_start5", true);
}
if(asTimer == "torch_start67")
{
SetEntityActive("torch_start6", true);
SetEntityActive("torch_start7", true);
}
}

void OnLeave()
{
}


//////////////////////
//Functions
void test_this(string &in asEntity, string &in type)
{

}


The name of the script area is "TorchOnSchool"


RE: Lights on script - Daemian - 02-24-2015

You're missing the callback declaration inside OnStart

I'm guessing you want one for that TorchOnSchool function with those parameters, so you need a collide callback. If I'm not mistaken it's AddEntityCollideCallback ( parent, child, function, deleteOnUse, state );
Just check the wiki. got the link?


RE: Lights on script - Aletho - 02-24-2015

(02-24-2015, 09:06 PM)Daemian Wrote: You're missing the callback declaration inside OnStart

I'm guessing you want one for that TorchOnSchool function with those parameters, so you need a collide callback. If I'm not mistaken it's AddEntityCollideCallback ( parent, child, function, deleteOnUse, state );
Just check the wiki. got the link?

Yeah I have the link to the wiki and I found the function you're referring to, i'm going to try it out tomorrow, thanks for the help! :-)