The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
Problem with scripting monsters
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.
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
07-01-2012, 10:31 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Problem with scripting monsters
OnLeave is missing (), and you should set the () at OnEnter right after it, just in case...
Think, before you speak Google, before you post
(This post was last modified: 07-01-2012, 10:41 PM by Cruzore.)
|
|
07-01-2012, 10:41 PM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: Problem with scripting monsters
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?
simply nuff said
|
|
07-01-2012, 10:44 PM |
|
Demondays1
Member
Posts: 57
Threads: 7
Joined: Jun 2012
Reputation:
0
|
RE: Problem with scripting monsters
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()
{
}
Intel HD Lag fix: tiny.cc/pyv1gw
(This post was last modified: 07-01-2012, 11:48 PM by Demondays1.)
|
|
07-01-2012, 11:48 PM |
|
LulleBulle
Member
Posts: 101
Threads: 33
Joined: Feb 2012
Reputation:
0
|
RE: Problem with scripting monsters
(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? That wasn't his error, he just had typos, he forgot the closing bracket in the monster function and also the () at OnLeave.
(This post was last modified: 07-02-2012, 06:04 PM by LulleBulle.)
|
|
07-02-2012, 06:03 PM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: Problem with scripting monsters
doesn´t writing in OnLeave() means it happens when leaving map?
simply nuff said
|
|
07-02-2012, 06:53 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Problem with scripting monsters
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?
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
07-02-2012, 07:17 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Problem with scripting monsters
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.
Think, before you speak Google, before you post
|
|
07-02-2012, 07:21 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Problem with scripting monsters
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?
|
|
07-02-2012, 08:32 PM |
|
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
|
RE: Problem with scripting monsters
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.
THE OTHERWORLD (WIP)
Aculy iz dolan.
|
|
07-02-2012, 09:30 PM |
|
|