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
Need help with this scripting.
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#11
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
Find
ApeCake Offline
Member

Posts: 116
Threads: 20
Joined: Jun 2012
Reputation: 4
#12
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
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#13
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. Undecided Basically, is it possible to have the area work once until the player dies?
06-29-2012, 11:55 PM
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#14
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
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#15
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. Sad How would that possibly look like?
06-29-2012, 11:58 PM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#16
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.

Tutorials: From Noob to Pro
06-30-2012, 12:03 AM
Website Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#17
RE: Need help with this scripting.

example script:
PHP Code: (Select All)
void OnStart()
 {
  
SetLocalVarInt("YourVariableNameHere"0);

 }
 
void YourFunction(string &in asNameint 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
Find
EXAWOLT Offline
Member

Posts: 113
Threads: 14
Joined: Apr 2012
Reputation: 3
#18
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
Find
Cruzore Offline
Senior Member

Posts: 301
Threads: 2
Joined: Jun 2012
Reputation: 37
#19
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
Find
HoyChampoy Offline
Junior Member

Posts: 43
Threads: 16
Joined: Jun 2012
Reputation: 0
#20
RE: Need help with this scripting.

(06-30-2012, 12:04 AM)FastHunteR Wrote: example script:
PHP Code: (Select All)
void OnStart()
 {
  
SetLocalVarInt("YourVariableNameHere"0);

 }
 
void YourFunction(string &in asNameint 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
Find




Users browsing this thread: 2 Guest(s)