What is wrong with this code?

Started by Konador, Tue 27/07/2004 16:44:41

Previous topic - Next topic

Konador

Code: ags
#sectionstart object4_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function object4_a() {
Ã,  // script for object4: Ext.modes object
if (UsedMode(PULL))
{
Display("I'll just move this over a little bit");
Wait(30);
SetCharacterView(AZ, 16);
AnimateCharacter(AZ, 2, 7, 0);
MoveObject(4, 374, 128, 3);
ReleaseCharacterView(AZ);
ObjectOn (8);Ã,  
}
else Unhandled(); 
}
#sectionend object4_aÃ,  // DO NOT EDIT OR REMOVE THIS LINE


No errors come up when compiling, but the character doesn't perform the animations I've put in, and the object doesn't move. What could be the reason for this?

Moox


Konador

Thanks for the suggestion. I just tried it and got the same problem. The text displays, and the ObjectOn works, but the MoveObject and character actions seem to be getting skipped?

MrGenius

I haven't used ags in a while but I think you must add Wait after AnimateCharacter and MoveToObject.

AnimateCharacter(AZ, 2, 7, 0);
Wait(30); //Not exactly 30,you must calculate this.It's frames / speed or... frames x speed...I don't really remember  :-\

Moox

AnimateCharacterEX is blocking, it should display... Try a
Wait(10);

Konador

Thanks, the character animation works now, but the object is still not moving.

Gilbert

#6
if you want the character to animate first, then move the object:
AnimateCharacter(AZ, 2, 7, 0);
while (character[AZ].animating) Wait(1);
MoveObject(4, 374, 128, 3);
while (IsObjectMoving(4)) Wait(1);

OR, if you want the character to be animating and the object to be moving at the same time:
AnimateCharacter(AZ, 2, 7, 0);
MoveObject(4, 374, 128, 3);
while (character[AZ].animating||IsObjectMoving(4)) Wait(1);

That's because AnimateCharacter() and MoveObject() are both non-blocking. (unless you use AnimateCharacterEX().)

Edit: yeah radiant, hehe.

Radiant

Yes, except that it should be while rather than if :)

SMF spam blocked by CleanTalk