Dialog options help and Game Over

Started by Jade, Thu 02/09/2004 11:34:40

Previous topic - Next topic

Jade

I've two questions:
1)I know this may seems a banal question...but i couldn't find an answer in the ags manual...
The fact is that i dont know how to end the game(i mean the classic "game over") when a certain action or event happen.... Ã, ???

2)How can i make an event happen when a certain dialog option is selected?

Thanks!

SilverWizard_OTF

#1
About your first question: There isn't a "standard" way to end the game. And that's better, isn't it? You can do whatever you want.

I will give you a hint: Let's say your character does something, and he dies, or missed something, or failed to do something e.t.c. After the all stuff you add for to inform the player that he has lost, you can add a "Go to a different room" from the interaction editor, or via scripting, using the NewRoom script command. In the new room, you should check the "Player Invisible" option, make a picture of a e.g. "Game over" sign, hide mouse cursor with HideMouseCursor() script command, and that's all! You can also fill this screen with a HotSpot, and from the Hotspot's interactions, add: "Any click on hotspot"--> Run Script--> QuitGame(//0 or 1).

About your second question:  Dialogs have a kind of script.  (Edit script option.) See "Conversations" at the Online Help of AGS engine. Now if you want to do more advanced things, you need to type (where you want to happen something) Run-Script e.g.100 (i advice you the number be equal or bigger 100).
   Then go to Dialog_Request function   (See Dialog_request from the Online Manual for more details). 


               function dialog_request(int param) {
                   if(param==100)  {
                       //do things   (like a custom function)

I hoped i offered you some help.
A last hint:  Check the scripting tutorials (from Online Manual) to see the way of creating your own custom functions.
    Did i helped?
"All we have to decide is what to do, with the time that is given to us"

Jade

Your first answer is quite clear...i'm not sure about the second one...but i'll check it myself in the manual....THank you anyway.  ;)

Barbarian

Quote from: Jade on Fri 03/09/2004 10:58:30
Your first answer is quite clear...i'm not sure about the second one...but i'll check it myself in the manual....THank you anyway.Ã,  ;)

Hiya Jade. I answered someone else in another post that had a similar question to you. Hopfully it will be of some help to you as well:

http://www.agsforums.com/yabb/index.php?topic=16305.0#msg200136
Conan: "To crush your enemies, see them driven before you, and to hear the lamentation of the women!"
Mongol General: "That is good."

Blade of Rage: www.BladeOfRage.com

Jade

#4
Good one! Thank you Barbarian......now i know where to start...... ;D

Jade

Hey...i still have problems... :-[....i wrote exactly this:

function dialog_request(int parameter) {
if (parameter == 1) {
SetCharacterView(MyCharID, 3);
AnimateCharacter(MyCharID, 3,0,0);
ReleaseCharacterView(MyCharID);
}

When the dialog arrive at the point that it should start the event...nothing happen... ???
Of course i didnt forget to put the "run-script 1" in the dialog option.

What did i miss?

Scorpiorus

You need to make AGS block the execution of script until the animation is done, otherwise it won't have a chance to play since ReleaseCharacterView(MyCharID); is called instantly:


function dialog_request(int parameter) {
   if (parameter == 1) {
      SetCharacterView(MyCharID, 3);
      AnimateCharacter(MyCharID, 3,0,0);
      while(character[MyCharID].animating) Wait(1);
      ReleaseCharacterView(MyCharID);
   }
}

Jade

Oh...ok! I'll try... :)

Btw...the value "1" that you put after "wait"...stand for a certain period of time?


Scorpiorus

Yeah, it's one game loop. Assuming a game runs at a default speed that's about 1/40 of a second.


while(character[MyCharID].animating) Wait(1); works as follows:

1. - checks if MyCharID is animating;
2. - if the character is animating then it waits a bit (1 game loop) and goes to step 1;
Ã, Ã, Ã,  - if the character is not animating goes to the next command (ReleaseCharacterView in this case);


just simple as that :)

Jade

Yes...now i dicovered that quite simple...its that i'm not familiar with game scripting.
A huge thank you!Ã,  :-*

SilverWizard_OTF

Even better, you can use the script command AnimateCharacterEx(). With this command you can set more parameters, such as if you want the game to wait  while the character is animating.
  It is useful if you do not want to use While statement (which personally find it a bit complicated method).
See more details about this command from Online Help of AGS engine.
"All we have to decide is what to do, with the time that is given to us"

SMF spam blocked by CleanTalk