having my character disappear when object is animating.[SOLVED]

Started by Mouth for war, Wed 25/02/2009 21:06:29

Previous topic - Next topic

Mouth for war

Ok! Here's my problem...when my character reads a spell in a book an object starts animating...no problems there...but when that smokeanimation reaches frame 3 i want the character to disappear. I looked through the forum but couldn't find an appropriate answer. This doesn't quite work
Here's when the animation starts...could someone please help? :)

object[3].Visible = true;
object[3].SetView(5, 3);
object[3].Animate(3, 2);
if (object[3].Frame!=2) {
"Character disapperars"
mass genocide is the most exhausting activity one can engage in, next to soccer

Matti

Quote from: Mouth for war on Wed 25/02/2009 21:06:29
object[3].Visible = true;
object[3].SetView(5, 3);
object[3].Animate(3, 2);
if (object[3].Frame!=2) {
"Character disapperars"

Why do write "Frame!=2" instead of "Frame==3" ? In this case he would disappear right at the beginning of the animation, doesn't he?

Mouth for war

i tried to type frame = 3 too but nothing happens until the animation is finished...and i want it to happen on frame 3 as i said
mass genocide is the most exhausting activity one can engage in, next to soccer


Matti

You have to write object[3].Animate(3, 2, eNoBlock);

..because eBlock is the default and thus the script will be stopped until the animation is finished.

Mouth for war

This is what it says now...it's another thing...i want it to play a sound instead when the animation plays frame 10 but it doesn't work

// room script file
function room_AfterFadeIn()
{
Wait (50);
object[0].Visible = true;
object[0].SetView(5, 3);
object[0].Animate(3, 0, 1,  eNoBlock);
if (object[0].Frame!==10) {            (Parse error in expr near object)
PlaySound (3);}
object[0].Visible = false;
cEgo.Transparency = 0;
}
mass genocide is the most exhausting activity one can engage in, next to soccer

Matti


Mouth for war

function room_AfterFadeIn()
{
Wait (50);
object[0].Visible = true;
object[0].SetView(5, 4);
object[0].Animate(4, 2, 1, eNoBlock);
if (object[0].Frame==10) {           
PlaySound (3);}
object[0].Visible = false;
cEgo.Transparency = 0;
}

Now the animation don't even play :( just skips to everything after that
mass genocide is the most exhausting activity one can engage in, next to soccer

Khris

AGS doesn't wait, every command is executed right away.

Code: ags
function room_AfterFadeIn()
{
Wait (50);
object[0].Visible = true;
object[0].SetView(5, 4);
object[0].Animate(4, 2, 1, eNoBlock);
}

bool done;
// create this function using the room's event pane
function Room_RepExec() {
  if (!done && object[0].Frame==10) { 
    PlaySound (3);
    object[0].Visible = false;
    cEgo.Transparency = 0;
    done = true;
  }
}



Mouth for war

function room_RepExec()
{
if (!done && object[0].Frame==10) {
    PlaySound (3);
    object[0].Visible = false;
    cEgo.Transparency = 0;
    done = true;
  }

Error line 13 "undefined symbol done" I'm quite new to this scripting stuff as you can tell :)
mass genocide is the most exhausting activity one can engage in, next to soccer

Matti

You have to declare variables. In this case "bool done;" like KhrisMUC wrote.

Mouth for war

mass genocide is the most exhausting activity one can engage in, next to soccer

SMF spam blocked by CleanTalk