Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Chrille

#541
Here's a screenshot from the dialog options window in Revenants. Basically like a dialog options window only with images instead of text. Of course, it can easily be added with some extra code as seen in the tutorial ;)

#542
It's a messy tutorial featuring several typos, but hopefully it'll make sense ;).
Okay, an icon based dialog system is easy to set up if you're somewhat experienced with AGS scripting. Here's one way to do it:



1. First of all. I think you should use a custom inventory GUI for your game, you'll also need another GUI with a inventory window for the Dialog Icon Gui, since each dialog option/icon is an inventory item. Both the inventory and dialog gui should prefarably be set to  Visible: Script Only.



2. You can probably use the regular inventory click system, but I chose to Handle Inventory Clicks In Script (check in General Settings/Game Options. You'll also need to use a GlobalInt, this will be used to check if it's the inventory GUI or the dialog GUI that is currently open.



3. Create a new character, set its script name to DIALOG or something like that. Check the "no interaction" box in the character's settings and set his coordinates to somewhere outside the screen. Then add a on_event function to your global script if you havn't already. There is more information about it in the manual. Here's what it will look like:

function on_event(int event, int data) {
if (event==ENTER_ROOM) {
character[DIALOG].room = character[ X ].room;
}
}

Where X = is the script name/character # of your player character. What this does is everytime the player moves into a new room, the DIALOG character will move into the same room. This is very useful and the reason why will be explained later. While you're at it, add an integer to the top of the script, something like "int talkingto"



4. You will need to create some custom functions. You can copy it directly from here:

function OpenDialog() {
SetPlayerCharacter (DIALOG);
SetGlobalInt (X,1); // X is the number of the inventory/dialog control GlobalInt
game.items_per_line = #;
game.num_inv_displayed = #;
game.top_inv_item = 0; // only necessary if your dialog gui doesn't have a scroller
InterfaceOn (Z); // Z is the number of your dialog gui
}

Instead of using the RunDialog function, you run this everytime you talk to a character. It will set the player character to the DIALOG character and open the dialog GUI, where Z is the number of your dialog GUI. The game.items_per_line and game.num_inv_displayed settings are very important if your dialog GUI window is bigger or smaller than the inventory GUI window. Set these to match the dialog gui window if such is the case. The X is the number of the GlobalInt you're using to check which of the inventory/dialog gui is on. The game.top_inv_item part is only necessary if your dialog gui doesn't have a scroller. Because if it doesn't and you scroll down in your regular inventory window and then open the dialog gui, the current line might be set too far down preventing you from seeing the dialog option inventory items. So game.top_inv_item = 0; puts all the dialog options back into view.



5. The second custom function you'll need is:

function CloseDialog() {
InterfaceOff (Z); // Where Z is the number of your dialog gui
SetPlayerCharacter (Y); // Where Y is the ID of your player character
SetGlobalInt (X,0); // X is the number of the inventory/dialog control GlobalInt
game.items_per_line = #;
game.num_inv_displayed = #;
}

This function will be run everytime you cancel/close a dialog. It will close the dialog window and reset the normal inventory window settings. Set the game.items... and game.num... settings for the regular inventory window.



6. The third custom function you'll need to create is:

function RunDialog() {
InterfaceOff (Z); // Z is the number of your dialog gui
SetPlayerCharacter (X); // X is the ID of your player character
}

In this function, all of the game's dialog spoken using the icon dialog system will be written. You'll therefore need to check which dialog option/icon the player clicked on by adding the following to the RunDialog function:

if (game.inv_activated==#) { // # is the number of the inventory item (dialog option) clicked
}

In Revenants, since you'll be able to ask every character about every dialog topic you bring up, I use the following method to check which character you're talking to. Remember the "int talkingto" part I mentioned in step 3? When you run the interaction for talking to a character, you will need to set the talkingto integer to the # ID of the character you're about to talk to. It will look something like this:

talkingto = #; // Where # is the number of the character you're talking to
OpenDialog();

This way, you can easily control what each character has to say about each dialog topic. Here's an example of what the RunDialog function might look like after a while:

function RunDialog() {
InterfaceOff (Z); // Z is the number of your dialog gui
SetPlayerCharacter (X); // X is the ID of your player character
 if (game.inv_activated==2) { // Topic:  Key
   if (talkingto==5) { // Billy Schlong
   DisplaySpeech (PLAYER,"Do you have the key to the chest o' stashed away smut?");
   DisplaySpeech (5,"Yep, here you go");
   AddInventory (666);
   }
   else { // Any character who hasn't got anything to say about the topic
   DisplaySpeech (PLAYER,"Do you have the key to the chest o' stashed away smut?");
   DisplaySpeech (talkingto,"I have no idea what you're talking about!");
   }
 OpenDialog(); // This opens the dialog window again after the current conversation is over.
 }
 if (game.inv_activated==1) { // Topic: Stop Talking
 DisplaySpeech (PLAYER,"Gotta go, bye");
 DisplaySpeech (talkingto,"Cya");
 CloseDialog(); // This closes the dialog window, you'll need to talk to the character again to open it.
 }
}


7. Now for the final part. In the game's on_mouse_click function, you'll need to set up the inventory clicks (LEFTINV) and/or (RIGHTINV). You'll need to use the GlobalInt mentioned in step 2 to check whether you're clicking on a item in the inventory window or the dialog window. Here's what it might look like:


if (button==LEFTINV) {
if (GetGlobalInt(X)==0) { // Inventory Window: X is the number of the inventory/dialog control GlobalInt
SetActiveInventory (game.inv_activated);
}
else if (GetGlobalInt(X)==1) { // Dialog Window: X is the number of the inventory/dialog control GlobalInt
RunDialog();
}
}


8. The functions should be placed in the following order, otherwise the script will probably not compile:

OpenDialog()
CloseDialog()
RunDialog()
on_mouse_click()


Tadaa! You're all done. That is, unless I forgot to mention something. As you can see there are several ways to do this and it's very easy to customize to fit your game. You can control which dialog topics that show up for which characters by using integers or using a separate character as an inventory for each character in the game.
#543
I suppose I can put a tutorial together, give me a few days.
#544
You can script your own icon based dialog interface, I've done it for Revenants.
#545
General Discussion / Re:Worms 3....
Mon 21/04/2003 01:12:33
I'm really looking forward to this game, I think the screenshots look very promising. The 2D games are great, but after four 2d games in the series and three of them using the same graphics & engine, it's about time they did something new.
#546
I'm not absolutley sure,  but I am quite sure :)
#547
The characters blocking thingamabob might be it. Does it only block if the character is in the same room as the player?

Regarding the other thing, I'm using neither. Just a regular MoveCharacter with "regular" coordinates.
#548
Gaah! This is not making any sense. I made it so that it showed which coordinates the player moved to when you clicked on a walkable area. When I tried the game, the movement worked fine all of a sudden. So I went in and out of the rooms a few times and eventually things got messed up AGAIN.

But yes, moving by clicking on a walkable area spot works without any problems. And I am sure that the MoveCharacter destinations are on a walkable area. If you click on an object once and the player tries to reach it, he usually stops only a few pixels away. If you click on it again, he manages to move up to it.  It's strange because it worked just fine in v 2.53.
#549
I added this stuff for the first two rooms and the character often stops just before he reached the final coordinates. When you click on the ground to walk the directly he seems to walk exactly where you want him to though.

Would you like a copy of the game to investigate further?
#550
Pretty much all the time :-/


Maybe it could be MoveCharacter related? But then again maybe the Walk mode processclick runs MoveCharacter (EGO,mouse.x,mouse.y) or something, I dunno :P
#551
General Discussion / Re:A dream come true!
Sat 19/04/2003 15:23:52
Well, I'm glad I don't have that dream :)
#552
General Discussion / Re:A dream come true!
Sat 19/04/2003 14:05:24
...
#553
If you liked this you should try HorrorSofts (before they became AdventureSoft) excellent Elvira 1, 2 and Waxworks.
#554
True, but that might screw things up, since you can click somewhere else and "cancel" the interaction if the player is still walking towards it :)

Plus I'd have to change heaps of code.
#555
I'm not sure when this bug popped up, but I do know it wasn't in v2.53. When I upgraded to 2.54, there was the jump-bug in the movement engine, it was fixed in that patched version, but the movement is still somewhat weird.

Revenants checks for exact coordinates all the time. Instead of running a blocking function, I use the MoveCharacter and set an integer when the player interacts with something. When the player is on those coordinates and the integer is set to that certain value, the interaction thingy runs. But in the latest version, the player doesn't always seem to want to move all the way to specified coordinates if he stands on certain parts of the walkable area. This screws up the game quite a bit :/.
#556
Hey! I co-wrote it :)
#557
Here's some in-game shots in addition to the ones Trap posted:





#558
Well, I think each team should at least post a screenshot or two if they have any.
#559
We've had a game in the works since the start of the challenge and would easily have been ready by today if everyone but Petteri hadn't been slacking. We should have it ready within the next few days but we havn't decided yet whether we should release a short demo or just a few screenshots. You'll see later tonight :P
#560
Here's a crummy digital camera picture I took today :P:

SMF spam blocked by CleanTalk