Frictional Games Forum (read-only)

Full Version: Scripting/Variables problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Something is completely wrong inside the void Callback2.


You cannot have a void-callback inside another callback. That doesn't make any sense.
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
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...
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.
I need to know what is not working...
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?
Ok, i editted the post with the script.
I don't know.
Seems like my script doesn't work. I haven't tested it myself... I'm sorry
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, 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
Pages: 1 2