Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: pier on Fri 15/05/2020 16:46:17

Title: [solved] can the player "die" when a certain dialog option is toggled?
Post by: pier on Fri 15/05/2020 16:46:17
Hi! And pardon me once again if i ask silly or stupid question. This time i don't know if it's even possible...
In a dialog, i wanted the player to choose an option that will led him to "death" switching is position to a game over room
is this possible?
I tried...but with poor results
Code (ags) Select

function cdio_Talk()
{
dDialog2.Start();
if (player.dDialog2 option is @4){
  player.ChangeRoom (9,  415,  245);
}
}


this is the idea, obviously it doesen't work... 
Title: Re: can the player "die" when a certain dialog option is toggled?
Post by: Slasher on Fri 15/05/2020 16:59:45
Put an option inside dialog options  (dDialog2)  that when selected changes player to Game Over room..
Title: Re: can the player "die" when a certain dialog option is toggled?
Post by: Khris on Fri 15/05/2020 17:12:50
1. Remove lines 4 - 6 of that snippet
2. Open the dialog script for dDialog2
3. Find entry point @4 in the dialog script
4. add this (note that the regular script command has to be indented by at least one space):
Code (ags) Select
  player.ChangeRoom (9,  415,  245);
stop
Title: Re: can the player "die" when a certain dialog option is toggled?
Post by: pier on Sat 16/05/2020 15:38:19
thank you! It was very easy indeed. Sorry for the stupid question  :tongue:
Title: Re: [solved] can the player "die" when a certain dialog option is toggled?
Post by: Khris on Sun 17/05/2020 11:17:43
Not stupid at all; before we were able to put script commands in a dialog script, what one had to do was in fact very similar to what you attempted :)