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
Help with a level that has more then two doors.
RaZoR~HaX Offline
Junior Member

Posts: 5
Threads: 2
Joined: Sep 2010
Reputation: 0
#1
Help with a level that has more then two doors.

I was wondering if someone could help me code the doors to my level. I can get one door in with void UseKey but when i try to add another door code it doesnt work, could someone help or explain this to me?
09-28-2010, 08:46 PM
Find
Jordo76 Offline
Member

Posts: 57
Threads: 7
Joined: Sep 2010
Reputation: 0
#2
RE: Help with a level that has more then two doors.

Easy,Here some example code :
void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem(asItem);
}


void OnStart()
{
AddUseItemCallback("useexit", "key_for_door_1", "door_1", "UseKey",true);
AddUseItemCallback("useexit", "key_for_door_2", "door_2", "UseKey",true);
}

I hope it help you !
09-28-2010, 09:46 PM
Website Find
RaZoR~HaX Offline
Junior Member

Posts: 5
Threads: 2
Joined: Sep 2010
Reputation: 0
#3
RE: Help with a level that has more then two doors.

(09-28-2010, 09:46 PM)Jordo76 Wrote: Easy,Here some example code :
void UseKey(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem(asItem);
}


void OnStart()
{
AddUseItemCallback("useexit", "key_for_door_1", "door_1", "UseKey",true);
AddUseItemCallback("useexit", "key_for_door_2", "door_2", "UseKey",true);
}

I hope it help you !

No I do that but it still doesnt work for me, I need an already premade code on how tomake it so there can be more then one locked door on a level without another door being a level door
09-30-2010, 03:40 PM
Find
Jordo76 Offline
Member

Posts: 57
Threads: 7
Joined: Sep 2010
Reputation: 0
#4
RE: Help with a level that has more then two doors.

The code i sent you work and if you want to add a door just do :
AddUseItemCallback("useexit", "name of the key", "name of the door", "UseKey",true);
After the 2 others
09-30-2010, 05:50 PM
Website Find
RaZoR~HaX Offline
Junior Member

Posts: 5
Threads: 2
Joined: Sep 2010
Reputation: 0
#5
RE: Help with a level that has more then two doors.

(09-30-2010, 05:50 PM)Jordo76 Wrote: The code i sent you work and if you want to add a door just do :
AddUseItemCallback("useexit", "name of the key", "name of the door", "UseKey",true);
After the 2 others

You are my hero
10-01-2010, 04:39 AM
Find
fantino Offline
Junior Member

Posts: 14
Threads: 2
Joined: Sep 2010
Reputation: 0
#6
RE: Help with a level that has more then two doors.

I have a problem with 2 locked doors. When i write this, one key open two doors.
void OnStart()

{
AddUseItemCallback("", "key_study_1", "mansion_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_study_2", "mansion_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlayMusic("safe.ogg", true, 1, 11, 1, true);
RemoveItem("key_study_1");

SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("key_study_2");
}

And when i write this, the game crash.
void OnStart()

{
AddUseItemCallback("", "key_study_1", "mansion_2", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_2", false, true);
PlayMusic("safe.ogg", true, 1, 11, 1, true);
RemoveItem("key_study_1");
}

{
AddUseItemCallback("", "key_study_2", "mansion_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_3", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_3", 0, false);
RemoveItem("key_study_2");
}

Can you help me please ?
10-02-2010, 06:10 PM
Find
Jordo76 Offline
Member

Posts: 57
Threads: 7
Joined: Sep 2010
Reputation: 0
#7
RE: Help with a level that has more then two doors.

Revised the Script :
void OnStart()

{
AddUseItemCallback("", "key_study_1", "mansion_2", "UsedKeyOnDoor", true);
AddUseItemCallback("", "key_study_2", "mansion_3", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", "Player", 0, false);
RemoveItem(asItem);
}
Explication : You have not use asItem in RemoveItem,asEntity in SwingDoorLocked
For the 2nd script,all is wrong,you don't have to do more than one void UsedKeyOnDoor
And sometimes you put an { } without void before,crashing the game...
10-02-2010, 08:29 PM
Website Find
fantino Offline
Junior Member

Posts: 14
Threads: 2
Joined: Sep 2010
Reputation: 0
#8
RE: Help with a level that has more then two doors.

Thank you very much! Tongue
10-02-2010, 09:13 PM
Find




Users browsing this thread: 2 Guest(s)