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
Unlock level door?
Gladoshatesyou Offline
Junior Member

Posts: 20
Threads: 5
Joined: Apr 2014
Reputation: 0
#1
Unlock level door?

I can use scripts to unlock a normal door, easy. But when I try with a level door, it never works. Maybe some thing in effect is the fact that the level door is always like the 2nd locked door in the level so maybe its just a matter of combining scripts, but here you go. Here is my script- (castle_1 is the level door.)

void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_tomb", "castle_1", "UseKeyOnDoor2", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "Script_Scare", "Scare", true, 1);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("character_infected_1", true);
SetEntityActive("deformed_man_7", true);
SetEntityActive("deformed_man_8", true);
SetEntityActive("deformed_man_9", true);
SetEntityActive("deformed_man_10", true);
SetEntityActive("deformed_man_11", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 4, "");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_door_1", 0, false);
RemoveItem(asItem);
}
void UseKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem(asItem);
}
void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_12", true);
SetEntityActive("deformed_man_13", true);
SetEntityActive("deformed_man_14", true);
SetEntityActive("deformed_man_15", true);
}
void MoveShelf(string &in asEntity, int alState)
{
if (GetLocalVarInt("Check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);

PlaySoundAtEntity("", "quest_completed.snt", "Shelf", 0, false);

SetLocalVarInt("Check", 1);

return;
}
}
}
04-25-2014, 01:10 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Unlock level door?

When unlocking level doors, you must use the SetLevelDoorLocked script function rather than the SetSwingDoorLocked.

You can change the name of the block to UnlockLevelDoor if you wish, then use that script within. It takes the same parameters as swing doors except for the last boolean (effects). Basically:

SetLevelDoorLocked("castle_1", false);

(This post was last modified: 04-25-2014, 08:23 AM by Mudbill.)
04-25-2014, 08:23 AM
Find
Gladoshatesyou Offline
Junior Member

Posts: 20
Threads: 5
Joined: Apr 2014
Reputation: 0
#3
RE: Unlock level door?

(04-25-2014, 08:23 AM)Mudbill Wrote: When unlocking level doors, you must use the SetLevelDoorLocked script function rather than the SetSwingDoorLocked.

You can change the name of the block to UnlockLevelDoor if you wish, then use that script within. It takes the same parameters as swing doors except for the last boolean (effects). Basically:

SetLevelDoorLocked("castle_1", false);

Its still not working... Am I doing something wrong?

void OnStart()
{
AddUseItemCallback("", "key_study_1", "mansion_door_1", "UseKeyOnDoor", true);
AddUseItemCallback("", "key_tomb", "castle_1", "UnlockLevelDoor", true);
AddEntityCollideCallback("Player", "SpawnEnemy", "SpawnEnemy1", true, 1);
AddEntityCollideCallback("Player", "Script_Scare", "Scare", true, 1);
}
void SpawnEnemy1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("character_infected_1", true);
SetEntityActive("deformed_man_7", true);
SetEntityActive("deformed_man_8", true);
SetEntityActive("deformed_man_9", true);
SetEntityActive("deformed_man_10", true);
SetEntityActive("deformed_man_11", true);
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("character_infected_1", "PathNodeArea_11", 4, "");
}
void UseKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_door_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_door_1", 0, false);
RemoveItem(asItem);
}
void UnlockLevelDoor(string &in asItem, string &in asEntity)
{
SetLevelDoorLocked("castle_1", false);
PlaySoundAtEntity("", "unlock_door", "castle_1", 0, false);
RemoveItem(asItem);
}
void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("deformed_man_12", true);
SetEntityActive("deformed_man_13", true);
SetEntityActive("deformed_man_14", true);
SetEntityActive("deformed_man_15", true);
}
void MoveShelf(string &in asEntity, int alState)
{
if (GetLocalVarInt("Check") == 0)
{
if (alState == 1)
{
SetMoveObjectState("Shelf", 1);

PlaySoundAtEntity("", "quest_completed.snt", "Shelf", 0, false);

SetLocalVarInt("Check", 1);

return;
}
}
}
04-25-2014, 12:17 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#4
RE: Unlock level door?

Ok, do you here the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
NEXT time do this : here is an example;
INSERT FORMATTED CODE + SPOILER = if you have a HUGH script in the SPOILER is way more easy to read. Just a hint to you.

Spoiler below!

PHP Code: (Select All)
ONSTART
{
bla bla
}

void scriptstart.
{



You can make a spoiler like this [spooiler] TEXT [/spooiler] BOTH with 1 o (spoiler) I can not do it with 1 o (spoiler) now or you will see the spoiler Tongue hehee
(This post was last modified: 04-25-2014, 01:32 PM by DnALANGE.)
04-25-2014, 01:26 PM
Find
Gladoshatesyou Offline
Junior Member

Posts: 20
Threads: 5
Joined: Apr 2014
Reputation: 0
#5
RE: Unlock level door?

(04-25-2014, 01:26 PM)DnALANGE Wrote: Ok, do you here the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
NEXT time do this : here is an example;
INSERT FORMATTED CODE + SPOILER = if you have a HUGH script in the SPOILER is way more easy to read. Just a hint to you.

Spoiler below!

PHP Code: (Select All)
ONSTART
{
bla bla
}

void scriptstart.
{



You can make a spoiler like this [spooiler] TEXT [/spooiler] BOTH with 1 o (spoiler) I can not do it with 1 o (spoiler) now or you will see the spoiler Tongue hehee
I think I see what you are saying, but it doesnt really help...
04-25-2014, 01:33 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#6
RE: Unlock level door?

It was just a HINT.
Now read my post again please ;
---
Ok, do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
(This post was last modified: 04-25-2014, 01:35 PM by DnALANGE.)
04-25-2014, 01:35 PM
Find
Gladoshatesyou Offline
Junior Member

Posts: 20
Threads: 5
Joined: Apr 2014
Reputation: 0
#7
RE: Unlock level door?

(04-25-2014, 01:35 PM)DnALANGE Wrote: It was just a HINT.
Now read my post again please ;
---
Ok, do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.

I dont know if you understand Tongue I suck a scripting. Big Grin I dont know shit. I just copy and paste and look up tutorials, so...
04-25-2014, 01:38 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#8
RE: Unlock level door?

hmm...
With all the respect Glado*
you NEED to know what you are doing.
at least a little bit.
Everyone here started as you, knowing very less to none at all.
What you should do is open someone elses custom story. ( or the main game )
and open their maps \ and scripts.
See how they added the scriptarea's \ named doors \ how they added the scripts in the .hps etc etc..
---
You should check that and learn by some people their maps.
Also see some tutorials here on the forum or on youtube.
if you dont know what you are doing we arent really here to help is we just give you the scripts.
we arent here 24\7 { well.. sorta but we cant help every minute }
-
Just try to understand what what does and make mistakes, like all of us!

IF you tried hard we are here to help you offcourse!

Just try to learn and check \ double check things like : Names \ scriptfunction.

Give that a shot and let us know if we need to help more.
(This post was last modified: 04-25-2014, 01:48 PM by DnALANGE.)
04-25-2014, 01:47 PM
Find
Gladoshatesyou Offline
Junior Member

Posts: 20
Threads: 5
Joined: Apr 2014
Reputation: 0
#9
RE: Unlock level door?

(04-25-2014, 01:47 PM)DnALANGE Wrote: hmm...
With all the respect Glado*
you NEED to know what you are doing.
at least a little bit.
Everyone here started as you, knowing very less to none at all.
What you should do is open someone elses custom story. ( or the main game )
and open their maps \ and scripts.
See how they added the scriptarea's \ named doors \ how they added the scripts in the .hps etc etc..
---
You should check that and learn by some people their maps.
Also see some tutorials here on the forum or on youtube.
if you dont know what you are doing we arent really here to help is we just give you the scripts.
we arent here 24\7 { well.. sorta but we cant help every minute }
-
Just try to understand what what does and make mistakes, like all of us!

IF you tried hard we are here to help you offcourse!

Just try to learn and check \ double check things like : Names \ scriptfunction.

Give that a shot and let us know if we need to help more.

Well I mean I know how to have like multiple scripts, or like do notes and stuff but is someone sat me down and said like "Do this" I woudnt know what to do. I look up tutorials all the time on YouTube also! Smile
04-25-2014, 01:56 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#10
RE: Unlock level door?

thats how we all do\did.
We look and search and try and try!
if i \ we \ you cant fix it, we can ask the "more knowledged" guys here on the forum.

So i ask you again.
When you insert the key on the LEVELDOOR ;
Do you hear the unlock sound AND does your key get removed?
We start from the beginning to help you out here.
04-25-2014, 02:03 PM
Find




Users browsing this thread: 3 Guest(s)