Frictional Games Forum (read-only)
I need help making my secret shilf open. - 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: I need help making my secret shilf open. (/thread-10361.html)



I need help making my secret shilf open. - Dilzilla - 09-16-2011

so i have my lever connected to my shelf and my code.....but i've never done code and im lost.... can some one help?

Code:
////////////////////////////
// Run when entering map
void OnEnter()

OnStart
{
SetEntityConnectionStateChangeCallback("secret_lever", "StateChangeLever");
}

void StateChangeLever(string &in asEntity, int alState)
{
if(alState == 1){
SetLeverStuckState(asEntity, 1, true);
SetMoveObjectState("secret_shelf", 1.0f);
}



////////////////////////////
// Run when leaving map
void OnLeave()
{

}



RE: I need help making my secret shilf open. - Dilzilla - 09-17-2011

i now have the code and it works however the shelf moves backwards....how can i make it move sideways?
Code:
//===========================================
// Starter's Script File!
//===========================================

//===========================================
// This runs when the map first starts
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_1", "func_shelf");
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");
SetPlayerLampOil(100.0f);

for(int i = 0;i < 10;i++)
{
GiveItemFromFile("tinderbox", "tinderbox.ent");
}
}
}

//===========================================
// This runs when the player enters the map
void OnEnter()
{
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("sdoor_1",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}


//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}