A doubt with game progress.

Started by , Tue 29/08/2006 11:47:10

Previous topic - Next topic

cflribeiro

HI! I m new in forum. This is my first post.  :)

Now my doubts ...
I am make my first game and "appeared" one doubt.
For example: I want create two rooms... i start the game in room 1 where is a personage to interact. later i go to room 2 and when i pick up a object the personage in room 1 change the dialogue (a diferent dialogue that I had when start the game...)
how i do this?

Thank you very much!

Great program,site and forum! ;)

Alynn

There is multiple ways to do this... if the object that is picked up also places an item in the inventory you can have the person do (psudocode)

If player.HasInventory(iItem) == 1) Do second Dialog
else do first dialog.

Or, you can create a global variable so when you pick up the object, you set the global variable to 1.

if (GetGlobalVar(1)==1) do second dialog
else do first dialog.

Thats just a start, however these are the easiest to work with.

Khris

Doing this with HasInventory has written "cheap & buggy" all over it, I'm afraid, as the dialogue would go back to the first version as soon as the player e.g. uses the item and it gets removed from the inventory. This could be wanted in some cases, but usually not.

The answer is, of course, variables.
(Although in this special case, you could achieve it by only turning dialog options on and off.)

So, use SetGlobalInt and GetGlobalInt.

When the player does something that affects the game elsewhere, change one of the GlobalInts to 1 using e.g.
Code: ags
SetGlobalInt(7, 1);Ã,  // Set GlobalInt Nr. 7 to hold the value 1

Then check its value just like Alynn described.

It's also possible to use your own variables.
Code: ags
// top of global script
int person_dialog=1;
export person_dialog;Ã,  // we want to use the variable in every script, so make it global by 1. exporting it

// script header
import person_dialog;Ã,  Ã, //Ã,  2. importing it in the header

// object is picked up
person_dialog=2;

// character is talked to
RunDialog(person_dialog);Ã,  Ã,  // runs 1 or 2, depending on whether the object has been picked up

cflribeiro

One more problem... ;D What better form to create a CutScene?

Thank you very much guys!  ;)

SMF spam blocked by CleanTalk