Jump to content
revv

Problems with my mission, help requested!

Recommended Posts

I have a random mission picker which picks a mission then spawns an ammobox at a random marker position. The task on all missions currently are all the same which is just to destroy the ammobox. This is all working as intended and I have a marker & task destination waypoint that are created on the ammobox BUT I need the marker and waypoint to be "near" the ammobox and not exactly on it. I have looked it up but can't figure out how to do this, also my tasks have an issue with JIP instead of syncing to current it issues new mission.
Here is my mission layout if it helps.
Some of you have already seen this code and I'm sorry if it's boring you ;) from now on any issues relating to my mission I will post here so I dont clog the forums with lots of threads.

init.sqf

//  Tasks
fnc_miss_array = []; 
fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_1.sqf");
fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_2.sqf");
fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_3.sqf");
fnc_miss_array pushBack (compileFinal preprocessFileLineNumbers "scripts\mission_4.sqf");

//  Check current task for JIP
execVM "scripts\iniTask.sqf"; 

as you can see the in the init.sqf the 4 mission files are ready, all 4 are the same with different text so I know which one is actually running during testing

mission_1.sqf

"scripts\cache_A.sqf" remoteExec ["execVM",2];

//  Set mission status for JIP
missionStatus= 11;
//  Code that actually sends this out to other players.
publicVariable "missionStatus";


task_1 = player createSimpleTask ["Mission 1"]; 
task_1 setSimpleTaskDescription ["Locate & destroy the weapon cache","Find Cache","Search"]; 
task_1 setTaskState "ASSIGNED"; 
["TaskAssigned"] call BIS_fnc_showNotification;
player setCurrentTask task_1; 

so the init.sqf has the 4 mission files set into an array, and are ready to be picked

At mission start (or player joining) the init.sqf runs the iniTask.sqf which does some checks for what the current task is (if any) then sets the player on to either the current task or something else.
iniTask.sqf

if (isNil "missionStatus") 
	then 
		{
		execVM "scripts\prologueTask.sqf";
		} 
	else 
		{
		execVM "scripts\JIPhandle.sqf";
		hint "Welcome, Recieving Operation Data. Standby.";
		};

When a mission is selected the code on the first line of the mission_1.sqf  runs a file called

cache_A.sqf

ammocrate1 = [];
if (isServer) then 
{
//  Create weapon cache at random marker
ammocrate1 = createVehicle ["B_supplyCrate_F",getMarkerPos "mrk_1",["mrk_2","mrk_3"], 50, "NONE"];

//  Create marker at the location
_marker1 = createMarker ["cache_A", getMarkerPos "mrk"];
_marker1 setMarkerType "hd_destroy";
_marker1 setMarkerColor "ColorRed";
_marker1 setMarkerText "Find Cache";


[] spawn 
	{
		while	{
				not isnull ammocrate1
				} 
			do 
				{
				"cache_A" setMarkerPos getPos ammocrate1; sleep 0.5;
				};
};
};

"scripts\taskDest.sqf" remoteExec ["execVM",-2]; 

As you will see at the very end it runs

taskDest.sqf
 

if (!isNull currentTask player) 
	then	{
			task_1 setSimpleTaskDestination (getMarkerPos "cache_A");
			};
sleep 5;

(Now that I've had some sleep I am wondering if that exclamation needs to be where it is now or moved to before the bracket?)
Anyway that is supposed to update the JIP with the current task destination, but a different problem I'm having is a JIP will actually get a new task and not the one currently running.
For anyone interested here is my
JIPhandle.sqf
 

hint "Recieving Operation Files....";
sleep 3.0;

switch (missionStatus) do
{
case 10:
{
execVM "scripts\prologueTask.sqf"
};

case 11: {
execVM "scripts\mission_1.sqf"
};

case 12: {
execVM "scripts\mission_2.sqf"
};

case 13: {
execVM "scripts\mission_3.sqf"
};

case 14: {
execVM "scripts\mission_4.sqf"
};
default
{
hint "Something went horribly wrong. Please rejoin the server!";
};
};

prologueTask.sqf
 

missionStatus= 10;
publicVariable "missionStatus";

//creating the "prologue" mission tasks
player createDiaryRecord ["Diary", ["Welcome", "Welcome to Soldiers Of Fortune! <br /><img image='btalogo.paa' /> <br>Don't forget to equip earplugs before executing an operation, safety first people! <br>"]];

M1 = player createSimpleTask ["Prologue"];
M1 setSimpleTaskDescription ["This is the initial mission for players who didn.t JIP.","Mission 1","Map Text Mission 1"];
M1 setSimpleTaskDestination (getPos trig_1);
M1 setTaskState "Assigned";
player setCurrentTask M1;

The last issue I'm having is an error with my loadout script, I'll post that if someone knows about loadout scripts.

Share this post


Link to post
Share on other sites

I forgot to mention there is a trigger on map with radius set to 0 with this in its fields
condition:

!alive ammocrate1

ON ACT:

hint "Operation Successful!";  
task_1 setTaskState "Succeeded";  
player removeSimpleTask task_1;  
0 = [] execVM "scripts\initMissions.sqf";

This essentially removes the task that was completed and then runs the random picker again

Share this post


Link to post
Share on other sites

I would change your cach_A.sqf to a function and have it return the crate it creates (ammocrate1) to mission_1.sqf, then get the returned crates' position for the setsimpleTaskDestination.

 

Is this multiplayer, and will there only be one side?

Share this post


Link to post
Share on other sites

I would change your cach_A.sqf to a function and have it return the crate it creates (ammocrate1) to mission_1.sqf, then get the returned crates' position for the setsimpleTaskDestination.

 

Is this multiplayer, and will there only be one side?

First thanks for the response :)

Yes it is to be run on a server, I have no idea how to make an sqf into a function ...still learning lol.

Do you know of any good tutorials on how to do something like that?

Jus to clarify I have everything working fine right now except for the marker and waypoint (task destination) are both being placed RIGHT on the ammobox1

EDIT: actually the marker is being placed exactly on the ammobox1 and the task destination is set to the marker.

2nd EDIT: also yes it's only one side BLUFOR, it's going to be a large-ish coop mission (sorta like patrol ops)

Share this post


Link to post
Share on other sites

take a look at ur first code block of ur first post. there u r creating an array of functions. look for all commands in that block at the wiki and learn what they do.

if u want to do a patrol ops like mission than u have to learn such stuff and much more.

u cant ask every little step of ur mission creation without learning about the things we told u.

Share this post


Link to post
Share on other sites

Instead creating and deleting a marker you can change the size of a marker. If you make it small it is impossible to see.

Share this post


Link to post
Share on other sites

Instead creating and deleting a marker you can change the size of a marker. If you make it small it is impossible to see.

Or set the alpha (transparency) of it.

Share this post


Link to post
Share on other sites

First, thanks for all the responses

take a look at ur first code block of ur first post. there u r creating an array of functions. look for all commands in that block at the wiki and learn what they do.

if u want to do a patrol ops like mission than u have to learn such stuff and much more.

u cant ask every little step of ur mission creation without learning about the things we told u.

 

I did look up that block when you first gave it to me and I sort of understand what's happening and it is working as intended.
I am absolutely trying to learn such stuff, I've only been at it for a few days now and I think I have achieved a great deal ;)
Believe me when I say I am not asking at every step of my mission creation and I always bring up the wiki for every piece of code given to me and for every piece of code I am currently working on.
There is much more going on that I haven't even shown you guys on here yet and I think I have achieved much in a very short amount of time (thanks to you guys of course!)
I've spent pretty much every waking moment for the last 4 days studying and working on this mission and as I said I always bring up the wiki for everything I'm working on, even if I think I know it well I will still bring it up for reference in case I missed or forgot something. I don't stop and wait for responses on here either I will either keep working on the part I'm stuck on or move on to another part.
I don't want you to think I'm lazy like that, I want to learn it so I can do it again and again because I love it.

 

Instead creating and deleting a marker you can change the size of a marker. If you make it small it is impossible to see.

 

 

Or set the alpha (transparency) of it.

Joe98 & jshock I have actually got the marker being created and moved fine now I just need to get it to not move to the exact position of the crate so players have to search a little.
I will change the title of the thread to reflect this :)

Share this post


Link to post
Share on other sites

First, thanks for all the responses

I did look up that block when you first gave it to me and I sort of understand what's happening and it is working as intended.

I am absolutely trying to learn such stuff, I've only been at it for a few days now and I think I have achieved a great deal ;)

Believe me when I say I am not asking at every step of my mission creation and I always bring up the wiki for every piece of code given to me and for every piece of code I am currently working on.

There is much more going on that I haven't even shown you guys on here yet and I think I have achieved much in a very short amount of time (thanks to you guys of course!)

I've spent pretty much every waking moment for the last 4 days studying and working on this mission and as I said I always bring up the wiki for everything I'm working on, even if I think I know it well I will still bring it up for reference in case I missed or forgot something. I don't stop and wait for responses on here either I will either keep working on the part I'm stuck on or move on to another part.

I don't want you to think I'm lazy like that, I want to learn it so I can do it again and again because I love it.

thats the thing i wanted to be sure about :)

as i said u know now how to create a function from a file. but u can do such things "inline" to. that is mostly used for short functions:

 

fnc_multiply =
{
params ["_a", "_b"];

(_a * _b)
};

hint format ["a x b = %1", ([2, 4] call fnc_multiply)];

this will output the hint:

a x b = 8

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

×