RaZoR~HaX
Junior Member
Posts: 5
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
Jordo76
Member
Posts: 57
Threads: 7
Joined: Sep 2010
Reputation:
0
|
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 |
|
RaZoR~HaX
Junior Member
Posts: 5
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
Jordo76
Member
Posts: 57
Threads: 7
Joined: Sep 2010
Reputation:
0
|
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 |
|
RaZoR~HaX
Junior Member
Posts: 5
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
fantino
Junior Member
Posts: 14
Threads: 2
Joined: Sep 2010
Reputation:
0
|
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 |
|
Jordo76
Member
Posts: 57
Threads: 7
Joined: Sep 2010
Reputation:
0
|
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 |
|
fantino
Junior Member
Posts: 14
Threads: 2
Joined: Sep 2010
Reputation:
0
|
RE: Help with a level that has more then two doors.
Thank you very much!
|
|
10-02-2010, 09:13 PM |
|
|