Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: dbuske on Fri 26/08/2011 16:00:06

Title: Region interaction problem
Post by: dbuske on Fri 26/08/2011 16:00:06
By the way I get a database error trying to use the search function.

Function Region1_WalkOnto(1)
{
Region[1].RunInteraction(1);
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
}

The fadeout does not happen.  The message displays and freezes the game.
Title: Re: Region interaction problem
Post by: Khris on Fri 26/08/2011 18:21:19
Why didn't you paste the code instead of re-typing it?
There's no way this compiled like that.

Never mind though, the problem is that this function calls itself (also known as recursion).

The region's RunInteraction(1) is the "walks onto" event itself.

What do you want to do here?
Title: Re: Region interaction problem
Post by: dbuske on Fri 26/08/2011 19:40:12
Quote from: Khris on Fri 26/08/2011 18:21:19
Why didn't you paste the code instead of re-typing it?
There's no way this compiled like that.

Never mind though, the problem is that this function calls itself (also known as recursion).n

The region's RunInteraction(1) is the "walks onto" event itself.

What do you want to do here?
I want the character to die when he gets to close to a killer plant.
I have to go out of my desktop and get onto my wife's desktop to use the internet.
AGS won't run on her desktop for some reason.
I tried it using a hotspot, but that froze up the game to.
Title: Re: Region interaction problem
Post by: barefoot on Fri 26/08/2011 20:34:40
Apart from what Khris has said why not use a collide script so that when char gets too close to the killer plant an action happens, ie he dies? There would be no need for a region unless you need to have one.

PPCollision in the plugin/modules forum is a good one for this. It depends how close you want him to get to the plant.

Quote
I want the character to die when he gets to close to a killer plant.

barefoot
Title: Re: Region interaction problem
Post by: dbuske on Sat 27/08/2011 14:19:11
Thanks for the replies, I will check the PPCollision out.
I didn't really understand the first response.
Title: Re: Region interaction problem
Post by: barefoot on Sat 27/08/2011 15:18:08
You will find PPCollision draws a bigger area around the object/character so collision is easier for AGS to detect.

Also its really easy to implement into your script. I have used it and glad I did.

:=

barefoot
Title: Re: Region interaction problem
Post by: Khris on Sat 27/08/2011 15:58:28
Why do you even have this line:

Region[1].RunInteraction(1);

in the function? Are you aware of what it does?

To clarify, what AGS does when the player steps on the region is this:

Function Region1_WalkOnto(1)
{
... // ad infinitum
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
FadeCharacterOut_NoBlock(cNano, 100, 2);
Display(".");
}


Each indention signifies the level of recursion.

The function calls itself, again and again and again, until AGS crashes or gets stuck in the infinite loop.