How to check in which Room is a specific Character?

Started by kampfkaese, Sun 27/07/2014 13:44:19

Previous topic - Next topic

kampfkaese

Hello!

I searched the Character Funktions for a specific function, but had no success.. How do i Get the Room Number where a specific Player is in?

I need it to check if "Cat" is in the Kitchen, so that when this is true, the Player and the Cat walk to a hidden Catfood and Drinking spot and make it visible, followed by a feeding animation.

NickyNyce

#1
Code: ags
if(cCat.Room==5)
{
 Have player and cat do whatever you want
}


Change cCat to whatever your cats name is. I'm guessing you would put this code in the (After fade in function)

But now you would need to probably add a Game.DoOnceOnly after the cats room check so this only happens once.


Code: ags
if(cCat.Room==5 && Game.DoOnceOnly("FeedCat"))
{
 Have player and cat do whatever you want
}


Ghost

kampfkaese, you're opening several threads with very basic questions, most of which are covered in the manual- maybe keep one thread open and update it with questions, or do a short forum search if a question has already been asked (they all have been).
The Getting Started section of the manual and the excellent Densming AGS tutorials on youtube cover much of what you're asking, too.

This is not meant to be rude, but you're basically going through all the question everyone has when first starting with AGS ;)

kampfkaese

#3
First: Thank you for the command!

@Ghost:
Thank you & I'm Sorry! Your're right! ;)

Its was just very difficult to find the right Answers in English because Google gives not that Good answers, belonging to AGS and my English is not that good!

Thanks if you allow me to do this further, in a seperate Thread in case i really dont find anything for some time.



Khris

Just for reference: when you look at the Character section of the manual (and many others), you'll get a list that first contains all functions in alphabetical order, then all properties, also in alphabetical order.

Functions are commands, always with () at the end, where one usually passes one or more parameters, unless it's something like Character.StopMoving().

Properties give information about the game state, many of them can also be changed by assigning them new values. This is the first place to look when you want information about some script entity; the properties list starts with .ActiveInventory and further down, there's .Room, which is exactly what you have been looking for.

Ghost

Quote from: kampfkaese on Sun 27/07/2014 15:23:07
Thanks if you allow me to do this further, in a seperate Thread in case i really dont find anything for some time.

Keine Sorge, ich kann's gar nicht verbieten (und wenn, dann würd ich's nicht machen- wir fangen alle klein an und gerade Sprachbarriere ist übel, weil man dann gleich mehrere Probleme hat). Ich wollte nur einfach ein paar "Anfängertips" posten- also kein Thema :D Und viel Spass beim Spielebasteln!

I can't "not allow" you (since I am no moderator), and see no sense in doing so anyway. We all have beginner's questions; language barrier is a factor too. I just wanted to offer some additional starting tips ;) Happy game-making, too (nod)

kampfkaese

Quote from: Khris on Sun 27/07/2014 15:32:04
Just for reference: when you look at the Character section of the manual (and many others), you'll get a list that first contains all functions in alphabetical order, then all properties, also in alphabetical order.

Functions are commands, always with () at the end, where one usually passes one or more parameters, unless it's something like Character.StopMoving().

Properties give information about the game state, many of them can also be changed by assigning them new values. This is the first place to look when you want information about some script entity; the properties list starts with .ActiveInventory and further down, there's .Room, which is exactly what you have been looking for.
Oh yes!!

I read all the Titles Twice because thats my favorite Source for Code help, but missed it twice ^^ Thanks alot..

SMF spam blocked by CleanTalk