In and Out Exits/Combat System

Lee
09 Jul 2011, 01:03
I'm a tad confused. I have two rooms, a Forest and the inside of a tank. I can exit the tank by typing 'Out' but I cannot get into the tank by typing 'In' whilst in the Forest and I cannot seem to find anything in quest that will allow me to do that without having to set up some separate commands.

Is there just not an 'In' direction? or have I missed it somehow?

I also noticed there is no IF statement such as "If Object is in a specific container"

RedTulip
09 Jul 2011, 08:19
No, there is no 'In' command. I've tried it myself.

But you can try making a custom player command in the Forest room called 'In' that moves the player to the tank.

If you don't know how, just choose the Forest room, click the Advanced tab, then click the 'Edit Custom Player Commands...' button.

Alex
09 Jul 2011, 09:50
I always imagined "out" exits being used in combination with "go to" exits, like this:


You are in the street. You can go to the supermarket or the pub.

> go to pub

You are in the pub.

> out

You are in the street. You can go to the supermarket or the pub.

> go to supermarket

You are in the supermarket



That design goes right back to Quest 1.0 really. But I think you're right, we should really support "in" as well, because it's probably more common for games to look like this:


You are standing outside a dark, foreboding castle.

> go in

Above you, you can hear a guard shout "release the hot oil!"

> out



So I think I'll add this for Quest 5.0. I'll need to redesign the compass rose though - "out" is quite conveniently at the centre now, so where should "in" go?

To answer your second question, to check if an object is inside a particular container, you need to read its "parent" property. For example, if you want to see if "bread" is in an "oven" object, here's how you would set that up in the "if" editor:

- leave the condition as "Compare two strings, values or properties"
- String 1: #bread:parent#
- String 2: oven

There is a helper for String 1 if you press the "#" button. You can choose "Insert an object property", then select "bread" from the objects list and "parent" from the properties list.

(I'll also point out that this will be easier in Quest 5.0 as well, as you can select "an object contains a specific object" from the "if" drop-down)

Lee
13 Jul 2011, 01:12
Thank you Alex and RedTulip, I suppose I will have to use Red's suggestion for now and i'm glad I was able to give a suggestion for Quest 5.0 :P

I suppose the problem with the 'goto' command was that it doesn't make much sense when it comes to objects.

You would expect the 'Goto tank' or 'Goto cupboard' commands to simply mean that the player would move to that object and not get inside it, so I'm glad that the In feature will be included.

And thank you for the container advice, still getting my head around the program, the solution I had come up with is so confusing and over-complicated that I daren't changes it since it took so much time!



This is kind of unrelated but I planned on adding a small combat system to my little adventure, I figured it would work by writing down a whole bunch of different attacks/blocks/dodges/etc and having one of them chosen at random (or by a percentage chance) when the player types 'attack'. Could you give any insight at all at how I would or could even set this up?

Thanks again.

RedTulip
13 Jul 2011, 02:41
I'd recommend using a menu.

So, let's say you added a verb in a character, probably "Attack", or something.

This verb should run a script that shows a menu.

So, that menu can be called "battle_1", or something.

The information prompt could be "What will you do?"

The choices could be "Punch", "Kick", and "Escape".

When the player chooses to Punch the person, you could add a conditional script that has the condition "'Battle_1' is equal to 1 (before all of this, set a numeric variable called Battle_1 with the random function ["$rand(1; 2)$"]).

The Then script should print a message saying that the player punches the person, and he falls to the ground. Add another script that shows the battle_1 menu, again.

As the Else script, print a message that says the player punches the person, but he punches the player back. The player scrambles up, hurriedly. Add another script that shows the battle_1 menu.


This can be more advanced, the Else script can remove a certain amount from the health variable, but it's a simple way of doing it.

You can even add an if script before all else in the Else script that checks the health, and makes sure the player is still strong enough to do that attack.

The Escape choice would simply move the player to another room, and wouldn't show that menu again, also printing a message that the player runs away.

Hope it's detailed enough, I'm actually using my iPod to type all of these, so I'm just using the QDK inside my head. Heheh. :lol:

Lee
13 Jul 2011, 19:09
Thanks alot RedTulip that was very helpful and extra credit for typing that all up on an iPod :lol:

It helped me get a better understanding of how to make this work but unfortunately the battle system you described wasn't exactly what im looking for, it's my fault for not explaining better. A good example of the type of combat system I want to make is Zork, now since Zork is very widely known I'm going to assume you've played it :P

The first battle you encounter in Zork is in 'The Troll Room' where unsurprisingly a large troll resides. To kill the troll the player only had to type 'kill troll' or 'attack troll with sword' and they would be presented with a random message, whether that was something like "you slice the troll in his right leg and he jumps back in pain" the message could be something completely different each time. I don't want the player to see his or the enemies 'hit points'.

I had managed to create a system like this before back when I used a program called ADRIFT. I think I did it by having a seperate file in which I had numbered lines and each line was a different description of attacking and this file was loaded into the engine and one of the lines was chosen at random when the player typed 'Attack'

so I was wondering if I could achieve something similar in Quest, perhaps using Text Blocks? I'm unsure of how to go about this so any help at all you could give would be much appreciated.

Pertex
13 Jul 2011, 20:06
This combat-system sounds interesting and easy to implement in Q5. Sorry, but I can't help you doing this in Q4 but I think I will write a library for Q5.

Lee wrote:
I had managed to create a system like this before back when I used a program called ADRIFT. I think I did it by having a seperate file in which I had numbered lines and each line was a different description of attacking and this file was loaded into the engine and one of the lines was chosen at random when the player typed 'Attack'


You dont want to release this file to the public, do you? :D

Lee
13 Jul 2011, 20:16
It was merely a notepad file with different descriptions on different lines and one was chosen at random and placed into a String Variable, I saved it as some format that ADRIFT used and loaded it into the engine, I haven't used the program in ages so I can't remember how I managed to set it up exactly.

Either way, the file is long gone, it was just a prototype really so I never finished it but it seemed to work well, hopefully if this can be done in Quest 5 then you'll be able to attach different scripts to different lines in the library, so one description could have disarmed the enemy and so on.

I guess for now I'll have to add something more simple for Quest 4.

RedTulip
14 Jul 2011, 06:23
You can probably add some commands that can only be... accessed IF an object is available for interactive, for example -the troll. Else, the message could be "Attack what?" or so...

Nooow, if the troll is available for interaction, you could use the rand function that generates a number, and use the Select Case script to check if it's either of those numbers....

So, I added a script that sets my "rand_attack" numeric variable to "$rand(1; 3)$", without the quotations.

I added a new script, a select case. As the 'Select case', I'm gonna either type "%rand_attack%", or choose it by clicking the "%" button (the numeric variable button) and choosing the 'rand_attack' variable, without having to write the '%' symbol in both sides.

Now, just add three cases (each called '1', '2', and '3'. Accordingly) with scripts that prints different messages. Click OK.

That's it :D

Lee
14 Jul 2011, 21:12
RedTulip... I think I love you.

Thank you so much this is exactly the kind of system I wanted. I had never used Select Cases before but this was very easy to set up. I can now have different descriptions that can take different amounts away from both the players and enemies health and so can have almost cinematic battles within my games!

Thank you for all your help!