Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: xenogia on Sun 24/01/2010 12:15:15

Title: Tint doesn't work when walking over regions when using a blocked parameter.
Post by: xenogia on Sun 24/01/2010 12:15:15
I have three seperate regions as you walk across the room, where it starts dark and gets brighter.  If I look at an object at the other end of the screen the characters walks over to it but because this a blocked animation the region tints don't work.  Is there another way around it?  Here is my code for you to look at.


function region1_WalksOnto()
{
 cEgo.Tint (171, 136, 92, 46, 100);
}

function region2_WalksOnto()
{
 cEgo.Tint (171, 136, 92, 46, 80);
}

function region3_WalksOnto()
{
 cEgo.Tint (171, 136, 92, 46, 60);
}


Title: Re: Tint doesn't work when walking over regions when using a blocked parameter.
Post by: Calin Leafshade on Sun 24/01/2010 12:24:20
Yeah i noticed this when producing mccarthy.

You have to check where the player is in rep ex always

so like


if(Region.GetAtScreenXY(player.x,player.y) == region[1]) player.tint(0,0,0,50,50);
Title: Re: Tint doesn't work when walking over regions when using a blocked parameter.
Post by: xenogia on Sun 24/01/2010 12:26:48
Your inital code didn't work correctly, but changed it to the following:


function hLivingArea_Interact()
{
  cEgo.Walk (12, 300, eBlock, eWalkableAreas);
  cEgo.ChangeRoom (41, 626, 297);
}

function room_RepExec()
{
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[1]) cEgo.Tint(171,136,92,46,80);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[2]) cEgo.Tint(171,136,92,46,60);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[3]) cEgo.Tint(171,136,92,46,100);
}


Still didn't work unfortuanetly.. :(
Title: Re: Tint doesn't work when walking over regions when using a blocked parameter.
Post by: Dualnames on Sun 24/01/2010 12:42:06
No wonder. It's a blocking function thus you need it to be called repeatedly. Way repeatedly.

Quote from: Calin Leafshade on Sun 24/01/2010 12:24:20
You have to check where the player is in rep ex always


function hLivingArea_Interact(){
  cEgo.Walk (12, 300, eBlock, eWalkableAreas);
  cEgo.ChangeRoom (41, 626, 297);
}

function repeatedly_execute_always(){

  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[1]) cEgo.Tint(171,136,92,46,80);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[2]) cEgo.Tint(171,136,92,46,60);
  if(Region.GetAtRoomXY(cEgo.x,cEgo.y) == region[3]) cEgo.Tint(171,136,92,46,100);
}

Title: Re: Tint doesn't work when walking over regions when using a blocked parameter.
Post by: xenogia on Sun 24/01/2010 12:45:37
Thanks Dualnames, didn't you realise you could use repeatedly_execute_always in a room script.  I always thought it was only available in the global script.

EDIT: And yes it did work :)