Problem with object-animation script!

Started by Minimi, Sun 13/07/2003 23:23:36

Previous topic - Next topic

Minimi

Well, I want to make that at start the water must be still by using sprite 69, and when you interact with it, it must do an animation wich is view 6, loop 1 and has got 2 frames... and when you click again, it must be reset to sprite 69!... here is my script... the game crashes when I interact with the object, it complains about line 12! But I can't find the problem!

1#
2#
3#// room script file
4#int water = 0;
5#function object2_a() {
6#// script for object2: Interact object
7#SetObjectView(2,6);
8#if (water == 0) {
9#AnimateObject(2,1,0,1);
10#water = 1;}
11#
12#if (water == 1) {
13#SetObjectGraphic(2,69);
14#water = 0;
15#
16#}  
17#
18#}

Wolfgang Abenteuer

Change the "if" in line 12 to an "else if".  By executing your script now, it will start the interaction, set "water" to 0, run the first "if" statement which, at the end, sets "water" to 1, and then that part makes the second "if" statement true (water == 1) so it runs that also.

~Wolfgang

SMF spam blocked by CleanTalk