Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with map changing.
IGabx Offline
Junior Member

Posts: 10
Threads: 3
Joined: Aug 2012
Reputation: 0
#1
Question  Help with map changing.

Most of you are probably gonna think that I'm a noob for not knowing this but I've been trying to transition to a new map. Yes I've searched up other forums and I know the coding, but I've tried everything... :S

Here's the script:

void OnStart()
{
AddEntityCollideCallback("Player", "LoadMap_1", "LoadMap1", true, 1);
}

void LoadMap1(string& asMapName, string& asStartPos, string& asStartSound, string& asEndSound)
{
ChangeMap("final_the_beginning.map", "PlayerStartArea_1", "impact_dirt_med.snt", "");
}

It's so that when someone jumps out a window it transitions to a new outdoor map, and I've tried changing some things to it but this seems to be the only way to enter the map without the game crashing and when I enter the area it does nothing and I fall out the map :S.

There's only a hallway with 2 doors both locked and 3 windows (one being broken of course) and a script area sitting outside the broken window big enough to not miss. I also added black fog and a skybox. Smile

Ps: I don't want an end sound so I didn't put anything there. If that's the problem, I'm sorry for being stupid. xD

There's a screenshot taken of the area but I had to cut some things out because I had to post something under 500 KB


Attached Files
.png   AreaScript.png (Size: 288.88 KB / Downloads: 98)
09-08-2012, 10:13 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: Help with map changing.

The callback syntax for the LoadMap1 function was incorrect. Also, I change the name of the function to CollideLoadMap1 (just so there's no confusion between the area to collide with in game and the function):


void OnStart()
{
AddEntityCollideCallback("Player", "LoadMap_1", "CollideLoadMap1", true, 1);
}

void CollideLoadMap1(string &in asParent, string &in asChild, int alState)
{
ChangeMap("final_the_beginning.map", "PlayerStartArea_1", "impact_dirt_med.snt", "");
}

Hope that helped.

I rate it 3 memes.
09-08-2012, 10:19 PM
Find
IGabx Offline
Junior Member

Posts: 10
Threads: 3
Joined: Aug 2012
Reputation: 0
#3
RE: Help with map changing.

Thanks so much for the help. Big Grin

I wasn't sure if the callback syntax was correct or not. (For me that's like the worst part of the script ever. Like ever...)
I understand a lot more about the callback syntax now. Tongue
09-08-2012, 10:28 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Help with map changing.

It's actually pretty easy Smile

Colliding = (string &in asParent, string &in asChild, int alState)
Because:
asParent = 1st object
asChild = 2nd object
alState = How do they collide? When 1 goes inside? When 1 goes outside? Both?

Interacting = (string &in asEntity)
Because:
asEntity = The entity you interact with. There can only be 1 thing that is cabable of interacting and that is the player.

Use Item = (string &in asItem, string &in asEntity)
Because:
asItem = The item you use.
AsEntity = The entity you use it on

Look-at function = (string &in asEntity, int alState)
Because:
asEntity = The entity you look at
alState = Defining if you are: Looking at it? Looking away from it? Both?

You can actually use those guys (asEntity, asItem, alState, etc.) in scripts like:

void CollideFunction(string &in asParent, string &in asChild, int alState)
{
if(alState == -1) //If you are walking out of the area.
{
GiveSanityDamage(5);
}
}

I hope you understood Wink

Trying is the first step to success.
(This post was last modified: 09-09-2012, 12:57 AM by FlawlessHappiness.)
09-09-2012, 12:57 AM
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#5
RE: Help with map changing.

(09-09-2012, 12:57 AM)beecake Wrote: It's actually pretty easy Smile

Colliding = (string &in asParent, string &in asChild, int alState)
Because:
asParent = 1st object
asChild = 2nd object
alState = How do they collide? When 1 goes inside? When 1 goes outside? Both?

Interacting = (string &in asEntity)
Because:
asEntity = The entity you interact with. There can only be 1 thing that is cabable of interacting and that is the player.

Use Item = (string &in asItem, string &in asEntity)
Because:
asItem = The item you use.
AsEntity = The entity you use it on

Look-at function = (string &in asEntity, int alState)
Because:
asEntity = The entity you look at
alState = Defining if you are: Looking at it? Looking away from it? Both?

You can actually use those guys (asEntity, asItem, alState, etc.) in scripts like:

void CollideFunction(string &in asParent, string &in asChild, int alState)
{
if(alState == -1) //If you are walking out of the area.
{
GiveSanityDamage(5);
}
}

I hope you understood Wink
I think that uploading this to the wiki would be a good idea. Anyway, in my custom story I work too with these. I can upload my script, and then you can compare them (it's always good to search for yourself what you've done wrong). Nevermind, sometimes is good to post it, so people can see possible issues. Well, here you have:

void OnStart()

{
AddEntityCollideCallback("Player", "ScriptArea_2", "Explore_deep", true, 1);
}

void Explore_deep (string &in asParent, string &in asChild, int alState)
{
ChangeMap("map_2.map", "Castle", "", ""); ///Castle is the startarea of the other map.
}

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
09-09-2012, 11:36 AM
Find
IGabx Offline
Junior Member

Posts: 10
Threads: 3
Joined: Aug 2012
Reputation: 0
#6
RE: Help with map changing.

I agree. The wiki does have a lot of useful understandable information but this would be the cherry on the cake. It confused me the first time I saw it... Smile
09-15-2012, 11:19 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Help with map changing.

I tried making an account, but it wouldn't accept my password when i tried to login, so i clicked "Set new password", and then it said it has sent me an email... But i have got no email...

Trying is the first step to success.
09-16-2012, 10:20 AM
Find
IGabx Offline
Junior Member

Posts: 10
Threads: 3
Joined: Aug 2012
Reputation: 0
#8
RE: Help with map changing.

Hmm, maybe try making another email and using it?
09-16-2012, 06:51 PM
Find




Users browsing this thread: 1 Guest(s)