OBject appearing after dialog has ended [SOLVED]

Started by Spookster, Sun 14/07/2013 16:55:26

Previous topic - Next topic

Spookster

Hello!

I want an object to appear onscreen only after  my character has finished a dialog with another character, and then he will have to pick up that object to his inventory. How can I do that?

I tried with function dDonna.Stop and then playing with de object (oMortal), so when the dialog stopped, the object became true, but it won't work, I guess I'm making it up...

Help, please? Thank you a lot!!!

Adeel

#1
Hello Spookster. Dialogs can also contain normal scripting commands. You have to just indent (space them a little) and the compiler will run them as normal.

Your character, say: Ego is talking with another character, say: Char. Then your dialog script dDonna should look like this:
Code: AGS
@1            // this is the greetings
ego: Hello there! Nice to meet you.
char: Hi! Nice to meet you too.
return

@2                    // this is for departing
ego: I think I should leave for now.
char: Okay bye, see you soon!
    oMortal.Visible = true;    //This will make your object visible
stop                //After that, it will end the dialog


Tell me if that's what you wanted.

EDIT: I had a problem somewhat related to yours. You can check it out here.. I am assuming that you already what to do next. Slasher has explained it very well.

Slasher

#2
Well,

Simple way:

Start with the object visibility set to false in its events panel.

Let's call it oball.

after you have run through the specific dialog make the object visible by making object visible = true, then have the player walk to that object eblock, make object visible = false and then add inventory object to player.

Example plain talking dialog:
Code: AGS

Cplayer.Say("blah blah.");
Cnpc.Say(("blah blah.");
Cplayer.Say("Thank you.");
oball.Visible=true;
Cplayer.Walk(200,150,eBlock,eWalkablearea);
oball.Visible=false;
Cplayer.AddInventory(iball);


This is one way that works.

You can of course use this sort of thing when using dDialog as well.



Spookster

#3
Thank you both!!

Adeel, I had tried what you suggest, but I keep gettin an error: "Undefined token". Should I add something else to the dialog form? I should put a "function" or something, right?



Slasher, where should I write that?

Thank you again!

Adeel

Spookster, have you first created the object and set its script name as oMortal? Secondly, like slasher said: it should be invisible by default (so we may visible it later).

Spookster


Adeel

#6
Did you gave some space when you were writing the normal script command inside the dialog script? What exactly does the error message say? Try renaming the second character to other than char. Lets just name it "Larry" for now.

Slasher

#7
Quote from: Spookster on Sun 14/07/2013 17:41:55
Thank you both!!

Adeel, I had tried what you suggest, but I keep gettin an error: "Undefined token". Should I add something else to the dialog form?



Slasher, where should I write that?

Thank you again!


Depends how it is fired to start:

ie: Using 'Talk to' mouse icon on character to talk, during a dDialog or after another event etc etc

An example would be thus:

Code: AGS

function cEgo_Talk() // before trying to talking to the character cEgo you must select cEgo and click Talk to character in its events panel. The Talk function is added automatically. You will need to instruct it what to do as in the script.
{
  dialog begins as my previous post
}


Something along those lines.

EDIT:

If using a dialog with options you must tab (SPACE) certain functions
Code: AGS

TAB CEgo.Say("dfgdfhdfhffg"); 
TAB CEgo.Walk(200,200,eBlock,eWalkableAreas);
return // No tab space for this part




Spookster

See, what I have  is this:


function cDonna_Talk()
{
dDonna.Start();
}


THEN:

@2
Donna: Organizacion Transoceanica Paragubernamental?
Ego: Casi... probemos otra cosa: que me puedes decir de Gaza? Busco elementos que hagan peligrar una OTP...
Donna: Gaza! Casi muero alli!!
       
       cDonna.Say("Eso si puso en peligro muchas cosas...");  (If I delete this, I get the same error message as if I keep it)
       oMortal.Visible = true;

stop

Error message says: Error: Undefined token 'oMortal'

Adeel

You don't need to keep any say command in the dialog script. That's no-no.

Your object's script name and name you inserted in the dialog script should match i.e. same case for each letter and etc. Check it out please.

Slasher

#10
QuoteError message says: Error: Undefined token 'oMortal'

That is because the global dialog does not accept object names. You need to change it to the object number instead


Thus:
object[0] instead of oMortal //[n] put in the objects correct object number ie object[10].

Example:

Code: AGS

@1
 look_goods=false;
 object[0].StopAnimating();
 object[0].SetView(37);
 cEgo.Say("I'll take the Radio Satellite Dish.");
 object[0].Animate(0, 4, eRepeat, eNoBlock);
 cSpace.SayAt(303, 200, 260, "That's a very good choice sir. Let me know if you wish to purchase anything else.");
 object[0].SetView(37, 0, 0);
 object[0].StopAnimating();
 Display("You pay Azaban 100 Arthaniuns and squeeze the Radio Satellite into your equipment bag.");
 object[7].Visible=false;
 cEgo.AddInventory(isatellite);
 Arthaniuns_money=(Arthaniuns_money-100);
 Junk_got=(Junk_got+1);
 look_goods=true;
stop




Spookster

The names of the object are the same everywhere... I even tried with other object that were working properly with other actions, and the error message is the same.

I tried the object[41] thing, and now I didn't get an error message when saving the game, but whenplaying to see if it works, after the dialog, the screen freezes and a pop up message appears: Error running function '_run_dialog38': Error: Array index out of bounds (index: 41, bounds 0...39)

Slasher

#12
Only allowed 40 objects per room so typing object[41] would be 'Out of bounds'.

And how come you have 38 dialogs?


Spookster

#13
Okay, I'm going to sound retarded, but that is the total number of dialogs and objects that I have for the whole game in all of the screens... Maybe I would not be getting this error message if I had created a folder for each screen for the dialogs and sprites?

Anyway, I'm trying with other object numbers, after adding them to the room, and I keep getting errors...

Adeel

#14
Ah Right. I remember now. Objects number are used in the dialog script instead of their names (but why though? It should be changed).

Spookster: Make sure the object to be visible is in the same room where you are running the dialogs.

Slasher

Do you mean Dialogs as in respect of dialogs with options that appear in a box?

Creating folders for each room in the sprites folder and adding the room sprites there is a good idea and tidy but not essential and should not mess the game up afaik with any error messages.

I am certain that you could have, with experience, gone about the game in a different (better) way but still..

It's more likely a user input scripting error.






Spookster

I made a folder for the objects in this room, but still no use...

Yeah, I'm sure the problem is somehting I'm doing wrong, but I can't figure out what? I mean, it's a pretty simple line of scripting, how  can I put it wrong!

Oh, and yes, the object is in the same room, with the correct name and number...

Adeel

The final option (in my opinion) you should share your scripts (both global as well as dialogs one - if that's okay for you). Only then it may be truly realized where you are going wrong...

Slasher

#18
I think you should put your nose into the manual and look up all the bits you require for each part of the game and then get back to clarify any problems you have employing the manual instructions.

You can of course do searches in the forums for answers and help.

Just take it step-by-step

Make a new game and experiment using the manual to gain confidence and then go back to your main game.

Good luck.


Spookster

Okay... I just realized my mistake and now it works perfectly. Just in case this is useful for someone:

I do NOT have 41 objects in my room, I have 3... Silly me, I was putting the IMAGE number between the brackets, and NOT the ID, which is what I was supossed to put. When putting the object ID, it works.

Thank you so much for your patience!

SMF spam blocked by CleanTalk