Need help with complex scripted sequence (solved)

Started by TM, Fri 30/07/2010 12:56:12

Previous topic - Next topic

TM

Hy. I really need help figuring this out. What would be the best approach to do the following:

1. The player moves (blocking) onto a specific spot and becomes idle.
2. An NPC then starts animating in the background.
3. If the NPC-animation reaches a specific frame, user loses control + player starts animating another sequence.
4. A function in the GlobalScript is executed.
5. This function calls a Room function to change something in the background image.
6. Both NPC and player play their animations simultaneously.
7. When the player-animation is done, the player performs another blocking move (NPC may or may not still be animating).
8. The player reaches its destination, the user gets the control back.

Thanks thanks thanks. The threads drive me mad.

My website & blog

Dualnames

I don't get the control thing, but using a global variable you can disable clicks.(the variable can be used in the exact same way I use finished)

It's not much,but it will point you in the correct direction.

Code: ags

import function GlobalFunction(here);
bool check;
bool finished;

function room_AfterFadeIn(){

player.Walk(x,y,eBlock,eWalkableAreas); // you don't define much here
cNPC.LockView(viewhere);
cNPC.Animate(0,5, eRepeat, eNoBlock, eForwards);

}

function repeatedly_execute() {


 if (finished==false) {
  if (cNPC.Frame==specificframe) {
   if (check==false) { 
      player.LockView(viewhere);
      player.Animate(0,5, eRepeat, eNoBlock, eForwards);
      GlobalFunction(0);
      check=true;
   }
  }
    if (player.Frame==specificframe) {//view may fit you better here
     player.UnlockView();
     cNPC.UnlockView();
     player.LockView(viewhere);
     cNPC.LockView(viewhere);
     cNPC.Animate(0,5, eOnce, eNoBlock, eForwards);
     player.Animate(0,5, eOnce, eBlock, eForwards);
     player.Walk(x,y,eBlock,eWalkableAreas); // you don't define much here
     finished=true;
     }
 }

}




Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

TM

I think I got it to work now with the help of your repeatedly_execute() tip. I had used repeatedly_execute_always() and had run into thread-troubles. Anyway, I think it's solved. Thank you.

My website & blog

SMF spam blocked by CleanTalk