advanced music question

Started by dbuske, Sun 19/12/2010 16:05:30

Previous topic - Next topic

dbuske

I checked the documentation and couldn't solve this problem.
I had written one dialog and used the character area andGlobal script to run the dialog.
Now  I want to play another script, but I can't figure out how to play the script.  It just keeps playing the 1st script.
How do I do this?
This second dialog is in a different room than the first one.
What if your blessings come through raindrops
What if your healing comes through tears...

Khris

You can check the room:

Code: ags
  if (player.Room == 4) dDialog1.Start();
  if (player.Room == 6) dDialog2.Start();


In general, you want to use variables.

Tamanegi

Don't take this personally, but you seem to be lacking very basic knowledge about programming. I'm not talking about the language (I never learned C++ or Java or Delphi myself), but the principles of storing data (letting the program remember what you want it to know) and combining various commands to archive something.

If you really want to make a game or learn it by using AGS, start small. Write a one-room-game, or maybe two rooms to learn about transition between them. Leave sounds and music for the time being, those are just pretty makeup for the game, and concentrate on getting the game to do what you want it to do. Don't try everything at once, or you will end up taking more time waiting for answers at the forum than you will spend on your actual game.

To get an idea what you can do within AGS, read the help file. There are lists for every topic: Room functions and properties, character functions and properties, object functions and properties and so on. It's basically (almost) everything you can do with the given type of "thing". If you don't fully understand what it does, just try it. If you still don't understand how it works and you feel you need it, ask. You learn a lot more about scripting by try-and-error and by looking it up yourself than by asking.

As Khris said, you could check the room. Or you could use a variable to remember if you have had the first dialogue and have the script decide by checking the variable which dialog to run.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

dbuske

#3
Correct I know nothing about programming. That is why I am using AGS.
I do try every thing I can to get it to work. Including tutorials, searching forums and using help from the program.
I managed to get music and sound working. I can move the NPC within the rooms.  I can have both the main character and NPC change rooms. I use inventory items and get them into the characters inventory.  The game is well along now. It will be a very basic 12 room game without really advanced things.
I don't know what was meant by "Check the room," or "use variables."

Do I put something in the room script, or the global script?
What if your blessings come through raindrops
What if your healing comes through tears...

dbuske

function room_FirstLoad()
{
if (cDeath.Room == 4) Deathanddannymeet.Start();
if (player.Room == 6) dhowdidyou.Start();

}

I got the above to work by putting it into Room 6.  The only problem is the dialog runs first and the character, the NPC character, does not pop into the room before the dialog plays. I assume because i am using firsttload.
What if your blessings come through raindrops
What if your healing comes through tears...

Tamanegi

Why are you checking whether Death is in room 4 when this script goes to room 6? You could just leave any checking out altogether, because the player WILL be in room 6 when this is called, because it is in the script for room 6. Just:

Code: ags

function room_FirstLoad()
{
dhowdidyou.Start();
}


Move the command to have the NPC enter the room to the "before fade-in" trigger. That should do the trick.

If you only want to have it happen once (the NPC appearing there, I mean) use Game.DoOnceOnly("blah");

Code: ags

if (Game.DoOnceOnly("talked to death")) cDeath.ChangeRoom(6,x,y);


Game.DoOnceOnly(token) is true the first time it is checked and false every time after that, for that given token. Token is just any string that ideally describes what will happen the first time so you can remember it.
Don't Look! MAGS 12-2010
Mediocre Expectations Current development blog

dbuske

Thanks I will give it a try.
What if your blessings come through raindrops
What if your healing comes through tears...

SMF spam blocked by CleanTalk