Rep Exec and setting baseline

Started by pmartin, Wed 19/09/2012 03:47:49

Previous topic - Next topic

pmartin

I have a room for a cutscene, In a game that I use multiple camera angles in one room. There's a scene on this cutscene where the background changes, by SetBackgroundframe, I thought, that since this isn't the only scene where I would put a different camera angle, Instead of calling for all the code needed for the change on the room after fade in (where the cutscene happens) I would put the extra code needed for the camera angle on repeatedly execute. This isn't needed for the scene, I just did it to figure out how I would do later when this would help outside of cutscenes, in other rooms.

So, on the cutscene script I call for the other background, and in the repeatedly execute I put a If statement: If (GetBackgroundFrame == 1) { SetWalkkbehindBaseline (2, 300);} (I don't actually remember if that's the function for setting a walk behind baseline, but in the real script I wrote it properly )


What happened is that the If statement didn't work. When I called for Frame 1 on the cutscene script the frame would change, but the set baseline wouldn't work. I'm sure I didn't make any mistake while writing the code because later I cut and pasted it on the after fade in and it worked (although I took the if statement out). Does setting walk behind baselines on rep_execute doesn't work? I'm sure I didn't do anything wrong. (I tried it several ways, putting else statements, checking the initial state of the baseline...)
.

Khris

The thing is that all the rep_exe functions won't get called while there's a blocking event going on (like a cutscene, or a player.Say or Display command).

What you want to do is perfectly possible, you have to use the repeatedly_execute_always function though. There's no room event for it; just add it to the room script and it gets called:
Code: ags
function repeatedly_execute_always() {
  if (GetBackgroundFrame() == 1) SetWalkBehindBase(2, 300);
}

pmartin

You're awesome Khris, thanks a lot. There was indeed a blocking event going on. :)
.

SMF spam blocked by CleanTalk