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
How do I use void ChangeMap? [SOLVED]
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#1
How do I use void ChangeMap? [SOLVED]

void ChangeMap(string &in asParent, string &in asChild, int alState) <- if I remember correctly?


I want to use it as a trigger when a player collides with an Area, is this possible?

[Image: 25F7U37.png]
(This post was last modified: 08-07-2012, 03:51 AM by Melvin.)
08-07-2012, 02:59 AM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#2
RE: How do I use void ChangeMap?

That is very possible! Use an entity collide callback with the name of the area, then inside the function, use the change map command. If done properly, it should look something like this:

void OnStart()
{
AddEntityCollideCallback("Player", "NAME_OF_AREA", "FUNC", 1, true);
}

void FUNC(string &in asParent, string &in asChild, int alState)
{
ChangeMap("NAME_OF_MAP.map", "NAME_OF_PLAYER_START_AREA", "", "");
}

Hope that helped.

I rate it 3 memes.
08-07-2012, 03:05 AM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#3
RE: How do I use void ChangeMap?

(08-07-2012, 03:05 AM)andyrockin123 Wrote: That is very possible! Use an entity collide callback with the name of the area, then inside the function, use the change map command. If done properly, it should look something like this:

void OnStart()
{
AddEntityCollideCallback("Player", "NAME_OF_AREA", "FUNC", 1, true);
}

void FUNC(string &in asParent, string &in asChild, int alState)
{
ChangeMap("NAME_OF_MAP.map", "NAME_OF_PLAYER_START_AREA", "", "");
}

Hope that helped.
So now I've got this

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

void OnStart(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}


I've started understanding this scripting bussiness today so I'm still a little noobie, sorry for that.

But I'm not sure what function I should use? I know the OnStart or OnEnter are functions, but I don't know which one I'm supposed to pick!

This is the scenario

Two maps, Floor_2_Day (starts here) and Floor_2_Night. The player walks to his room and goes to his bed, the next map loads, and its night.

[Image: 25F7U37.png]
(This post was last modified: 08-07-2012, 03:18 AM by Melvin.)
08-07-2012, 03:17 AM
Website Find
Kazakarumariou Away
An angry man.

Posts: 283
Threads: 8
Joined: Jul 2012
Reputation: 14
#4
RE: How do I use void ChangeMap?

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerSleep", "LOLOLFUNCNUMBERONE", 1, true);
}

void LOLOLFUNCNUMBERONE(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}




Whatever you use in the bolded area AddEntityCollideCallback("Player", "PlayerSleep", "LOLOLFUNCNUMBERONE", 1, true);


is used here in the bolded area
void LOLOLFUNCNUMBERONE(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}
08-07-2012, 03:27 AM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#5
RE: How do I use void ChangeMap?

(08-07-2012, 03:27 AM)Harthex Wrote: void OnStart()
{
AddEntityCollideCallback("Player", "PlayerSleep", "LOLOLFUNCNUMBERONE", 1, true);
}

void LOLOLFUNCNUMBERONE(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}




Whatever you use in the bolded area AddEntityCollideCallback("Player", "PlayerSleep", "LOLOLFUNCNUMBERONE", 1, true);


is used here in the bolded area
void LOLOLFUNCNUMBERONE(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}
Hey man, thanks for the reply.

I'm still having an FATAL ERROR though. It says


Could not load script file blablalba maps/Floor_2_Day.hps'!
ExecuteString (1, 1) : ERR : No matching signatures to 'OnLeave()'
main (6, 1) : ERR : No matching signatures to 'AddEntityCollideCallback(string@&, string@&, string@&, const uint, const bool)'


My guess is that its the script where the problem is at, I can't seem to fix it.

////////////////////////////
// Run when first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "PlayerSleep", "FunctionOne", 1, true);
}

void FunctionOne(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Beforethestorm.ogg", true, 0.4, 8, 1, true);
}


The other one is a musicfile.
pls fix 'em bro(s)

[Image: 25F7U37.png]
08-07-2012, 03:38 AM
Website Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#6
RE: How do I use void ChangeMap?

Sorry, the callback I wrote was off the top of my head so I mixed up the Boolean and Int spots Tongue
Here's a fix:


////////////////////////////
// Run when first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "PlayerSleep", "FunctionOne", true, 1);
}

void FunctionOne(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Beforethestorm.ogg", true, 0.4, 8, 1, true);
}

I rate it 3 memes.
08-07-2012, 03:41 AM
Find
Melvin Offline
Member

Posts: 245
Threads: 38
Joined: Jun 2012
Reputation: 5
#7
RE: How do I use void ChangeMap?

(08-07-2012, 03:41 AM)andyrockin123 Wrote: Sorry, the callback I wrote was off the top of my head so I mixed up the Boolean and Int spots Tongue
Here's a fix:


////////////////////////////
// Run when first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "Music", "StartMusic", true, 1);
AddEntityCollideCallback("Player", "PlayerSleep", "FunctionOne", true, 1);
}

void FunctionOne(string &in asParent, string &in asChild, int alState)
{
ChangeMap("Floor_2_Night.map", "SpawnAfterTeleport", "", "");
}

void StartMusic(string &in asParent, string &in asChild, int alState)
{
PlayMusic("Beforethestorm.ogg", true, 0.4, 8, 1, true);
}
Omg it worked! You are getting a spot in the credits, FOR SURE! Now I'm going to make an awesome custom story, I'm so full of ideas! thanks dude!!! Just one thing for the looks, how do I script it so that it looks like I woke up lying on the ground?

[Image: 25F7U37.png]
08-07-2012, 03:49 AM
Website Find




Users browsing this thread: 1 Guest(s)