EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: Need help with this scripting.
AddEntityCollideCallback("Player", "ScriptArea_1", "SetMonsterActive", false, 1);
!
false means that the area wont disappear after use
void SetMonsterActive(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}
///////////////
set the monster disabled in the level editor, and it will work!
simply nuff said
|
|
06-29-2012, 10:19 PM |
|
ApeCake
Member
Posts: 116
Threads: 20
Joined: Jun 2012
Reputation:
4
|
RE: Need help with this scripting.
Exawolts solution should work just fine. I'd put the AddEntityCollideCallback in void OnStart() instead of void OnEnter() though... maybe that's the problem?
|
|
06-29-2012, 10:24 PM |
|
HoyChampoy
Junior Member
Posts: 43
Threads: 16
Joined: Jun 2012
Reputation:
0
|
RE: Need help with this scripting.
(06-29-2012, 10:19 PM)EXAWOLT Wrote: AddEntityCollideCallback("Player", "ScriptArea_1", "SetMonsterActive", false, 1);
!
false means that the area wont disappear after use
void SetMonsterActive(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Monster", true);
}
///////////////
set the monster disabled in the level editor, and it will work! This works great but there's a problem. I need it too work once because if the player unfortunately runs into the area again their screen fades out while the monster is chasing them. Basically, is it possible to have the area work once until the player dies?
|
|
06-29-2012, 11:55 PM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Need help with this scripting.
If I understood your question right, you want to use a part of the callback only once, and the rest allways? If so:
1 option is to make a local variable, which is set 0 in OnStart(), the stuff you want to happen only once gets an if statement to check if the variable is 0, and inside you set the variable 1.
|
|
06-29-2012, 11:57 PM |
|
HoyChampoy
Junior Member
Posts: 43
Threads: 16
Joined: Jun 2012
Reputation:
0
|
RE: Need help with this scripting.
(06-29-2012, 11:57 PM)FastHunteR Wrote: If I understood your question right, you want to use a part of the callback only once, and the rest allways? If so:
1 option is to make a local variable, which is set 0 in OnStart(), the stuff you want to happen only once gets an if statement to check if the variable is 0, and inside you set the variable 1. Im sorry im a n00b when it comes to this. How would that possibly look like?
|
|
06-29-2012, 11:58 PM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Need help with this scripting.
Make sure the first collision callback gets removed when triggered. Then in the checkpoint callback, you can just add the same collision callback.
|
|
06-30-2012, 12:03 AM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Need help with this scripting.
example script:
void OnStart() { SetLocalVarInt("YourVariableNameHere", 0);
} void YourFunction(string &in asName, int alCount) { if(GetLocalVarInt("YourVariableNameHere")==0) { SetLocalVarInt("YourVariableNameHere", 1);
//and stuff you want to happen only once comes here } //stuff you want to happen allways comes here }
void YourFunction is the Function that comes from your Checkpoint callback.
|
|
06-30-2012, 12:04 AM |
|
EXAWOLT
Member
Posts: 113
Threads: 14
Joined: Apr 2012
Reputation:
3
|
RE: Need help with this scripting.
just make 2 areas in same place. one area where the monster comes up, that will be repeated, an one for the fades that will not happen again, simply nuff said
simply nuff said
|
|
06-30-2012, 12:05 AM |
|
Cruzore
Senior Member
Posts: 301
Threads: 2
Joined: Jun 2012
Reputation:
37
|
RE: Need help with this scripting.
As I said, there are multiple ways. A variable is 1 way, another callback is the other. There are most likely more.
|
|
06-30-2012, 12:05 AM |
|
HoyChampoy
Junior Member
Posts: 43
Threads: 16
Joined: Jun 2012
Reputation:
0
|
RE: Need help with this scripting.
(06-30-2012, 12:04 AM)FastHunteR Wrote: example script:
void OnStart() { SetLocalVarInt("YourVariableNameHere", 0);
} void YourFunction(string &in asName, int alCount) { if(GetLocalVarInt("YourVariableNameHere")==0) { SetLocalVarInt("YourVariableNameHere", 1);
//and stuff you want to happen only once comes here } //stuff you want to happen allways comes here }
void YourFunction is the Function that comes from your Checkpoint callback. "your variable name here" is the name of the area correct? Ill try this
|
|
06-30-2012, 12:16 AM |
|
|