Karai16
Member
Posts: 164
Threads: 24
Joined: Apr 2011
Reputation:
0
|
Level door
Hey guys,
I need to fix something: I've locked my level door, but I can still go through it, even though it's locked. Is there a way I can only make the shifting map code of my script work if the door is open?
Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
|
|
05-06-2011, 11:46 PM |
|
dragonlordsd
Member
Posts: 112
Threads: 7
Joined: May 2011
Reputation:
0
|
RE: Level door
you mean you can still open it, or that you can walk through it?
|
|
05-06-2011, 11:49 PM |
|
Karai16
Member
Posts: 164
Threads: 24
Joined: Apr 2011
Reputation:
0
|
RE: Level door
(05-06-2011, 11:49 PM)dragonlordsd Wrote: you mean you can still open it, or that you can walk through it?
I am able to use it, as in opening it, and go to the other map, even though it's locked.
Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
|
|
05-06-2011, 11:51 PM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Level door
If in the editor it says it is locked, then check your files and delete the .mapcache file for your map if it is there.
|
|
05-06-2011, 11:57 PM |
|
Karai16
Member
Posts: 164
Threads: 24
Joined: Apr 2011
Reputation:
0
|
RE: Level door
(05-06-2011, 11:57 PM)Kyle Wrote: If in the editor it says it is locked, then check your files and delete the .mapcache file for your map if it is there.
I tried it, it doesn't work, to help you think of a solution, I'll give you the code I'm using:
void OnStart()
{
AddUseItemCallback("", "TowerKey", "TowerDoor", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("TowerDoor", "TeleportFunction", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("TowerDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "TowerDoor", 0, false);
RemoveItem("TowerKey");
}
void TeleportFunction(string &in asEntity)
{
ChangeMap("Custom02", "PlayerStartArea_1", "", "");
}
do I maybe have to do something with an if-statement? It does look like it, but I don't know how to use it, or if it can be used in hps language.
Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
|
|
05-07-2011, 12:27 AM |
|
dragonlordsd
Member
Posts: 112
Threads: 7
Joined: May 2011
Reputation:
0
|
RE: Level door
Umm... why are you teleporting the player to change maps? Doesn't the door just automatically link to the next map?
|
|
05-07-2011, 12:41 AM |
|
Kyle
Posting Freak
Posts: 911
Threads: 36
Joined: Sep 2010
Reputation:
7
|
RE: Level door
(05-07-2011, 12:41 AM)dragonlordsd Wrote: Umm... why are you teleporting the player to change maps? Doesn't the door just automatically link to the next map?
Yeah, it does.
I see your mistake, you added a interact callback; that means that when ever the player touches the door, he teleports.
void OnStart()
{
AddUseItemCallback("", "TowerKey", "TowerDoor", "UsedKeyOnDoor", true);
SetEntityPlayerInteractCallback("TowerDoor", "TeleportFunction", true);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("TowerDoor", false, true);
PlaySoundAtEntity("", "unlock_door", "TowerDoor", 0, false);
RemoveItem("TowerKey");
}
void TeleportFunction(string &in asEntity)
{
if (GetSwingDoorLocked("TowerDoor") == false)
{
ChangeMap("Custom02", "PlayerStartArea_1", "", "");
}
}
This might work? But it's not a swing door. :/
Whoops... Alright, fixed that.
(This post was last modified: 05-07-2011, 12:48 AM by Kyle.)
|
|
05-07-2011, 12:43 AM |
|
Roenlond
Senior Member
Posts: 331
Threads: 3
Joined: Apr 2011
Reputation:
0
|
RE: Level door
I'd remove all the scripting and just go via the level editor for level doors, it's a lot easier.
|
|
05-07-2011, 01:54 AM |
|
Karai16
Member
Posts: 164
Threads: 24
Joined: Apr 2011
Reputation:
0
|
RE: Level door
I tried doing it in the level editor, but now the key won't unlock the door... :/
Custom stories:
Her Games (100% Complete)
Her Games, All Bugs Fixed (100% Complete)
|
|
05-07-2011, 09:37 AM |
|
Russ Money
Senior Member
Posts: 360
Threads: 25
Joined: Dec 2010
Reputation:
4
|
RE: Level door
(05-07-2011, 09:37 AM)Karai16 Wrote: I tried doing it in the level editor, but now the key won't unlock the door... :/
The command you're looking for, to set the level door unlocked is this:
SetLevelDoorLocked(string& asName, bool abLocked);
Swing doors are the doors that move when push or pulled.
|
|
05-07-2011, 10:19 AM |
|
|