FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
Something is completely wrong inside the void Callback2.
You cannot have a void-callback inside another callback. That doesn't make any sense.
Trying is the first step to success.
|
|
02-04-2013, 11:28 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
Could you please tell me a little clearer what you want to happen? ![Smile Smile](https://www.frictionalgames.com/forum/images/smilies/smile.gif)
I'm a little sleepy now, so i'll go to bed, but i might check up on it tomorrow
Trying is the first step to success.
|
|
02-04-2013, 11:51 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: Scripting/Variables problem.
I'm not sure I get exactly what you are trying to do, but...
void Callback2(string &in asEntity, int alState)
{
AddLocalVarInt("Variable", 1);
if (GetLocalVarInt("Variable") == 0)
{
AddEntityCollideCallback("Player", "Area_3", "MoveWeepingAngel1", true, 0);
AddEntityCollideCallback("Player", "Area_4", "MoveWeepingAngel2", true, 0);
AddEntityCollideCallback("Player", "Area_5", "MoveWeepingAngel3", true, 0);
AddEntityCollideCallback("Player", "Area_6", "MoveWeepingAngel4", true, 0);
}
}
That 'if' will never evaluate to true (unless 'Variable' is initialised to a minus number), because you are adding 1 before it checks if it is 0, which clearly it is not. That means those 4 collide callbacks are not getting added, which may or may not prevent everything from working...
|
|
02-05-2013, 10:52 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
void OnStart()
{
AddEntityCollideCallback("Player", "Area_3", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_4", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_5", "CheckAreas", false, 0);
AddEntityCollideCallback("Player", "Area_6", "CheckAreas", false, 0);
}
void CheckAreas(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
if(asChild == "Area_3")
{
SetLocalVarInt("Area_3", 1);
}
if(asChild == "Area_4")
{
SetLocalVarInt("Area_4", 1);
}
if(asChild == "Area_5")
{
SetLocalVarInt("Area_5", 1);
}
if(asChild == "Area_6")
{
SetLocalVarInt("Area_6", 1);
}
SetLocalVarInt("InsideArea", 1);
}
if(alState == -1)
{
SetLocalVarInt("InsideArea", 0);
if(asChild == "Area_3")
{
SetLocalVarInt("Area_3", 0);
}
if(asChild == "Area_4")
{
SetLocalVarInt("Area_4", 0);
}
if(asChild == "Area_5")
{
SetLocalVarInt("Area_5", 0);
}
if(asChild == "Area_6")
{
SetLocalVarInt("Area_6", 0);
}
}
}
void Callback2(string &in asEntity, int alState)
{
if(GetLocalVarInt("InsideArea") == 1)
{
if(alState == 1)
{
}
if(alState == 0)
{
if(GetLocalVarInt("Area_3") == 1)
{
//DO STUFF IF INSIDE AREA 3
}
if(GetLocalVarInt("Area_4") == 1)
{
//DO STUFF IF INSIDE AREA 4
}
if(GetLocalVarInt("Area_5") == 5)
{
//DO STUFF IF INSIDE AREA 3
}
if(GetLocalVarInt("Area_6") == 6)
{
//DO STUFF IF INSIDE AREA 3
}
}
}
}
This is how i understood it.
Trying is the first step to success.
|
|
02-05-2013, 11:04 AM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
I need to know what is not working...
Trying is the first step to success.
|
|
02-05-2013, 06:57 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
Let me try to understand what you want:
There are 4 areas.
When you collide with any of them a callback will check if you are looking at the angel.
If you are looking away from it, a new callback will call?
Trying is the first step to success.
|
|
02-05-2013, 07:33 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
Ok, i editted the post with the script.
Trying is the first step to success.
|
|
02-05-2013, 07:48 PM |
|
FlawlessHappiness
Posting Freak
Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation:
171
|
RE: Scripting/Variables problem.
I don't know.
Seems like my script doesn't work. I haven't tested it myself... I'm sorry
Trying is the first step to success.
|
|
02-05-2013, 08:29 PM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: Scripting/Variables problem.
Looking through your most recently posted script, I can't see anything that's actually calling Callback2? Unless that's not the most up to date script, that might be a problem...
|
|
02-08-2013, 12:06 AM |
|
Adrianis
Senior Member
Posts: 620
Threads: 6
Joined: Feb 2012
Reputation:
27
|
RE: Scripting/Variables problem.
(02-08-2013, 05:11 PM)Robosprog Wrote: In the new script something does still nothing.
'Something' sounds pretty ominous ![Smile Smile](https://www.frictionalgames.com/forum/images/smilies/smile.gif)
Do you want to post the new script up? That way, we may be able to accurately pin down the issue
|
|
02-08-2013, 07:49 PM |
|
|