Frictional Games Forum (read-only)
[SCRIPT] Changing map without a level door? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Changing map without a level door? (/thread-19087.html)



Changing map without a level door? - Tiger - 11-04-2012

So I'm making a custom story where in one part you're supposed to change map by walking on a static_object. I've tried putting a ScriptArea there with the following script:


void OnStart()
{
AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);
}

void ChangeMap_1
{
ChangeMap("MyMapName.map", "PlayerStartArea_1, "", "")
}


I've looked on the wiki and tried googling it. I can't find anything about it. Can somebody please help me?


RE: Changing map without a level door? - The chaser - 11-04-2012

void OnStart()

{

AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);

}



void ChangeMap_1 (string &in asParent, string &in asChild, intalState)

{

ChangeMap("MyMapName.map", "PlayerStartArea_1, "", "")

}

Every function (or void) has a syntax. You didn't have one.


RE: Changing map without a level door? - Tiger - 11-04-2012

(11-04-2012, 06:48 PM)The chaser Wrote: void OnStart()

{

AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);

}



void ChangeMap_1 (string &in asParent, string &in asChild, intalState)

{

ChangeMap("MyMapName.map", "PlayerStartArea_1, "", "")

}

Every function (or void) has a syntax. You didn't have one.
Ah! Thanks a lot! Big Grin


RE: Changing map without a level door? - The chaser - 11-04-2012

(11-04-2012, 06:50 PM)Tigerwaw Wrote:
(11-04-2012, 06:48 PM)The chaser Wrote: void OnStart()

{

AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);

}



void ChangeMap_1 (string &in asParent, string &in asChild, int alState)

{

ChangeMap("MyMapName.map", "PlayerStartArea_1, "", "")

}

Every function (or void) has a syntax. You didn't have one.
Ah! Thanks a lot! Big Grin
Sorry, a part of the syntax was wrong. Now it's corrected.


RE: Changing map without a level door? - FlawlessHappiness - 11-04-2012

Maybe you can use this: http://www.frictionalgames.com/forum/thread-18368.html
Smile


RE: Changing map without a level door? - Tiger - 11-04-2012

(11-04-2012, 06:52 PM)The chaser Wrote: Sorry, a part of the syntax was wrong. Now it's corrected.
Yeah, it didn't work at first. Thanks Big Grin

beecake Wrote:Maybe you can use this: http://www.frictionalgames.com/forum/thread-18368.html

Thanks. I've wondered what all that means. Smile


RE: Changing map without a level door? - Tiger - 11-04-2012

So this is what my script looks like now:


void OnStart()
{
AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);
}

void ChangeMap_1 (string &in asParent, string &in asChild, intalState)
{
ChangeMap("MapName.map", "PlayerStartArea_2", "player_jump6.ogg", "player_bodyfall5.ogg")
}

Amnesia crashes when I open my custom story. Why?


RE: Changing map without a level door? - ZeroPie - 11-05-2012

(11-04-2012, 11:48 PM)Tigerwaw Wrote: So this is what my script looks like now:


void OnStart()
{
AddEntityCollideCallback("Player", "ChangeLevelScript_1", "ChangeMap_1", true, 1);
}

void ChangeMap_1 (string &in asParent, string &in asChild, intalState)
{
ChangeMap("MapName.map", "PlayerStartArea_2", "player_jump6.ogg", "player_bodyfall5.ogg")
}

Amnesia crashes when I open my custom story. Why?
On the ChangeMap("MapName.map", "PlayerStartArea_2", "player_jump6.ogg", "player_bodyfall5.ogg") add a ;
This must be used after every script is typed out, so use this:
ChangeMap("MapName.map", "PlayerStartArea_2", "player_jump6.ogg", "player_bodyfall5.ogg");

Hope it helps.


RE: Changing map without a level door? - FlawlessHappiness - 11-05-2012

Wrong syntax again Smile You wrote "intalState" when it should be "int alState"
Yes spaces are important too!


RE: Changing map without a level door? - Tiger - 11-05-2012

(11-05-2012, 07:27 AM)beecake Wrote: Wrong syntax again Smile You wrote "intalState" when it should be "int alState"
Yes spaces are important too!
Aw cr*p. I thought I had looked through the whole script :c
Thanks for noticing Big Grin