About animating the object

Started by , Tue 02/03/2004 12:57:56

Previous topic - Next topic

Egor Petrov

hello! i'm from Russia so excuse me for my english...  :-[
My question is about animating object inside the room..
well, i have an object(slide door) and i've made an animation for it and it's working very well, but my problem is - i've made this door open when player interacts hotspot(switch)...So when the player interacts that switch the door opens, but if player interacts this switch again door starts animating again..again and again..everytime player interacts switch...
I want that door opens only once, so i really need your help.. :)

if it'll will help you out i've made my animation of door like that(w/o scripting):
In Room-->Area-->Interaction...
Interact hotspot(switch)
              |
            Object - Start object animating(..,..,..,false)
I thought this FALSE will stop this door to open again..nope...
             

Darth Mandarb

Set a room variable called door (or whatever you want to call it) and set it to 0 (zero).

0 being the door closed, and 1 would mean it's open.

When you 'Interact' with the switch run a conditional statement to check 'if Variable is certain value'

If door=0 // meaning door is closed
run opening animation; // as you have it now
set variable(door)=1;
Stop running more commands;

If door=1 // meaning door is open
run closing animation;
set variable(door)=0;
stop running more commands;

The 'Stop Running More Commands' is really important!  Because other wise it'll set the variable to 1 and the next if statement will then be true and it'll just close the door again!

(You'll probably want to have a walkable area behind the door that is activated and deactivated depending on the whether the door is open or closed!!)

You can also make it so that the only thing you can do it open the door by removing the second if statment.  That way, once the door is open it's open permanently (but that's not very realistic or practical.)

Hope this helps!

~ d

kaddafi

thanks a lot Darth Mandarb! It works
Yoy really helped me out  ;D

SMF spam blocked by CleanTalk