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
The secret door
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#1
The secret door

Hello everyone:
I have a problem. In the main story, at the beggining, after reading the note from Daniel to himself, you must use a lever. That lever moves a shelf, but moves a secret door too. That secret door is just as a castle wall. I wanted to use that with a button but i don't know what could the script be. Is just different? Well, i will put the script in here, if there's something wrong.

/////////////////////////////////////////////////////////////////////////////

void OnStart ()
{
SetLocalVarInt("Var1", 0);
SetEntityPlayerInteractCallback("button_simple_1", "Secret_move", true);
SetEntityCallbackFunc("key_study_1", "Monster");
SetEntityConnectionStateChangeCallback("Lever_1", "func_shelf");
}

void Monster (string &in asEntity, string &in type)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
}

void Secret_move(string &in asEntity)
{
AddLocalVarInt("Var1", 1);
SD();
}

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

void SD()
{
if(GetLocalVarInt("Var1") == 1)
{
SetSwingDoorLocked("prison_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "prison_1", 0.5f, false);
}
}

void OnEnter ()
{

}

void OnLeave ()
{

}

///////////////////////////////////////////////////////

Is simple: A button opens the secret door (yes, the script doesn't say that, i know) behind the secret door there is a lever that moves a shelf. Behind that shelf there is a corridor, you push a button and a door opens.
How i could script that? I have a limited experience (i know the basics, like triggering monsters, keys, and other things) but the secret door escapes to my understanding.

PS: My english isn't the best, but i do what i can Undecided

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
08-07-2012, 12:23 PM
Find
The Shanus Offline
Member

Posts: 134
Threads: 15
Joined: Jun 2012
Reputation: 3
#2
RE: The secret door

Perhaps just use addforceprop or whatever function for it to move the shelf? That seems pretty simple - I dont see why it shouldnt work. What I don't understand is why you want a button, a lever, and a button straight after each other. It seems a bit pointless to me? A bit repetitive too. Just have a hidden button/ lever somewhere in the room which moves the shelves, and have the shelf move so that you can go to the door at the end, instead of having to do the same thing over and over.

[Image: theshanusyoutube.jpg]
08-07-2012, 05:10 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: The secret door

I'm not 100% certain I understand exactly what you're trying to do. You want to press a button, that button opens a door, behind that door is a lever, when pulled the lever opens a secret shelf? Also, what't the name of the secret shelf? It appears that you are using 2 seperate names ("shelf_secret_door_rot_1" and "shelf_move_1"), or is that just an area you're using to play a sound at? Anyways, here's what I came up with:

When the player interacts with the button, the door will be unlocked. When the lever is pulled, the secret shelf will move:

void OnStart()
{
SetEntityPlayerInteractCallback("button_simple_1", "Secret_move", true);
SetEntityCallbackFunc("key_study_1", "Monster");
ConnectEntities("", "Lever_1", "shelf_secret_door_rot_1", false, 1, "func_shelf");
}

void Monster(string &in asEntity, string &in asType)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_13", 0, "");
}

void Secret_move(string &in asEntity)
{
SetSwingDoorLocked("prison_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "prison_1", 0.5f, false);
}

void func_shelf(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
}


void OnEnter ()
{

}

void OnLeave ()
{

}

Hope that helped ._.

I rate it 3 memes.
08-07-2012, 05:26 PM
Find




Users browsing this thread: 1 Guest(s)