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
[SOLVED] Script Help.
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#1
[SOLVED] Script Help.

Okay, so in my map, I have it so when the player enters an area a water monster will spawn, but I'm having an issue with the script. This is my script:

////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "water_monster_spawn", "SpawnWaterMonster", false, int alStates);
}

void OnEnter()
{
}

void SpawnWaterMonster(string& asName, bool abActive);
{
SetEntityActive("waterlurker_1", true);
ShowEnemyPlayerPosition("waterlurker_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


When I load the map I'm getting an error at 13,1 saying theres an unexpected token, so I'd like to know what I did wrong.

Thanks for any help in advance.

(This post was last modified: 12-02-2011, 10:51 PM by A Tricky Carnie.)
12-02-2011, 03:20 AM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#2
RE: Script Help.

(12-02-2011, 03:20 AM)A Tricky Carnie Wrote: Okay, so in my map, I have it so when the player enters an area a water monster will spawn, but I'm having an issue with the script. This is my script:

////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "water_monster_spawn", "SpawnWaterMonster", false, int alStates);
}

void OnEnter()
{
}

void SpawnWaterMonster(string& asName, bool abActive);
{
SetEntityActive("waterlurker_1", true);
ShowEnemyPlayerPosition("waterlurker_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


When I load the map I'm getting an error at 13,1 saying theres an unexpected token, so I'd like to know what I did wrong.

Thanks for any help in advance.
////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "water_monster_spawn", "SpawnWaterMonster", true, 1);
}

void OnEnter()
{
}

void SpawnWaterMonster(string &in asParent, string &in asChild, int alState);
{
SetEntityActive("waterlurker_1", true);
ShowEnemyPlayerPosition("waterlurker_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

I found three errors.
1) Your syntax for the function is incorrect. You had string &in asName, bool abActive. Those are just parameters used for the specific functions. The callback syntax for AddEntityCollideCallback would be string &in asParent, string &in asChild, int alState.

2) int AlState at the ned of AddEntityCollideCallback needs to be a 1, 0, or -1, with 1 when the area is entered, -1 when the area is left, and 0 for both.

3) I assume you wanted the function only to be called once, so your false parameter within AddEntityCollideCallback needed to be true.



12-02-2011, 03:58 AM
Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#3
RE: Script Help.

(12-02-2011, 03:58 AM)Obliviator27 Wrote:
(12-02-2011, 03:20 AM)A Tricky Carnie Wrote: Okay, so in my map, I have it so when the player enters an area a water monster will spawn, but I'm having an issue with the script. This is my script:

////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "water_monster_spawn", "SpawnWaterMonster", false, int alStates);
}

void OnEnter()
{
}

void SpawnWaterMonster(string& asName, bool abActive);
{
SetEntityActive("waterlurker_1", true);
ShowEnemyPlayerPosition("waterlurker_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}


When I load the map I'm getting an error at 13,1 saying theres an unexpected token, so I'd like to know what I did wrong.

Thanks for any help in advance.
////////////////////////////
// Run when entering map
void OnStart()
{
AddEntityCollideCallback("Player", "water_monster_spawn", "SpawnWaterMonster", true, 1);
}

void OnEnter()
{
}

void SpawnWaterMonster(string &in asParent, string &in asChild, int alState);
{
SetEntityActive("waterlurker_1", true);
ShowEnemyPlayerPosition("waterlurker_1");
}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

I found three errors.
1) Your syntax for the function is incorrect. You had string &in asName, bool abActive. Those are just parameters used for the specific functions. The callback syntax for AddEntityCollideCallback would be string &in asParent, string &in asChild, int alState.

2) int AlState at the ned of AddEntityCollideCallback needs to be a 1, 0, or -1, with 1 when the area is entered, -1 when the area is left, and 0 for both.

3) I assume you wanted the function only to be called once, so your false parameter within AddEntityCollideCallback needed to be true.
Even with the corrections, I'm still getting the unexpected token at 13,1 (the '{' after the 'Void SpawnWaterMonster)


(This post was last modified: 12-02-2011, 09:45 PM by A Tricky Carnie.)
12-02-2011, 09:34 PM
Find
Obliviator27 Offline
Posting Freak

Posts: 792
Threads: 10
Joined: Jul 2011
Reputation: 66
#4
RE: Script Help.

Derp. Just caught on to what I missed. There's a semi-colon after void SpawnWaterMonster. Remove that.

12-02-2011, 09:58 PM
Find
A Tricky Carnie Offline
Member

Posts: 72
Threads: 15
Joined: Sep 2011
Reputation: 0
#5
RE: Script Help.

(12-02-2011, 09:58 PM)Obliviator27 Wrote: Derp. Just caught on to what I missed. There's a semi-colon after void SpawnWaterMonster. Remove that.
ah, thanks for the help.

12-02-2011, 10:50 PM
Find




Users browsing this thread: 1 Guest(s)