Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: GreenBoy on Mon 23/07/2007 10:25:49

Title: Changing BASS template so that character does not turn when looking at himself.
Post by: GreenBoy on Mon 23/07/2007 10:25:49
Ok been trying this for a while now.   In the original BASS template if you look at any character you turn towards him/her which is great but that also means that when you turn when you look at yourself  :o

Yes thats right so escentially you end up facing up whenever you look at yourself.  Which is vaguely annoying. 

Ive tried using getlocationname so I can seperate Ego from other characters but it envolves strings which for the most part I know nothing about.  Ive been treating it like an int but that doesnt seem to be going so well.

Heres my code from the Global Script.


            if (button == RIGHT) // Right button, deafault to MODE_LOOK
            {
              SetCursorMode (MODE_LOOK);
              if (type != 2) // 2 is character             
      {
           FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y);
      }
else if (type == 2)
{
        String playerornot = Game.GetLocationName (mouse.x, mouse.y);
if ( playerornot != EGO)
        {
        FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y);
}
}
            }
            else if (button == LEFT) // Left button, MODE_USE (or MODE_TALK on character)
            {
              if (type == 2) // 2 is character
                SetCursorMode (MODE_TALK); // talk to character
              else
                SetCursorMode (MODE_USE); // use anything else
            }
          }
        }
      }
      ProcessClick(mouse.x, mouse.y, GetCursorMode() );
      SetCursorMode(MODE_USE);
}
 
  }
}


And heres what AGS says about my code:

Error (line 217): Type mismatch: cannot convert 'String*' to 'int'

I think I'm way off.  So any help would be appreciated.  Thanks.
Title: Re: Changing BASS template so that character does not turn when looking at himself.
Post by: Gilbert on Mon 23/07/2007 10:34:36
Since playerornot was declared as String and the EGO is an int definition for the character's number, no wonder you got that error.

Try changing the line:

if ( playerornot != EGO)

into

if ( playerornot != cEgo.Name)


Alternatively, a considerably much better method is to change:

String playerornot = Game.GetLocationName (mouse.x, mouse.y);
if ( playerornot != EGO)

to just
if (Character.GetAtXY(mouse.x, mouse.y))
Title: Re: Changing BASS template so that character does not turn when looking at himse
Post by: GreenBoy on Tue 24/07/2007 11:13:48
Cool thanks a lot.  No wonder I was having trouble.  :-\
Ill try that now.

This might take a while for me to get used to.

[EDIT] Yep that did the trick.  Thankyou very much Gilbot.