Jump to content
lexx

Replay mission check

Recommended Posts

Sup folks,

 

the thread title might be a bit strange, but I actually don't really know how to sum it up in short...

 

Anyway, my question is: Can we check if a player is playing a (campaign) mission "for the first time" and isn't using the replay option? Background is, I am saving certain mission states in global variables, which works fine- but if the player would replay one of the earlier missions, the variables obviously would be saved again, therefore affecting and potentially breaking stuff in later missions. Right now I have no idea how I could circumvent it other than "if var = nil then..." which is shitty, as the player might as well finished the mission already once and now reverted back... and isn't just replaying it.

 

Anyone got any clues?

Share this post


Link to post
Share on other sites

You could save certain "flag" type variables to the profileNamespace of the player, and just check to see if certain flags are true/false before overwriting any data.

Share this post


Link to post
Share on other sites

I don't see how this could help. Thing is, I want to set the variables again if the player is restarting a mission-- but not if he just replays it. With going a pure variable-way I see no solution there.

Share this post


Link to post
Share on other sites

Here is some simply straightforward code as to what I'm thinking, but maybe I'm just not understanding completely what you mean:

fnc_getMissionVariables =
{
	_vars = [];
	_profileVars = ["checkpoint","rallypoint","assualt","lastStand"];
	{
		_vars pushBack (profileNamespace getVariable [_x,false]);
	} forEach _profileVars;
	_vars;
};


if (profileNamespace getVariable [firstMissionHasBeenPlayed,false]) then
{
	_vars = [] call fnc_getMissionVariables;
	[_vars] call fnc_startMission;
}
else
{
	[] call fnc_startNewMission;
};

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×