Here's a quick dump of the script. I'm currently working on cleaning things up, moving stuff around and commenting everything, so apologies for any messiness in that version there.Hoeloe wrote:I'd be interested to see some of the code for this boss fight. I may well be up for making some bosses and cutscenes using this tool, but I'm not very familiar with Lua or LunaDLL. I'm a pretty fast learner if given an example, though.Rockythechao wrote:Full battle with pre- and post-fight cutscenes.
For now, the biggest things I can think of are see PlayMusic, LoadImage and PlaceSprite. Other than that, the API's proven to be very versatile
Cutscenes and boss AI consist of linear sequences of if then elseif then statements based on a constantly-incrementing "current frame" variable. It's like keyframe animation: you're effectively creating a timeline and defining different actions to occur on specific frames and ranges of frames in these sequences.
So, for example, you'd perform an action on frame 1, then do something repeatedly until frame 59, then perform another action on frame 60. That would look something like:
Code: Select all
-- Comments in Lua are marked by double-dashes, like this one here -- Jump if (cutsceneFrame == 1) then npcForceJump (NPC reference, Jump strength) -- Move left in the air for roughly 60 frames (1 second) elseif (cutsceneFrame < 60) then npcForceWalkLeft (NPC reference, walk speed) -- Start a line of dialogue elseif (cutsceneFrame == 60) then startDialog (NPC to animate, Name to display, Line of dialogue, time text is shown, time NPC plays talking animation) end
With this boss, I have the behavior split up into three main sequences: the pre-battle scene, the battle and the post-battle scene. The two cutscenes are straightforward sequences with no time travel hijinx going on, but the battle sequence is further split up for the different phases of the battle (jumping around, performing the thousand-stab attack, doing the pogo pattern, being vulnerable and being defeated) and they all manipulate the current frame to get the desired behavior.
There's a few other steps involved in getting the audio and animation stuff ready, too. You'll need to set up in-script reference variables, NPC code text files and extended sprite sheets. I'll share the full level once the last few bugs have been stomped out and the code's more organized.