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
Different Level Door Question (scripting)
genmills Offline
Junior Member

Posts: 47
Threads: 7
Joined: Mar 2011
Reputation: 0
#1
Different Level Door Question (scripting)

Hello all!
I have a quick question. I am making an outdoor map that has several buildings, some of which will be locked. I want the doors to lead to new levels, but I want to use regular door models (castle doors, dungeon doors, etc.) instead of the "level" doors.

I know I can add an entity interact function that is triggered when the player clicks on a door, which causes the new level to load, but what do I do about locked doors? Is there a way I can make my function see if the door is unlocked or not before it loads the new level? Let me know if I am being clear enough. Thanks! Smile

p.s. My map is gonna be awesome! I scared myself so badly by accident today... I will try to post screens soon in another thread.
04-08-2011, 05:13 AM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#2
RE: Different Level Door Question (scripting)

Yea, you'd have to use variables to say whether the door is locked or not. For example:
if(GetLocalVarInt("Door")==1) //Door is locked, plays locked sound, etc.
if(GetLocalVarInt("Door")==2) //Door is unlocked, when clicked on it uses ChangeMap

You'd make it so when you use the key on the door, it would do SetLocalVarInt("Door", 2).

So yea, something like that.
04-08-2011, 05:37 AM
Find
Dalroc Offline
Member

Posts: 57
Threads: 2
Joined: Mar 2011
Reputation: 0
#3
RE: Different Level Door Question (scripting)

(04-08-2011, 05:37 AM)MrBigzy Wrote: Yea, you'd have to use variables to say whether the door is locked or not. For example:
if(GetLocalVarInt("Door")==1) //Door is locked, plays locked sound, etc.
if(GetLocalVarInt("Door")==2) //Door is unlocked, when clicked on it uses ChangeMap

You'd make it so when you use the key on the door, it would do SetLocalVarInt("Door", 2).

So yea, something like that.
Or he could use bool GetSwingDoorLocked(string& asName);
if(GetSwingDoorLocked(asEntity) == true){
    //Door is locked, plays locked sound, etc.
}
if(GetSwingDoorLocked(asEntity) == false){
    //Door is unlocked, when clicked on it uses ChangeMap
}
04-08-2011, 11:19 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#4
RE: Different Level Door Question (scripting)

Yea, that'll probably work better. Tongue
04-09-2011, 12:15 AM
Find
genmills Offline
Junior Member

Posts: 47
Threads: 7
Joined: Mar 2011
Reputation: 0
#5
RE: Different Level Door Question (scripting)

Sweet! Thanks guys! Smile

Just for clarification, in the part with "if(GetSwingDoorLocked(asEntity) == true) { }," I don't have to put anything in there right? It will just act as though it's locked.

Another quick question so I don't have to make another thread... Is it possible to make a plane inactive? I'm using "ground" planes flipped backwards as invisible walls to prevent a player from moving on until they have completed parts of the storyline and solved some of the mystery. I know you can set entities inactive, but I'm not sure if that only applies to what is in the entity category?

Also, I want to make a secret passage that is hidden by a regular rock. Is it possible to make a function that will move the rock? Thanks so much, and sorry for being such a noob! You'll like me again once you play my map, though, haha Smile
04-09-2011, 04:10 PM
Find
Dalroc Offline
Member

Posts: 57
Threads: 2
Joined: Mar 2011
Reputation: 0
#6
RE: Different Level Door Question (scripting)

(04-09-2011, 04:10 PM)genmills Wrote: Just for clarification, in the part with "if(GetSwingDoorLocked(asEntity) == true) { }," I don't have to put anything in there right? It will just act as though it's locked.
If nothing special is supposed to happen when it's locked you don't need any if conditional for that, just put the conditional that the door is unlocked in a function, like this.
void AwesomeFunction(Parameters)
{
    if(GetSwingDoorLocked(asEntity) == false)
    {
        //Door is unlocked, when clicked on it uses ChangeMap
    }
}
As there is nothing happening in the function except for when the door is unlocked, nothing will happen when the door is locked! Big Grin

(04-09-2011, 04:10 PM)genmills Wrote: Another quick question so I don't have to make another thread... Is it possible to make a plane inactive? I'm using "ground" planes flipped backwards as invisible walls to prevent a player from moving on until they have completed parts of the storyline and solved some of the mystery. I know you can set entities inactive, but I'm not sure if that only applies to what is in the entity category?
Try looking under "Technical" in the entities tab. There you have several type of invisible block boxes.

(04-09-2011, 04:10 PM)genmills Wrote: Also, I want to make a secret passage that is hidden by a regular rock. Is it possible to make a function that will move the rock? Thanks so much, and sorry for being such a noob! You'll like me again once you play my map, though, haha Smile
This one should be very possible, but I can't really think of how right now.. Try looking at the script functions on the wiki and searching the forums Smile
04-09-2011, 09:50 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#7
RE: Different Level Door Question (scripting)

How is the rock gonna move? If you're not gonna see it move at all, simple make the rock inactive with the SetEntityActive function. Otherwise, is there a specific way you want the rock to move? Explosion, a push, etc?
04-09-2011, 10:41 PM
Find
Andari Offline
Junior Member

Posts: 12
Threads: 3
Joined: Apr 2011
Reputation: 0
#8
RE: Different Level Door Question (scripting)

A bit OFF:
"if(GetSwingDoorLocked(asEntity) == false)"
Is it correct int the Form:
"if(!GetSwingDoorLocked(asEntity))"
(The Function returns bool, and (B is a bool)
!B is the same logical Function as B==False.)
(That was a question btw. I do not know what is the
scripts base langauge. (Java maybe?))
(This post was last modified: 04-13-2011, 01:27 PM by Andari.)
04-13-2011, 01:23 PM
Find




Users browsing this thread: 1 Guest(s)