Skip to reading
PCA Script Programming

28. Movement, animation and concurrent work

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page
Code example
function run()
    player walks to archive_door
    player faces archive_door
    play player animation "nod"
    wait until player animation ends
end

Walking uses navigation and approach settings; moving/teleporting is a different operation. An imported animation name must match a clip or configured state. Starting playback is not the same as waiting for it to finish. A looping idle clip never naturally ends, so the last wait above is suitable only for a finite clip.

Code example
function pan_notice()
    camera_shake({"duration": 0.3, "power": 0.1})
    log("Camera beat finished.")
end
Code example
function run()
    parallel
        pan_notice()
        show_message({"text": "The machine wakes.", "duration": 2})
    end
    log("Both branches finished.")
end

Each immediate instruction in parallel is a branch. They start together, and the enclosing block waits for all branches. Wrap a sequence in a function when one branch needs several ordered steps. Parallel branches share local containers; avoid having both branches write the same state.

Readable start commands offer non-blocking versions of supported adventure actions. They are not a universal “make any function asynchronous” keyword. For staged camera, speech and animation sequences with many timings, the Cutscene Designer remains useful.

Page 36 of 357Permalink
Go to page