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
Change lever function?
Storfigge Offline
Member

Posts: 101
Threads: 31
Joined: Sep 2012
Reputation: 0
#1
Change lever function?

I wonder if it's possible to change the function of a lever? What I want is that the first time you use the lever you end up in one map but when you use the same lever a second time I want it to move to another map.

You're suppose to go down an elevator and the first time it leads to a dream, after the dream you end up in a dungeon and from this map you can take the elevator back to the first map. Once your back in the first map you can again if you missed something take the elevator, this time the dream wont happen so you just return to the dungeons, hope it's not confusing :S

My original idea was that I could SetEntityActive False on the first lever and SetEntityActive True on another lever that will lead to the dungeons. But I wonder if there is an easier way.

(This post was last modified: 05-23-2013, 03:57 PM by Storfigge.)
05-23-2013, 03:51 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Change lever function?

You can use local var int's.
void OnStart()
{
SetEntityConnectionStateChangeCallback("LeverName", "ElevatorUse");
SetLocalVarInt("Dream", 1);
}

void ElevatorUse(string &in asEntity, int alState)
{
if(GetLocalVarInt("Dream") == 1) //Dream occur!
{
ChangeMap("MapName", "PlayerStartAreaInTheMap", "SoundPlayedWhenTheChangeOccurs", "SoundPlayedWhenNewMapIsLoaded");
}

else //Dream over. I'm gonna wait for Tomato Cat to fix this.
{
ChangeMap("MapName", "PlayerStartAreaInTheMap", "SoundPlayedWhenTheChangeOccurs", "SoundPlayedWhenNewMapIsLoaded");
}
}

"Veni, vidi, vici."
"I came, I saw, I conquered."
05-23-2013, 04:14 PM
Find
Bridge Offline
Posting Freak

Posts: 1,971
Threads: 25
Joined: May 2012
Reputation: 128
#3
RE: Change lever function?

(05-23-2013, 04:14 PM)JustAnotherPlayer Wrote: You can use local var int's.
void OnStart()
{
SetEntityConnectionStateChangeCallback("LeverName", "ElevatorUse");
SetLocalVarInt("Dream", 1);
}

void ElevatorUse(string &in asEntity, int alState)
{
if(GetLocalVarInt("Dream") == 1) //Dream occur!
{
ChangeMap("MapName", "PlayerStartAreaInTheMap", "SoundPlayedWhenTheChangeOccurs", "SoundPlayedWhenNewMapIsLoaded");
}

else //Dream over. I'm gonna wait for Tomato Cat to fix this.
{
ChangeMap("MapName", "PlayerStartAreaInTheMap", "SoundPlayedWhenTheChangeOccurs", "SoundPlayedWhenNewMapIsLoaded");
}
}

In case you didn't know, int is short for integer. They are not normally (or ever, I'd say) referred to as "ints".
05-23-2013, 08:34 PM
Find
Tomato Cat Offline
Senior Member

Posts: 287
Threads: 2
Joined: Sep 2012
Reputation: 20
#4
RE: Change lever function?

(05-23-2013, 04:14 PM)JustAnotherPlayer Wrote:
else //Dream over. I'm gonna wait for Tomato Cat to fix this.
{

I *suppose* you could use an else statement. Unless you wanted states 0 and -1 to do something specific.
(This post was last modified: 05-23-2013, 10:20 PM by Tomato Cat.)
05-23-2013, 10:10 PM
Find




Users browsing this thread: 1 Guest(s)