Region interaction problem

Started by dbuske, Fri 26/08/2011 16:00:06

Previous topic - Next topic

dbuske

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.
What if your blessings come through raindrops
What if your healing comes through tears...

Khris

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?

dbuske

#2
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.
What if your blessings come through raindrops
What if your healing comes through tears...

barefoot

#3
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
I May Not Be Perfect but I Have A Big Heart ..

dbuske

Thanks for the replies, I will check the PPCollision out.
I didn't really understand the first response.
What if your blessings come through raindrops
What if your healing comes through tears...

barefoot

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
I May Not Be Perfect but I Have A Big Heart ..

Khris

Why do you even have this line:

Code: ags
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:

Code: ags
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.

SMF spam blocked by CleanTalk