Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Scripting/Variables problem.
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#1
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Scripting/Variables problem.

Could you please tell me a little clearer what you want to happen? Smile
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#3
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
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.
(This post was last modified: 02-05-2013, 07:47 PM by FlawlessHappiness.)
02-05-2013, 11:04 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#6
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
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
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#8
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#9
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
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#10
RE: Scripting/Variables problem.

(02-08-2013, 05:11 PM)Robosprog Wrote: In the new script something does Sad still nothing.

'Something' sounds pretty ominous Smile
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
Find




Users browsing this thread: 2 Guest(s)