Jump to content
Sign in to follow this  
jedders

Problem with a mission select script

Recommended Posts

I have an issue with my mission select script. It consists of an object which has addAction for a mission to go on. However, I cannot seem to get it to work. I can figure out how to change a variable using the addAction (if this is even possible) and then check it with the if statement. Also I noticed an issue that it would instantly go into the if statement and not allow the user to input so I used the sleep function but I'm not sure if there is a way to script to wait until the user has used the input addAction to either accept or decline the mission. The script running is named fmp.sqf as well.

Here is the code:

_target = _this select 0; // Mission select object with addAction
_caller = _this select 1; // Person using the mission select addAction
_accept = "Accept Find Missing Person mission";
_decline = "Decline Find Missing Person mission";

// Remove all missions from mission selector. 
_target removeAction 0;
_target removeAction 1;
_target removeAction 2;

// Chat to tell user to confirm choice of mission.
MissionSelector globalChat "Please confirm your choice of mission.";

// Add options to accept or decline mission.
_missionaccepted = _target addAction [_accept, "fmp.sqf",1];
_missionaccepted = _target addAction [_decline, "fmp.sqf",0];

// Wait 5 seconds
sleep 5;

// Check to see what to do for mission selector
if (missionaccept == 1) then {
hint "Mission accepted!";
} else {
hint "Mission declined!";
};

Share this post


Link to post
Share on other sites

Why not end this script at // Wait 5 seconds and then have two files fmp1.sqf and fmp2.sqf

fmp1.sqf

hint "Mission accepted!";

fmp2.sqf

hint "Mission declined!";

or you could set a variable in each file missionaccept=1 or missionaccept=0 instead.

Edited by F2k Sel

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
Sign in to follow this  

×