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
Level Editor Help How do I make a ladder teleport you to next level?
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#1
How do I make a ladder teleport you to next level?

I have a ladder in the elevator shaft leading to the basement but I want to add an area at the bottom of the ladder where it will load the next map. How do I go about doing that?
01-09-2012, 07:16 PM
Find
Inurias Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jan 2012
Reputation: 2
#2
RE: How do I make a ladder teleport you to next level?

(I am assuming that you already created a working script file for the corresponding map. If this is not the case, google up the basics about scripting with hpl2, also, this link could help you a lot: http://wiki.frictionalgames.com/hpl2/start)



First you add a ScriptArea to your desired location, after that, you add a "AddEntityCollideCallback" call into your initializing function (most likely "OnStart" in your case), you do this by using:

void AddEntityCollideCallback(string& asParentName, string&  asChildName, string& asFunction, bool abDeleteOnCollide, int  alStates);

Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both


Then, in your CallBack function you use:

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded
(This post was last modified: 01-09-2012, 07:45 PM by Inurias.)
01-09-2012, 07:45 PM
Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#3
RE: How do I make a ladder teleport you to next level?

(01-09-2012, 07:45 PM)Inurias Wrote: (I am assuming that you already created a working script file for the corresponding map. If this is not the case, google up the basics about scripting with hpl2, also, this link could help you a lot: http://wiki.frictionalgames.com/hpl2/start)



First you add a ScriptArea to your desired location, after that, you add a "AddEntityCollideCallback" call into your initializing function (most likely "OnStart" in your case), you do this by using:

void AddEntityCollideCallback(string& asParentName, string&  asChildName, string& asFunction, bool abDeleteOnCollide, int  alStates);

Callback syntax: void MyFunc(string &in asParent, string &in asChild, int alState)
alState: 1 = enter, -1 = leave

asParentName - internal name of main object
asChildName - internal name of object that collides with main object (asterix (*) NOT supported!)
asFunction - function to call
abDeleteOnCollide - determines whether the callback after it was called
alStates - 1 = only enter, -1 = only leave, 0 = both


Then, in your CallBack function you use:

void ChangeMap(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound);

asMapName - the file to load
asStartPos - the name of the StartPos on the next map
asStartSound - the sound that is played when the change starts
asEndSound - the sound that is played when the new map is loaded
I do have a working script file, yes. Could you make an example of the script I would need to make? Thank you. Smile
01-09-2012, 07:48 PM
Find
Inurias Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jan 2012
Reputation: 2
#4
RE: How do I make a ladder teleport you to next level?

Okay, but you should make sure to read through the little script and make sure that you understand what's going on. I hope that you'll learn from it.

void OnStart()
{
    AddEntityCollideCallback("Player", "YourScriptArea", "YourCallBackFunction", true, 1);
}

void YourCallBackFunction(string &in asParent, string &in asChild, int alState)
{
    ChangeMap("YourMapName", "YourStartPosName", "YourStartSound", "YourEndSound");
}

- Inurias
01-09-2012, 07:53 PM
Find
MissMarilynn Offline
Member

Posts: 77
Threads: 23
Joined: Oct 2011
Reputation: 1
#5
RE: How do I make a ladder teleport you to next level?

(01-09-2012, 07:53 PM)Inurias Wrote: Okay, but you should make sure to read through the little script and make sure that you understand what's going on. I hope that you'll learn from it.

void OnStart()
{
    AddEntityCollideCallback("Player", "YourScriptArea", "YourCallBackFunction", true, 1);
}

void YourCallBackFunction(string &in asParent, string &in asChild, int alState)
{
    ChangeMap("YourMapName", "YourStartPosName", "YourStartSound", "YourEndSound");
}

- Inurias
*facepalm* I should've learned that by now haha. I'm terribly sick today so my brains not working at full XP Thank you so much.
01-09-2012, 07:56 PM
Find
Inurias Offline
Junior Member

Posts: 20
Threads: 0
Joined: Jan 2012
Reputation: 2
#6
RE: How do I make a ladder teleport you to next level?

You're Welcome.
01-09-2012, 07:58 PM
Find




Users browsing this thread: 1 Guest(s)