Problem Moving Object (SOLVED)

Started by , Mon 17/07/2006 18:09:02

Previous topic - Next topic

Munchkeen

I was looking through forums and manual and couldn't find a solution. I want an object to move while some messages are displayed on the screen. Whatever I do I can't even get the object to become visible. I tried 'object is initially visible' and it doesn't work. I tried changing it to a Character, but a Char want show either (yes, I set the char to view in that room).
Here's a piece of admittedly crappy coding I ended up with after trying various combinations:

Code: ags

// room script file
//var to get object moving
int moveship;

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: First time player enters room
  //wait before showing
Wait(30);
//show opening text
Display("blabla.");
//change var - move object
moveship = 1;
//continue text
Display("blabla");
}
#sectionend room_a  // DO NOT EDIT OR REMOVE THIS LINE

#sectionstart room_b  // DO NOT EDIT OR REMOVE THIS LINE
function room_b() {
  // script for Room: First time player enters room
//moving object
if (moveship == 1) {
oShip.Visible = true;
oShip.Move (270,170,eAnywhere);
}  
}
#sectionend room_b  // DO NOT EDIT OR REMOVE THIS LINE
 


EDIT: I've managed to make object visible but it won't move.

Ashen

#1
Why have you done it as two seperate 'First time player enters room' interactions, when it should work perfectly well as one (is this just one of the 'combinations' you tried?):

Code: ags

#sectionstart room_a  // DO NOT EDIT OR REMOVE THIS LINE
function room_a() {
  // script for Room: First time player enters room
  //wait before showing
  Wait(30);
  //show opening text
  Display("blabla.");
  //move object
  oShip.Visible = true;
  oShip.Move (270,170,4,eBlock,eAnywhere);
  //continue text
  Display("blabla");
}

(Note that the Object.Move function needs a SPEED and BLOCKING parameter before the WALKWHERE parameter.)
EDIT: This is probably why you can't get it to move. You currently have it moving with a speed of eAnywhere (I think equal to 1, or possibly even 0), and requiring Walkable areas. Since you've used the eAnywhere parameter (albeit in the wrong place) I guess you don't have Walkable areas for it to move on.

However that's not that important if you can't get the object to show in the first place. Is it possible that it IS visible, but behind something - another object, or a Walkbehind area, for example? Have you given it a graphic that stands out from the background?
EDIT2: So, what was the problem with getting it visible?
I know what you're thinking ... Don't think that.

Munchkeen

#2
Strange thing, I had to replace my background and it worked. But the script is giving me a headache. Now it won't load the game because of a "function error(-18)" so I scratched it and trying to rebuild.

EDIT: OK, I scratched everything and put the code you gave me and it works brilliant. Thanks!

SMF spam blocked by CleanTalk