I have an area divided into A, B and C. There is a XYX character in C. Now I want to do it like this: After player character do something in B, he have enough time to go to A. Now after this time (timer) I want XYX to come from C to B and at this point (XYX standing in B area) I want the game to consider wheter player character is on region A or not. Now I cannot do this with regions, because XYX is not a player character. Can anyone help me?
Thanks
I was also trying to do this with: ischaractercollidingwithobject, but didnt help me.
Yes you cannot use region events for NPC, therefore you need to manually check if they are standing on a region by using the Region.GetAtRoomXY() (http://www.adventuregamestudio.co.uk/manual/Region.GetAtRoomXY.htm) function within the repeatedly execute event:
on doing something while on B (ie. interact object/hotspot or something):
Ã, Ã, SetTimer( 1, 400 ); // set timer #1 for 400 game loops
room's repeatedly execute:
Ã, Ã, if ( IsTimerExpired(1) )
Ã, Ã, {
Ã, Ã, Ã, Ã, character[XYZ].Walk( REGION_B_X, REGION_B_Y, eNoBlock, eAnywhere );
Ã, Ã, }
Ã, Ã, // check if XYZ NPC is on the region B
Ã, Ã, if ( Region.GetAtRoomXY( character[XYZ].x, character[XYZ].y ) == region[REGION_B_NUMBER] )
Ã, Ã, {
Ã, Ã, Ã, Ã, if ( Region.GetAtRoomXY( player.x, player.y ) == region[REGION_A_NUMBER] )
Ã, Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, Ã, Ã, // player is on region A
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, else
Ã, Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, Ã, Ã, // player is not on region A
Ã, Ã, Ã, Ã, }
Ã, Ã, }
Now its working, that is great, but I just cannot stop it. For example if I put display message instead of //player is on region A, it will be there for ever. What to do now? Thanks for the help by the way.
Ah yeah, you just need to set a flag to not trigger it again. Region.Enabled should do fine in this case:
Ã, Ã, if ( IsTimerExpired(1) )
Ã, Ã, {
Ã, Ã, Ã, Ã, character[XYZ].Walk( REGION_B_X, REGION_B_Y, eNoBlock, eAnywhere );
Ã, Ã, }
Ã, Ã, // check if XYZ NPC is on the region B
Ã, Ã, if ( Region.GetAtRoomXY( character[XYZ].x, character[XYZ].y ) == region[REGION_B_NUMBER] )
Ã, Ã, {
Ã, Ã, Ã, Ã, if ( Region.GetAtRoomXY( player.x, player.y ) == region[REGION_A_NUMBER] )
Ã, Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, Ã, Ã, // player is on region A
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, else
Ã, Ã, Ã, Ã, {
Ã, Ã, Ã, Ã, Ã, Ã, // player is not on region A
Ã, Ã, Ã, Ã, }
Ã, Ã, Ã, Ã, region[REGION_B_NUMBER].Enabled = false; // disable the region so it won't trigger the event again
Ã, Ã, }
Thanks a lot!