FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
Player Collides With Area Help?
Hey guys, I'm trying to do when a player collides with an area, he is forced to look at another script area, a timer begins, once the timer stops it calls on a function, that function activates an entity.
I've done this:
void OnStart() { AddEntityCollideCallback("Player", "ScriptArea_9", "Func6", true, 0); }
void OnEnter() {
}
void OnLeave() {
} void Func6(string &in asParent, string &in asChild, int alState)
{ SetPlayerActive(false); StartPlayerLookAt("ScriptArea_10", 1.0f, 1.0f, ""); SetMessage("Messages", "LookAtBlood", 2); AddTimer("", 3, "SetEntityActive"); }
void SetEntityActive(string& asName, bool abActive) { SetEntityActive("corpsepile", true); }
But when I go to the area, the entity/corpsepile is already active, before I collide with the area and it's set inactive in the editor.
(This post was last modified: 05-04-2013, 08:52 PM by FurtherGames.)
|
|
05-04-2013, 08:50 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Player Collides With Area Help?
Your problem lies here:
//Callback syntax for a timer void SetEntityActive(string &in asTimer) { SetEntityActive("corpsepile", true); }
In the future, I highly recommend you consult the functions list at the wiki.
(This post was last modified: 05-04-2013, 08:57 PM by Tomato Cat.)
|
|
05-04-2013, 08:56 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Player Collides With Area Help?
(05-04-2013, 08:56 PM)Mr Credits Wrote: Your problem lies here:
//Callback syntax for a timer void SetEntityActive(string &in asTimer) { SetEntityActive("corpsepile", true); }
In the future, I highly recommend you consult the functions list at the wiki.
I always search the wiki first, but I never find it.
|
|
05-04-2013, 08:57 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Player Collides With Area Help?
It has a table of contents and you can also use your browser's page search tool.
|
|
05-04-2013, 09:00 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Player Collides With Area Help?
(05-04-2013, 08:56 PM)Mr Credits Wrote: Your problem lies here:
//Callback syntax for a timer void SetEntityActive(string &in asTimer) { SetEntityActive("corpsepile", true); }
In the future, I highly recommend you consult the functions list at the wiki.
It's still not working...
|
|
05-04-2013, 09:02 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Player Collides With Area Help?
Exactly *what* is not working? Are you receiving an error, or does the script improperly/not execute?
Did you check your script area names in the level editor etc etc? Perhaps you should change the name of your timer callback to "ActivateCorpsepile" or something?
(This post was last modified: 05-04-2013, 09:09 PM by Tomato Cat.)
|
|
05-04-2013, 09:06 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Player Collides With Area Help?
(05-04-2013, 09:06 PM)Mr Credits Wrote: Exactly *what* is not working? Are you receiving an error, or does the script improperly/not execute?
Did you check your script area names in the level editor etc etc?
The problem is is that the entity is active even before I collide with the area script. It is supposed to be a tiny bit of a jump scare.
|
|
05-04-2013, 09:09 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Player Collides With Area Help?
Did you uncheck the active box in the level editor?
|
|
05-04-2013, 09:10 PM |
|
FurtherGames
Member
Posts: 72
Threads: 23
Joined: Apr 2013
Reputation:
1
|
RE: Player Collides With Area Help?
(05-04-2013, 09:10 PM)Mr Credits Wrote: Did you uncheck the active box in the level editor?
Yes, I said that and I saved the map.
|
|
05-04-2013, 09:12 PM |
|
Tomato Cat
Senior Member
Posts: 287
Threads: 2
Joined: Sep 2012
Reputation:
20
|
RE: Player Collides With Area Help?
Try setting it inactive in OnStart?
|
|
05-04-2013, 09:16 PM |
|
|