Modding, Mission Design, and Coding > The FRED Workshop

Detect Mission Replay?

(1/2) > >>

wookieejedi:
Is there a way to detect if a mission is being replayed in a campaign? There may not be, as I have not seen anything that would be useful in the scripts or sexps output html files. Just wanted to double check. Thanks!

karajorma:
This is what the stuff I just coded on eternal variables is for (in fact, I literally used exactly that example when discussing it). You'd simply add a persistent variable called something like Your-Campaign-Name-Replay and set it to 1 at the end of the mission. If the player progresses past that mission the variable would be saved to the player file and next time it's played you simply check if the variable is set to 1.

There are ways to do something similar with scripting (simply create a file if the campaign has been played before) and the reason for eternal variables is because there currently is a bug in the player-persistent variables that makes them act like they are eternal (so if you need to test things, you can totally abuse the bug until it gets fixed). You can read more about it on this thread

wookieejedi:

--- Quote from: karajorma on March 08, 2018, 10:23:04 am ---This is what the stuff I just coded on eternal variables is for (in fact, I literally used exactly that example when discussing it). You'd simply add a persistent variable called something like Your-Campaign-Name-Replay and set it to 1 at the end of the mission. If the player progresses past that mission the variable would be saved to the player file and next time it's played you simply check if the variable is set to 1.

There are ways to do something similar with scripting (simply create a file if the campaign has been played before) and the reason for eternal variables is because there currently is a bug in the player-persistent variables that makes them act like they are eternal (so if you need to test things, you can totally abuse the bug until it gets fixed). You can read more about it on this thread

--- End quote ---

Ah gotcha. I have been following your progress on that front closely, as I am very excited to play around with the variable modifications. Ah I see how this valuable fix applies to replaying a campaign. Is there also a way to use it to detect if, at the end of a mission, the player hits the 'replay' mission button?

AdmiralRalwood:

--- Quote from: wookieejedi on March 08, 2018, 10:27:09 am ---Is there also a way to use it to detect if, at the end of a mission, the player hits the 'replay' mission button?

--- End quote ---
Eh... sort of, it would just be indistinguishable from quitting, not accepting the mission outcome, and playing it again later.

karajorma:
If you do this

Player Jumps Out
when
- key-pressed
-- Alt J
- do-nothing

when
- is-event-true-delay
-- Player Jumps Out
-- 3
- modify-variable
-- Player-Maybe-Replaying[0]
-- 1

You pretty much make it certain that the player is replaying from debrief rather than just quitting in the middle of the mission.

Navigation

[0] Message Index

[#] Next page

Go to full version