Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: YotamElal on Wed 02/03/2005 13:31:25

Title: how do I change the walkable area view?
Post by: YotamElal on Wed 02/03/2005 13:31:25
how do I change the walkable area view?

When my character walks in the mud he wears shoes.
(ok till now)
later on the game he buys boots and he wears them when walking on the mud.
How do I change the walkablearea 1 view 11 to view 12??
Title: Re: how do I change the walkable area view?
Post by: Candle on Wed 02/03/2005 14:38:40
SetCharacterView(EGO,12);
AnimateCharacter(EGO,0,0,0);
while(character[EGO].animating) Wait(1);
ReleaseCharacterView(EGO);

Title: Re: how do I change the walkable area view?
Post by: Ashen on Wed 02/03/2005 15:21:40
I don't think that's what was wanted...

Do you mean that you have Walkable 1 set to change the character's view (e.g with
Change player view while on this area:), but you want it to change to a different view based on what the existing view is (i.e. if they're wearing boots or shoes)?

I don't think you can change the value in the 'Change player view while on this area:' box during the game (assuming that's what you're using). I think instead, you'd have to script it in rep_ex. You'll also need a variable to track what the character view should be (or use one of the Global Ints), and set it when you buy the new boots, so the engine knows what view to change back to.
Title: what rep_ex & how do I script this?
Post by: YotamElal on Wed 02/03/2005 15:30:11
what rep_ex & how do I script this?
Title: Re: how do I change the walkable area view?
Post by: Ashen on Wed 02/03/2005 15:42:36
The rep_ex (Repeatedly Execute) of the room the walkable area is in, NOT the global rep_ex, that would cause weirdness.

I think the code would be something like:

if (GetWalkableAreaAt (player.x - GetViewportX (), player.y - GetViewportY ()) == 1) {
  if (GetGlobalInt (5)-1 == player.view) { //
    if (GetGlobalInt (5) == SHOEVIEW) ChangeCharacterView (EGO, 11); // if they're in shoes, set to view 11
    else if (GetGlobalInt (5) == BOOTVIEW) ChangeCharacterView (EGO, 12); // or view 12 if in boots
    //(change SHOEVIEW and BOOTVIEW to the right numbers)
  }
}
else if ((GetWalkableAreaAt (player.x - GetViewportX (), player.y - GetViewportY ()) != 1) && (GetGlobalInt (5)-1 != player.view)) ChangeCharacterView (EGO, GetGlobalInt (5));
//else set the to default view


Title: THNX But I didn't check the code..
Post by: YotamElal on Thu 03/03/2005 15:15:37
THNX
But I didn't check the code..
Becuase I'm not going to do the thing I wanted to do in my game cuase it rases other complications...