Key problem

Started by Dark Hedgehog, Thu 01/07/2004 06:01:18

Previous topic - Next topic

Dark Hedgehog

Hi, I am new to this forum, but I am very good in forums, I have my own site.

Anyways, I am having a problem in an area I want to finish, since I am horrible at comprehension, I may ask a lot.

I am making an alteration of "Maniac Mansion" for my cousin since he's a major fan of the original NES game.

I want to alter the key position so that its harder to get rather than looking under the mat.

I want, when you pull up the mat, the character to find a switch after pulling the mat, then after the mat is pulled, the person uses the switch and it takes away an object at the top of the door, which I already accomplished through a lot of time figuring it out.
After this, here is where I am stumped.

I want to have the person pick up the crowbar, which is already placed down, and I got that done too.
After the person picks up the crowbar, I want to knock down the key with it and pick it up.

Any suggestions?

I am having a problem getting the key to be knocked down from the crowbar and the key disappearing.
And I want to lose the crowbar and the key, but the key goes in the inventory to open the door and into the next room.

Jet Kobayashi Zala

I'm relatively new to scripting, so here's my guess.
Make an interaction (on the key object) for when the user uses the crowbar on the key object.
Have the first action be a conditional set if the item is the crowbar's item number, then run a script. In the script, use MoveObjectDirect (). MOD will ignore walkable areas so it can fall correctly.

MoveObjectDirect (int object, int x, int y, int speed)

It moves object to the x, y coordinates you give. Then have it drop straight down to where the character can pick it up, and you can play with the speed as you want. Lemme know if that helps.

Jet Kobayashi Zala

Here's another idea I thought of using. Here's a very quick MS paint pic:



Now, for the first part of the key falling, have it use MoveObject().

MoveObject (int object, int x, int y, int speed)

It works exactly the same as MoveObjectDirect, but it does NOT ignore walkable areas. Since the walkable area has a curve, if you have it use MoveObject () to get to the bottom of the arc and then you use MoveObjectDirect () to pass through the small, unwalkable area, you can simulate a sort of effect as if they nabbed the key with the crowbar and flinged it off a little. Just another idea to throw out.

Dark Hedgehog

#3
I tried it out but the key didn't even move one bit.

Nothing happend, not even an error.

All I got was that "timer" icon and it disappeared.

By the way, I am using objects.

When I get the crowbar, I have the interaction editor, level editor, have the conditional if the character HAS an inventory item and uses it on the object, something happens.

But I can't get the object to move.

Wolfgang Abenteuer

You may have to play around with the key's speed in the MoveObjectDirect statement in order to make it so the key doesn't just "disappear" (i.e. move really fast to its destination and just seem to disappear).Ã,  Start out with a really slow value and increase until you find a speed that best suits the scene.

So, what exactly is it you want to happen in the scene?Ã,  The key is on the bookshelf, the player walks over with the crowbar, lifts the crowbar up, knocks the key down, then once the key is on the floor, the character bends down and picks up the key?Ã,  Is that kind of what you're trying for?Ã,  That would be done somewhat like this:

if (character[EGO].activeinv == 1) { //if 1 is the number of the crowbar
Ã,  ChangeCharacterView(EGO,1); //changes the character's view to the crowbar-using view
Ã,  AnimateCharacter(EGO,0,5,0); //lifts the crowbar up
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  MoveObjectDirect(0,200,150,5); //key falls to the ground
Ã,  while (IsObjectMoving(0) == 1) {
Ã,  Ã,  Wait(1);
Ã,  }

Ã,  AnimateCharacter(EGO,1,5,0); //puts the crowbar away and picks up the key
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  ObjectOff(0); //key has been picked up, so turn it off
Ã,  AddInventory(0); //give the key to the player

Ã,  AnimateCharacter(EGO,2,5,0); //character stands back up
Ã,  while (character[EGO].animating == 1) {
Ã,  Ã,  Wait(1);
Ã,  }
Ã,  ChangeCharacterView(EGO,0); //return the character to his normal walking view
}

That should be the whole process, including any animations for the character you may need.Ã,  Of course, the key part itself is rather simple (just the bolded part), but I'm not quite sure what it is exactly you were having problems with.Ã,  Just the key falling or the whole sequence?Ã,  Do you mean the key stayed at the top of the dresser and didn't fall to the floor or it simply disappeared altogether?

~Wolfgang

Dark Hedgehog

#5
For your personal need, i'll state it as if real life.

I walk up to a door, there is a key up there.

I can't reach it, so, I bang the door with the crowbar and the key falls down to where I can pick it up.

Thus, I can use the key to open the door, and, I can go in the door and enter the next room.

And where exactly do I put that code?

Jet Kobayashi Zala

Wolfgang's script would replace the conditional in the branch menu with a run script. Instead of using the conditional if in the branching interaction bar, set it so to run that script instead of a conditional.

Mr Jake

I dont think you need the WHILE commands....

MoveObjectBlocking is int object, int x, int y, int direct... So you can use MoveObjectBlocking and have direct movement instead of using the 'WHILE' conditions

Dark Hedgehog

#8
Thanks!  All I need to do is now tweak it so that I set the walk point, whatever its called, so that he walks to the key and uses the crowbar.

Thank you!

If I have anymore problems that I cannot figure out, i'll let you know.

And I finally added new things and got into the room and set the position to enter it in!
Thanks.

SMF spam blocked by CleanTalk