[SOLVED] How to trigger my end of level boss?

quatropig
Well I have come to the end of making my first game. Many hours have been spent and unfortunatly I can't trigger the event I need to make the end of game boss appear.

I would like the boss to appear when the inventory contains 10 specific items. I tried making two doors, each requiring 5 keys. When the first is opened it moves to my "warehouse" and a second is swapped in its place. I then have it that opening the door triggers the boss. This failed, but I am unsure why (then again it is waaaaay past bed time).


Any other ideas for making this happen, and of course as as a noob I am limited to the GUI......

HegemonKhan
we need more information (and best of all, your entire game code, as this way we can see directly what you've done and got, and able to trouble shoot why it is not working. If you just give us a piece of code, that usually doesn't help, as often your entire game code is inter-connected, so the error may exist in the rest of your game's code, and not in the piece of code you provide. This is why we really need the entire game code. If you don't want to make your game~source code available publically, you can pm it to any of the site's mods, for them to help you with it privately, they're all really good coders, and can probably fix your problems quickly, unlike me, laughs), as we can't help you without knowing specially what you've done, and~or want to do, in order to help you with your problem(s).

---------------------

If you don't know how to access your game code, there's two ways to do so (with the desktop~offline version anyways):

1. simply open up your game file itself with a text software (notepad. wordpad, notepad++, apple: text editor, etc), highlight all of it (this is your entire game code), and copy it publically here or as a pm to one of the mods.

2. within the GUI~Editor, at the top of the screen, along the bar, is a notepaper-like button, between the 'play' and '?-hrlp' buttons. Click on this note-paper like button, to toggle back and forth between GUI~Editor mode and Code View mode. When in Code View mode, highlight all of the code (this is your entire game code), and copy it publically here, or privately in a pm to one of the mods.

your entire game code will be between the 'asl' Code Tags (the 'asl' code tags is what tells the quest engine that this is your game's code), it look like this (just for your reference):

<asl version="560">
(your mass of game code's content)
</asl>

XanMag
I think - THINK being imperative - that the proper use of flags might be helpful here. If I understand correctly, you could just set a flag on the final door that gets opened and once the flag is set, it triggers the final boss to appear (if object door has flag #name# then move final boss to current room). This method would require that the final door is ALWAYS the last door triggered or you'd have a mess on your hands with this method.

As HK said, having a little more info would be helpful. PM me if you need assistance. I think I can be helpful especially if you're not a super strong coder.

HegemonKhan
We need to know how he~she has it set up, is the final boss just a combat script block, is it an actual object that gets moved into the room and they click on its 'fight' Verb~button, or etc etc etc

we can't help until we know how the person has the design of it set up, otehrwise, we'd just be giving him~her a way of doing it, which they may not want to do~use that design method way that you give them, instead just wanting us to trouble shoot and get their design moethod to work.

The Pixie
quatropig wrote:Well I have come to the end of making my first game. Many hours have been spent and unfortunatly I can't trigger the event I need to make the end of game boss appear.

I would like the boss to appear when the inventory contains 10 specific items. I tried making two doors, each requiring 5 keys. When the first is opened it moves to my "warehouse" and a second is swapped in its place. I then have it that opening the door triggers the boss. This failed, but I am unsure why (then again it is waaaaay past bed time).


Any other ideas for making this happen, and of course as as a noob I am limited to the GUI......

Should the boss appear as soon as the tenth item is picked up? If so, you will need a script on each of those ten items that is triggered when it is picked up. The script has to move the item to the player's inventory, and then check if the player is carrying all ten item. If she is, summon the boss.

For each object, go to the inventory tab, tick "object can be taken" (probably already is), then select Take: Run script from just above it. Here is code that will do that for three items, item1, item2, item3, for a boss called boss. Copy-and-paste, then modify for one object, then go in game, collect the other nine, then get this and see if it works. Once it works for one object, do the same for the other nine.
this.parent = player
if (item1.parent = player and item2.parent = player and item3.parent = player) {
boss.parent = player.parent
}

The first line moves the item to the inventory, the second line checks for all three items (you will need to modify for your ten), the third line gets the boss here.

quatropig
That worked perfectly The Pixie! Thank you so much. Thanks too to the other posters for their advice.

Now how to make the boss follow the player around and trigger the boss to speak upon being called.... ideas? Cheers

HegemonKhan
to do 'following' functionality, credit goes to Sgreig for this code, using your desired scenerio:

boss.parent = player.parent

<game name="xxx">
</game>

<turnscript name="global_turnscript">
<enabled />
<script>
boss_following_the_player_function
</script>
</turnscript>

<function name="boss_following_the_player_function">
if (not boss.parent = player.parent) {
boss.parent = player.parent
}
</function<


concept:

http://docs.textadventures.co.uk/quest/ ... arent.html

the default new game code, has the 'player' Player Object in the 'room' Room Object, this is what it looks like as a script:

player.parent = room

and this is what it looks like as an Attribute code tag:

<object name="room">
</object>

<object name="player">
<attr name="parent" type="object">room</parent>
</object>

which is the same as:

<object name="room">
<object name="player">
</object>
</object>


and we can move the 'player' Player Object into a different Room Object, let's have it called, 'room2', like this:

player.parent = room2

the defining~setting~re-setting~altering~changing of the 'parent' Object Attribute does the same thing as the 'MoveObject' script:

MoveObject (player, room2)

anyways, back to explaining the concept, so, by doing this:

boss.parent = player.parent

player.parent <===> room <===> boss.parent
player.parent <===> room2 <===> boss.parent

and thus, whatever 'parent' Room Object the 'player' Player Object is in (set~re-set to), so too is the 'boss' Object, thus creating a 'following' functionality.

or, if you rather use the 'MoveObject' script, here's how it would look:

MoveObject (boss, player.parent)

<game name="xxx">
</game>

<turnscript name="global_turnscript">
<enabled />
<script>
boss_following_the_player_function
</script>
</turnscript>

<function name="boss_following_the_player_function">
if (not boss.parent = player.parent) {
MoveObject (boss, player.parent)
}
</function<

The Pixie
A slightly better way is to run it as a "Script when entering a room" (which I think is a fairly recent addition, which may be why sgrieg did not use it). You can find it on the Script tab of the game object.

Also, I would put a flag on the boss, and check that. If it is true, the boss will follow, but not otherwise. And I would add a message alerting the player to his presence...

Here is an example (type SHOUT in the game and the boss will follow):
<!--Saved by Quest 5.6.5510.29036-->
<asl version="550">
<include ref="English.aslx" />
<include ref="Core.aslx" />
<game name="testing game stuff">
<gameid>d83ba5bb-2e3c-4f31-80c9-3e88a2dc082c</gameid>
<roomenter type="script">
if (GetBoolean(boss, "following")) {
boss.parent = player.parent
msg ("The boss follows you.")
}
</roomenter>
</game>
<object name="room">
<inherit name="editor_room" />
<object name="player">
<inherit name="editor_object" />
<inherit name="editor_player" />
<attr name="alcohol_level" type="int">0</attr>
</object>
<exit alias="south" to="room2">
<inherit name="southdirection" />
</exit>
</object>
<object name="room2">
<inherit name="editor_room" />
<exit alias="north" to="room">
<inherit name="northdirection" />
</exit>
<object name="boss">
<inherit name="editor_object" />
</object>
</object>
<command name="shout">
<pattern>shout</pattern>
<script>
if (boss.parent = player.parent) {
msg ("You shout at the boss, and he comes after you!")
boss.following = true
}
else {
msg ("You shout...")
}
</script>
</command>
<type name="hammer">
<take type="script">
msg ("You take the hammer")
</take>
</type>
</asl>

quatropig
Thank you everyone, I really appreciated the ideas and help. My game is now done and uploaded for my g-e-o-c-a-c-h-e puzzle. Cheers!

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums