This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| cw4:scripting:running_when_paused [2021/02/07 22:47] – <- virgilw | cw4:scripting:running_when_paused [2025/02/14 14:57] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | < | + | < |
| + | <=[[cw4:Tutorials]] | ||
| ===== Executing Scripts When Paused ===== | ===== Executing Scripts When Paused ===== | ||
| ==== Global Scripts ==== | ==== Global Scripts ==== | ||
| - | Global script can be added to any cpack. Open a cpack and select the SCRIPTS tab. From there click " | + | Global script can be added to any cpack. Open a cpack and select the SCRIPTS tab. From there click " |
| After adding a script to either, or both sections, select the script in the pre/post section by clicking on it. That will show " | After adding a script to either, or both sections, select the script in the pre/post section by clicking on it. That will show " | ||
| Line 11: | Line 13: | ||
| ==== Units ==== | ==== Units ==== | ||
| - | Units do not directly support executing scripts while the game is paused, however, you can simulate the effect by using a global script that is set to run as paused to sent a message to units. | + | Units can register for special messages [[4rpl: |
| - | + | ||
| - | Create a global | + | |
| - | <code 4rpl> | + | |
| - | SendMsg(" | + | |
| - | </ | + | |
| - | + | ||
| - | In a script attached to a unit add this code: | + | |
| <code 4rpl> | <code 4rpl> | ||
| :Awake | :Awake | ||
| - | | + | |
| : | : | ||
| Line 27: | Line 22: | ||
| </ | </ | ||
| - | Add the global script to either the pre or post Global Control section and set to it run when paused. Now the " | ||