How to make the use of a trap door dependent..

Post » Fri Dec 11, 2009 8:01 am

Hullo there!

I've been wondering how to make the use of a trap door dependent on the position of a "false" bed.
"False" because it moves when you have the appropriate key, so the trap door is revealed.
In case the player finds the trap door beneath the bed, I want to prevent him from using it - until the bed is moved away.. makes some sense, doesn't it? ;)

Now, the question is: How do I do that?

I tried it that way:

begin IT_dh_trapdoor

; trap door is only accessable if
; the false bed has been moved to the 'open' position



if ( OnActivate == 1 )

if ( "_it_dh_falsebed"->MoveWorld X, 15 == 1 )

activate

else

messagebox "You cannot pass since the bed is blocking the trap door"

endif

endif


end


But I got, as you probably realized, an error message (because of line 10).
So would you help me out a bit? :)

P.S.: I work with all 3 .esms (Morrowind, Tribunal and Bloodmoon) - that seems important, somehow (I reckon it's because of the limited functions with "pure" Morrowind or whatsoever).

Thanks a lot!
User avatar
Melis Hristina
 
Posts: 3509
Joined: Sat Jun 17, 2006 10:36 pm

Post » Fri Dec 11, 2009 6:18 am

I suggest a variable which is 0 before the bed is moved and is set to 1 once the bed is moved. Then you can use said variable in the conditional statement which is giving you errors.

Hope this helps.

~Blessed be
User avatar
Ymani Hood
 
Posts: 3514
Joined: Fri Oct 26, 2007 3:22 am

Post » Thu Dec 10, 2009 5:36 pm

I very appreciate your help

So I declare a variable (e.g. short BedMoved) and set it 0 when the bed still blocks the trap door. But how do I check that it blocks it or not? I mean isn't that part of the "Bedscript" where the bed is actually moved?

Someone help me out a little bit more, please? :)
I am confused right now.
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Fri Dec 11, 2009 2:45 am

There is much that you have not revealed about your mod so I will have to speculate and invent. If my assumptions are correct, then I hope you can make sense enough of my invention to apply it to your project providing you approve of the solution.

I suppose you have a unique bed that wears a script that moves it to provide direct access to the trap door. Since the trap door script will have to reference that bed's position you will need to mark it references persist. Make a note of the position of the bed when it is in its moved (uncovering trap door) position. Your posted script references movement with respect to the x-axis so that is what I will have you check. If MoveWorld changes the y-axis position then make the adjustment in my example script. Since you appear to be moving in the positive x direction you will check for a value greater than or equal to the bed's final position. If I am mistaken and you are moving the bed in the negative direction check for less than or equal to the bed's final position. Depending on how you check the progress of MoveWorld you might need to check a slightly lower value for x if you are timing the movement, but if you are moving the bed until it has a particular x value then you can reference that value exactly.

Assuming the bed's ID is _it_dh_falsebed (it is not the best idea to begin IDs with an underscore), and the bed's x-coordinate when in the moved position is 500, this is the script you might attach to your trap door:

Begin IT_dh_trapdoor; Attached to trap door (ID); Trap door is only accessible if the false bed has been moved to the 'open' positionif ( OnActivate == 1 )    if ( ( "_it_dh_falsebed"->GetPos x ) >= 500 ) ; bed moved        Activate    else ; bed covering trap door        messagebox "You cannot pass since the bed is blocking the trap door."    endifendifEnd

User avatar
Jennie Skeletons
 
Posts: 3452
Joined: Wed Jun 21, 2006 8:21 am

Post » Fri Dec 11, 2009 8:12 am

I really should've revealed more about this mod, you're right.. (I'll keep that in mind for the next time)
Well, but thanks to you, it works now :)

Your script is a big help for me (now I know how to do that kind of thing), so you're assumptions were mostly correct.

Edit: How come it's no good idea to start an object ID with an underscore? I saw that in a tutorial of.. Dragonsong .. yeah.
User avatar
Darrell Fawcett
 
Posts: 3336
Joined: Tue May 22, 2007 12:16 am

Post » Thu Dec 10, 2009 4:48 pm

How come it's no good idea to start an object ID with an underscore? I saw that in a tutorial of.. Dragonsong .. yeah.

That advice is derived from experience with Morrowind's quirky game engine. It's not recommended to start an ID with a number as well. Both issues are listed among others in this paper on http://www.uesp.net/wiki/Tes3Mod:Scripting_Pitfalls.
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Thu Dec 10, 2009 9:41 pm

That advice is derived from experience with Morrowind's quirky game engine. It's not recommended to start an ID with a number as well. Both issues are listed among others in this paper on http://www.uesp.net/wiki/Tes3Mod:Scripting_Pitfalls.


Hey, thanks. That will save me a lot of trouble ;)
User avatar
Sarah Knight
 
Posts: 3416
Joined: Mon Jun 19, 2006 5:02 am


Return to III - Morrowind