My case is that the player character had a conversation with an NPC. Then the NPC is shocked and dropped something from his hands. The NPC then ran away.
However I can't manipulate the object since I was scripting inside the dialog. Must I break from the dialogue, play the dropped object animation, then go back to the dialogue or is there another way?
You can script things from the dialog...just add two spaces like this before the code, and you must use object ID numbers instead of their names.
Character: Say whatever text you want...
object[3].Visible=true;
object[3].SetView(130);
etc.
All scripting commands will work if you have two spaces before the line of code inside the dialog.
Quote from: NickyNyce on Wed 08/08/2012 16:20:56
You can script things from the dialog...just add two spaces like this before the code, and you must use object ID numbers instead of their names.
Character: Say whatever text you want...
object[3].Visible=true;
object[3].SetView(130);
etc.
All scripting commands will work if you have two spaces before the line of code inside the dialog.
Hmm maybe I worded it wrong. I know I can script from the dialogue, I just can't access the object.
I got an error since the object wasn't recognized. Specifically, my object was oCup and the error is:
Dialog 7(60): Error (line 60): Undefined token 'oCup'
Use the objects ID number instead of the name. Click on the object and see what number object it is.
object[?].Visible=true;
Quote from: NickyNyce on Wed 08/08/2012 17:26:35
Use the objects ID number instead of the name. Click on the object and see what number object it is.
object[?].Visible=true;
I have a feeling that's not really good way to do that, althought it
may work in certain cases.
Problem is that the objects array is filled with the objects from current Room. If you start that dialog in different Room, objects will be different.
Ofcourse you may use this method if you are completely sure that character this dialog involves will never leave his Room, but in general this is a bad practice.
Probably using this is safer:
http://www.adventuregamestudio.co.uk/wiki/?title=Game_/_Global_functions#CallRoomScript
Or maybe there are other ways, which I am not aware of.
Thanks for the replies. I'll try both solutions.
In order to address CW's remark:
If the dialog is only going to happen in one room, using object[] to access an object in the same room is perfectly fine and exactly what I'd recommend, too.