Changing BASS template so that character does not turn when looking at himself.

Started by GreenBoy, Mon 23/07/2007 10:25:49

Previous topic - Next topic

GreenBoy

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.

Code: ags

            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.

Gilbert

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

if ( playerornot != EGO)

into
Code: ags

if ( playerornot != cEgo.Name)


Alternatively, a considerably much better method is to change:
Code: ags

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

to just
Code: ags
if (Character.GetAtXY(mouse.x, mouse.y))

GreenBoy

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.

SMF spam blocked by CleanTalk