Axe Software Forums
  Quest Developer Forum
  help with objects/items


Author Topic:   help with objects/items
passerby posted 18-06-2001 18:01 GMT     
help!!

is it at all possible to add items/objects to the game, but keep them invisible?

What i am trying to do is to use these objects like attributes to another object, so that they are not seen by the player, but can be used in the QDK to test for certain properties, conditions, etc.

i am using QDK 1.02 and Quest v 2.0. For various reasons, i cannot simply upgrade to a newer system.


thank you,

passerby.

Computer Whizz posted 18-06-2001 19:15 GMT          
well.... yeah!
you just use the invisible tag. It's still able to be interacted with, all you need to do is pur in the right code.
I don't really understand what you're asking but if you post exactly what you want to use it for then I'm sure Alex or Al should help youout further.... if I'm not here first!

--CW

MaDbRiT posted 18-06-2001 19:15 GMT          
passerby asked;

quote:
is it at all possible to add items/objects to the game, but keep them invisible?

For objects yes it sure is. You have two choice of status here, these are 'hidden' - in which case the object cannot be interacted with (not much use in your case) or 'invisible' which means the object never gets listed or shown, but IS available to work with.

To do this from QDK, create your object as normal, then from QDK's object properties box, click 'MISC' and check the 'Initially invisible' box.

The object is now available to test in code, but won't show to the player.

Hope this helps :-)

Al


passerby posted 18-06-2001 20:25 GMT          
thank you all for replying, but i'm still having trouble with implementation.

perhaps what i didn't make clear was that i'm looking to use these objects as attributes, meaning that they really shouldn't exist before they are needed. If that isn't possible, then it should at least be guaranteed that it can't interact with anything until i want it to.

Here is the the situation i am creating (The exact situation, only the names have been changed :) ).

I have a room with a 'bomb' in it. When they player has a certain item 'trigger' on him, and enters the room, the 'bomb' will become 'active' (it won't explode immediately - the idea is put the player in danger, but not kill him without giving him a chance to protect himself).

I am trying to have 'active' as the invisible object. The reason i am doing it this way is because i have planned to have the player move the bomb between rooms later in the game, so if they plan badly, they may move the bomb through the same room as the trigger, and set it off that way as well.

the problem with using 'active' as an object is that it apparently must be placed into some room to exist, and so the player may move the 'bomb' into that room, and unknowingly start the countdown.

What i guess i was really looking for was a way to keep 'active' from interacting with the other objects of the game until it is needed, then remove it from the game completely when it's not being used.

Also, i just want to know how to create attributes to objects (or simulate them), as this seems to be something that will be useful in any game.

thanks.

MaDbRiT posted 18-06-2001 22:13 GMT          
I'm slightly puzzled as to why you want to use a third object here - surely all you need are a bomb, a trigger device and some way to have the trigger/bomb armed or not.

I'd use a variable to keep the status of the trigger object. I've coded a demo that involvesa remote control and a bomb. Each start in different rooms. The two items can be safely in the same room until the remote is switched on - at which point bringing them together = a big bang.

quote:

'** Quest ASL Template **

define game <Bomb & Trigger>
asl-version <217>
game version <1>
game author <MaDbRiT>
game copyright <� 2001>
game info <A demo>
start <hallway>
items <bomb;remote control>
' startitems <>
' collectables <>
startscript {
setvar <remote_on;0>
}
afterturn {
if is <%remote_on%;1> then {
if here <bomb> or got <bomb> then {
if here <remote control> or got <remote control> then {
playerlose
}
}
}
}
end define

define room <office>
look <This is your office.>
prefix <a small>
north <hallway>

define object <bomb>
look <Crude, but quite deadly in a confined space.>
prefix <a>
take {
give <bomb>
msg <O.K. you have it>
}
end define

end define

define room <hallway>
look <This is your hallway.>
prefix <a dirty>
south <office>

define object <remote control>
look {
if is <%remote_on%;0> then {
msg <it has one switch - set to 'OFF'.>
}
else {
msg <it has one switch - set to 'ON'.>
}
}
prefix <a>
command <switch on remote control> {
setvar <remote_on;1>
msg <It lights up - and hums slightly.>
}
command <switch off remote control> {
setvar <remote_on;0>
msg <The light fades out and it becomes silent.>
}
take {
give <remote control>
msg <O.K.>
}
end define

end define

define text <intro>
'intro text here...
end define

define text <win>
'win text here...
end define

define text <lose>
KABOOOOOOMMM!!!.. the bomb explodes and ruins your whole day.
end define


You will need to unword wrap that - but play with it and I hope it points you in the right direction.

Al

MaDbRiT posted 19-06-2001 07:34 GMT          
Oh yeah...

In my demo I've had the bomb go off immediately the activated trigger device and bomb are in the same room.

If you wanted a delay, you could count down the 'remote_on' (I'd call it 'bomb_ticking' and set it initially at 5 or something were I doing that) by using the afterturn as I have done here, but decrementing the variable and having the bomb go off when it hits zero.

That would be pretty easy to change, but I was pressed for time :-)

Al

passerby posted 20-06-2001 20:02 GMT          
MaDbrIt, thank you for all the code. I wasn't expecting to have someone go to those lengths.

i got your code working easily, and have used it as a template for my own stuff.

So what i see here is that attributes must be implemented by using variables. Thank you, that answers the main question. 'active' in my original post was only being used as a flag anyway.


thanks again.
passerby.

MaDbRiT posted 20-06-2001 20:20 GMT          
passerby wrote:

quote:
So what i see here is that attributes must be implemented by using variables. Thank you, that answers the main question. 'active' in my original post was only being used as a flag anyway

You're welcome :-)

What I did surely isn't the only way to create the required effect in Quest, but it works well enough - and using variables as 'attributes' or 'flags' in this way is a time honoured method.

One of the reasons I like Quest so much is that it is deceptively flexible, there's not a lot it can't do with a little lateral thought.

Al