Is it possible to create a pause system through scripting like the one in DA:O? (for a SP map)
As if you pressed F10, but you can still move camera around, select units, and queue 1 order for each unit in your control. Well, yea, like DA:O.
Is it possible with scripting? (doesn't seem so with triggers).
Yes it's possible. Look at the "Pause Unit" action.
edit: here you go, not only does it pause the game but it also freezes all animations in place, yet you can still select units and issue orders and even shift+queue orders.
Space Pressed
Events
UI - Player Any Player presses Space key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Paused == false
Then
Debug - Display "Paused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = true
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actor - Send actor message "AnimSetPausedAll" to all actors contained by game region (Entire map)
Else
Debug - Display "Unpaused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = false
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actor - Send actor message "AnimSetPausedAll 0" to all actors contained by game region (Entire map)
s3rius thanks for the heads up, the first won't be a problem, ill find some ways to bypass the second :)
RielyStarcraft thank you so much for writing the triggers however, I can't get it to work well, mostly the problem is with "Variable - Set Paused = true" and "Variable - Set Paused = false" I think since you didn't (seem?) to create the varible, so I created one myself (but probably not right, just a boolean named pause set to false) anyway this is how it looks in my map how do I get it to work?
Space Pressed
Events
UI - Player Any Player presses Space key Down with shift Allow, control Allow, alt Allow
Local Variables
Paused = false <Boolean>
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Paused == false
Then
Debug - Display "Paused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = true
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actions
Actor - Send actor message "AnimSetPausedAll" to all actors contained by game region (Entire map)
Else
Debug - Display "Unpaused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = false
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actions
Actor - Send actor message "AnimSetPausedAll 0" to all actors contained by game region (Entire map)
Currently all the animations stop, but the game continues to play normally, and also I can't "unpause" it (each press of Space shows the "pause" message and nothing changes). Sorry this is the first time I mess with "real" triggers :)
First of all, it'd be nice if you put your triggers into code tags:
<code>
write here
</code>
(instead of "<" or ">" you gotta write "<<" or ">>")
Now, regarding your problem: The Paused variable is a global boolean variable. You're declaring it locally there. If it's local then it won't carry-over to the next time you press the space bar. Make it a global variable and it will.
The code I posted will pause behaviors and effects, but there is a bug in it - it'll cause any missile in flight to be destroyed. I'm not really sure why that is.
Also I just realized there's a Pause All Units action so the loop I made is superfluous.
Thanks for the explanation.
I also just saw the Pause All Units Action (how stupid of me not to even search for something like that), and add it. Everything works good now, all animations pause and resume together with the units themselves. Lucky no units or enemies use missile, and for now no ability as missile as well :)
You sure its superfluous? I didn't test the action by itself but even with my little knowledge I think ur code doesn't have anything superfluous about it.
And ill use the code tag next time sorry for the inconvenience.
I just realized when I pasted in the triggers above somehow a line got left out where I called Pause Unit on each picked unit. Sorry if that was a source of confusion. Anyway, just replace the "Pick All Units" actions with Pause/Unpause all units.
It's necessary to pause the units as well as pause the actors for the full effect.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Is it possible to create a pause system through scripting like the one in DA:O? (for a SP map) As if you pressed F10, but you can still move camera around, select units, and queue 1 order for each unit in your control. Well, yea, like DA:O. Is it possible with scripting? (doesn't seem so with triggers).
Yes it's possible. Look at the "Pause Unit" action.
edit: here you go, not only does it pause the game but it also freezes all animations in place, yet you can still select units and issue orders and even shift+queue orders.
Space Pressed
Events
UI - Player Any Player presses Space key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
Paused == false
Then
Debug - Display "Paused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = true
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actor - Send actor message "AnimSetPausedAll" to all actors contained by game region (Entire map)
Else
Debug - Display "Unpaused" as debug output using Type 1, and Do display it in the game window
Variable - Set Paused = false
Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions)
Actor - Send actor message "AnimSetPausedAll 0" to all actors contained by game region (Entire map)
A simple actor message is enough? Oh well.
Just keep in mind that:
s3rius thanks for the heads up, the first won't be a problem, ill find some ways to bypass the second :)
RielyStarcraft thank you so much for writing the triggers however, I can't get it to work well, mostly the problem is with "Variable - Set Paused = true" and "Variable - Set Paused = false" I think since you didn't (seem?) to create the varible, so I created one myself (but probably not right, just a boolean named pause set to false) anyway this is how it looks in my map how do I get it to work?
Space Pressed Events UI - Player Any Player presses Space key Down with shift Allow, control Allow, alt Allow Local Variables Paused = false <Boolean> Conditions Actions General - If (Conditions) then do (Actions) else do (Actions) If Paused == false Then Debug - Display "Paused" as debug output using Type 1, and Do display it in the game window Variable - Set Paused = true Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions) Actions Actor - Send actor message "AnimSetPausedAll" to all actors contained by game region (Entire map) Else Debug - Display "Unpaused" as debug output using Type 1, and Do display it in the game window Variable - Set Paused = false Unit Group - Pick each unit in (Any units in (Entire map) owned by player Any Player matching (No Value), with at most Any Amount) and do (Actions) Actions Actor - Send actor message "AnimSetPausedAll 0" to all actors contained by game region (Entire map)
Currently all the animations stop, but the game continues to play normally, and also I can't "unpause" it (each press of Space shows the "pause" message and nothing changes). Sorry this is the first time I mess with "real" triggers :)
@Sevenspeed: Go
First of all, it'd be nice if you put your triggers into code tags:
(instead of "<" or ">" you gotta write "<<" or ">>")
Now, regarding your problem: The Paused variable is a global boolean variable. You're declaring it locally there. If it's local then it won't carry-over to the next time you press the space bar. Make it a global variable and it will.
The code I posted will pause behaviors and effects, but there is a bug in it - it'll cause any missile in flight to be destroyed. I'm not really sure why that is.
Also I just realized there's a Pause All Units action so the loop I made is superfluous.
Thanks for the explanation. I also just saw the Pause All Units Action (how stupid of me not to even search for something like that), and add it. Everything works good now, all animations pause and resume together with the units themselves. Lucky no units or enemies use missile, and for now no ability as missile as well :)
You sure its superfluous? I didn't test the action by itself but even with my little knowledge I think ur code doesn't have anything superfluous about it. And ill use the code tag next time sorry for the inconvenience.
Thanks for ur help guys!
I just realized when I pasted in the triggers above somehow a line got left out where I called Pause Unit on each picked unit. Sorry if that was a source of confusion. Anyway, just replace the "Pick All Units" actions with Pause/Unpause all units.
It's necessary to pause the units as well as pause the actors for the full effect.