Starting a dialog with an if/then statement

Started by lilinuyasha, Thu 26/02/2015 20:43:29

Previous topic - Next topic

lilinuyasha

I just got back to AGS after taking a short sabbatical.

Now, I'd like a specific dialog to start only after a character that had been following the player enters the room. I know this is going to be an "Enters after fade in" if/then statement, but I'm not sure of the proper command to check for it.

The characters script name is cAngel, and is following our character. After checking dynamic help, i can't seem to find a "Character enters room" function or similar.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

Ibispi

Hi lilinuyasha,
I don't know if any function exists in ags about a certain character entering a room. :undecided:
This event could be easily custom created though! (nod)

Here's how I would do it if I were you:
STEP 1#:
Create a global boolean:

I go into "Global variables" tab (it is in between Audio and Scripts tabs in my AGS editor version).
II right click on that blank space and click on "Add new variable".
IIItype the name of the variable "CharEntered0"*            *the name of the variable can be anything you want
IV for variable type choose "bool".
V type in false as a default value
STEP 2#:
Create a trigger for the event:

I Open GlobalScript.asc
II find a repeatedly execute function and type in this:
Code: ags
// put anything you want to happen every game cycle in here
function repeatedly_execute() 
{    
    if((CHARNAME**.Room==1)&&(CharEntered0==false)){
        CharEntered0=true; /* the bool is required so that the repeatedly execute function doesn't loop forever */
        //and add here everything you want to happen after the event is triggered
}

**instead of CHARNAME type in the script name of your character e.g. cRoger.Room==1...

Tell me if you have any problems or questions! :-)

lilinuyasha

That seems pretty complicated. I'll try it when I get back to my working hours.
I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.

lilinuyasha

I can Fluently speak Braille. I obtained a swiss army knife...From the Turkish Navy. My hands feel like rich brown suede. My blood smells like cologne. I AM Trey Love, The most Interesting Man in the World.


Monsieur OUXX

#5
For the record : "Global Variables" are the old, graphical way of storing a permanent value in your game. You create them with the Editor interface.

Another way is just to declare a variable in your global script or, even better, in your room script (if you want it to affect only this room):
Code: ags

//in your gloabl script or room script
bool CharEntered0=false;

...

//in your room script
if (CharEntered0==false...


Just do it any way you like most.
 

SMF spam blocked by CleanTalk