Frictional Games Forum (read-only)

Full Version: Problem with scripting monsters
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone:
I'm making a very simple map, "The chasing", with only one monster. The objective is that when the player collides with the script area, a monsters appears. It must be very simple, but i've made the script and it doesn't work.
Here is the script:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ActivateMonster", true, 1);

}

void OnEnter ()
{

}

void OnLeave

{

}
void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);

I don't know what's wrong, so i would like a lot a bit of help.
OnLeave is missing (), and you should set the () at OnEnter right after it, just in case...
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ActivateMonster", true, 1);
}

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
}
i dont think you want the monster to appear when leaving the map?Wink
Copy and paste this:

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

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
}

void OnEnter ()
{

}

void OnLeave()

{

}
(07-01-2012, 10:44 PM)EXAWOLT Wrote: [ -> ]void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "ActivateMonster", true, 1);
}

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
}
i dont think you want the monster to appear when leaving the map?Wink
That wasn't his error, he just had typos, he forgot the closing bracket in the monster function and also the () at OnLeave.
doesn´t writing in OnLeave() means it happens when leaving map?
I've tried the script:

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

void ActivateMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_2", true);
}

void OnEnter ()
{

}

void OnLeave()

{

}

It doesn't work. I think it's ok, what could be wrong?
Just in case since I don't know if it is needed, but put the () right after OnEnter, not a space between. Just in case.
Are the MAP and HPS files named to match each other? Are you sure it is servant_grunt_2 that you're trying to activate?
Thanks everyone, i solved the problem. The HPS and MAP files didn't have the same name. But thanks everyone, really, this forum is awesome.