Jump to content
Sign in to follow this  
hogmason

create simple task not showing

Recommended Posts

ok so i have this script to create some markers and create a task and call for enemy spawning scripts

if isserver then 
{

   //Make sure Functions Module is loaded
   waituntil {!isnil "bis_fnc_init"};

//create task Marker
_taskMARKERposition = ["center_positon", false, ["safezone"]] call SHK_pos;
_createTASKmarker = createmarker ["taskarea", _taskMARKERposition];
_createTASKmarker setMarkerType "mil_objective";
_createTASKmarker setMarkerColor "ColorRed";
sleep 0.5;

//setup Enemy Airborn Units Patrol Marker
_createREINFORCEMENTSmarker1 = createmarker ["E_Patrol",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker1 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker1 setmarkersize [400,400];
   _createREINFORCEMENTSmarker1 setMarkerAlpha 0;

   //setup Enemy Airborn Reinforcements Marker
_createREINFORCEMENTSmarker2 = createmarker ["REIN",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker2 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker2 setmarkersize [600,600];
   //_createREINFORCEMENTSmarker2 setMarkerAlpha 0;

//setup Enemy Task Area Chopper Patrol Marker
_createREINFORCEMENTSmarker3 = createmarker ["Task_Choppers",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker3 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker3 setmarkersize [1500,1500];
   _createREINFORCEMENTSmarker3 setMarkerAlpha 0;
sleep 0.3;

//create the task for players
HOGtask = player createsimpleTask ["Destroy Enemy Supplies"];
   HOGtask setsimpletaskdescription ["Search and destroy  Enemy Units and Enemy H.Q and Supply Dump within the task area.","Destroy Enemy Supplies",""];
HOGtask setTaskState "Assigned";
   player setcurrenttask HOGtask;
taskhint ["New Task Created\nCheck Map For Location", [0.600000,0.839215,0.466666,1], "taskCurrent"];

//Create Task Targets
  [] spawn Task_Targets;
sleep 0.5;		
//Setup Enemy Units
  [] spawn Task_Enemy;
sleep 0.5;	
//setup Enemy Static Units
  [] spawn Task_Static;
sleep 0.5;	
//setup Enemy Chopper Patrol
   [] spawn Task_choppers;
sleep 0.5;
//Setup Enemy Airborne Reinforcements
  [] spawn Task_reinforce_Start;
  sleep 10;
  //Setup EAST units Checker
  [] spawn Task_East_chkr;
	sleep 0.5;  
  //setup End Of Task
  waitUntil{(Target1_active ==0) && (Target2_active ==0) && (Enemy_Dead ==1)}; 
  taskhint ["Task Accomplished\nGood Job", [0.600000,0.839215,0.466666,1], "taskDone"];
  HOGtask setTaskState "Succeeded";   
  sleep 0.5;  
 //Setup Task Cleaning
  [] spawn Task_Cleaner;  

};


now this works great on the editors testing BUT on a dedi everything gets created and all enemy are spawned at the task site " which all get luanched of the above code BUT i dont get the task coming up so no text hint saying new task and no task selection on map. just nothing

this is the create simple task part


//create the task for players
HOGtask = player createsimpleTask ["Destroy Enemy Supplies"];
   HOGtask setsimpletaskdescription ["Search and destroy  Enemy Units and Enemy H.Q and Supply Dump within the task area.","Destroy Enemy Supplies",""];
HOGtask setTaskState "Assigned";
   player setcurrenttask HOGtask;
taskhint ["New Task Created\nCheck Map For Location", [0.600000,0.839215,0.466666,1], "taskCurrent"];

Share this post


Link to post
Share on other sites

You have it wrapped in an isServer so the players would never seen it. Move it outside the isServer and make sure it's running on everyone to add that task.

Share this post


Link to post
Share on other sites

cheers mate but still not showing

i done

createtask.sqf

waituntil {!isnil "bis_fnc_init"};

if isserver then 
{

//create task Marker
_taskMARKERposition = ["center_positon", false, ["safezone"]] call SHK_pos;
_createTASKmarker = createmarker ["taskarea", _taskMARKERposition];
_createTASKmarker setMarkerType "mil_objective";
_createTASKmarker setMarkerColor "ColorRed";
sleep 0.5;

//setup Enemy Airborn Units Patrol Marker
_createREINFORCEMENTSmarker1 = createmarker ["E_Patrol",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker1 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker1 setmarkersize [400,400];
   _createREINFORCEMENTSmarker1 setMarkerAlpha 0;

   //setup Enemy Airborn Reinforcements Marker
_createREINFORCEMENTSmarker2 = createmarker ["REIN",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker2 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker2 setmarkersize [600,600];
   //_createREINFORCEMENTSmarker2 setMarkerAlpha 0;

//setup Enemy Task Area Chopper Patrol Marker
_createREINFORCEMENTSmarker3 = createmarker ["Task_Choppers",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker3 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker3 setmarkersize [1500,1500];
   _createREINFORCEMENTSmarker3 setMarkerAlpha 0;
sleep 0.5;

[color="#FF0000"]  //Calls Task info
  [] spawn addtasks;[/color]
sleep 0.5;	
//Create Task Targets
  [] spawn Task_Targets;
sleep 0.5;		
//Setup Enemy Units
  [] spawn Task_Enemy;
sleep 0.5;	
//setup Enemy Static Units
  [] spawn Task_Static;
sleep 0.5;	
//setup Enemy Chopper Patrol
   [] spawn Task_choppers;
sleep 0.5;
//Setup Enemy Airborne Reinforcements
  [] spawn Task_reinforce_Start;
  sleep 10;
  //Setup EAST units Checker
  [] spawn Task_East_chkr;
	sleep 0.5;  
  //setup End Of Task
[color="#FF0000"]   waitUntil{(Target1_active ==0) && (Target2_active ==0) && (Enemy_Dead ==1)}; 
  sleep 0.5;
  [] spawn endtasks;[/color]
  sleep 0.5;  
 //Setup Task Cleaning
  [] spawn Task_Cleaner;  

};


[] spawn addtasks; is


waituntil {!isnil "BIS_fnc_init"};

//create the task for players
HOGtask = player createsimpleTask ["Destroy Enemy Supplies"];
   HOGtask setsimpletaskdescription ["Search and destroy  Enemy Units and Enemy H.Q and Supply Dump within the task area.","Destroy Enemy Supplies",""];
HOGtask setTaskState "Assigned";
   player setcurrenttask HOGtask;
taskhint ["New Task Created\nCheck Map For Location", [0.600000,0.839215,0.466666,1], "taskCurrent"];

and

[] spawn endtasks; is

waituntil {!isnil "BIS_fnc_init"};

  taskhint ["Task Accomplished\nGood Job", [0.600000,0.839215,0.466666,1], "taskDone"];
  HOGtask setTaskState "Succeeded";  

both endtasks and addtasks are precompiled using

task_Preloader.sqf ======= this is loaded from my main init.sqf using = execVM "missions\task_Preloader.sqf";

if isserver then
{

[color="#FF0000"]         addtasks = compile (preprocessFileLineNumbers "missions\Addtasks.sqf");
        endtasks = compile (preprocessFileLineNumbers "missions\endtasks.sqf");[/color]		 
        Task_Loader = compile (preprocessFileLineNumbers "missions\Task_Loader.sqf");
        Task_Creator = compile (preprocessFileLineNumbers "missions\Task_creator.sqf");
        Task_Targets = compile (preprocessFileLineNumbers "missions\spawners\Targets\task_targets.sqf");
        Task_Enemy = compile (preprocessFileLineNumbers "missions\spawners\Task_Enemy\task_enemy.sqf");
	 Task_Static = compile (preprocessFileLineNumbers "missions\spawners\Task_Enemy\task_statics.sqf");
	 Task_choppers = compile (preprocessFileLineNumbers "missions\spawners\Task_Enemy\task_chopper.sqf");
        Task_reinforce_Start = compile (preprocessFileLineNumbers "missions\spawners\Task_Enemy\task_reinforce.sqf");
	 Task_Reinforce_Spawn = compile (preprocessFileLineNumbers "missions\spawners\Task_Enemy\Task_Reinforcements.sqf");
	 Task_East_chkr = compile (preprocessFileLineNumbers "missions\East_Checker.sqf");
	 Task_Cleaner = compile (preprocessFileLineNumbers "missions\cleaner\endtask.sqf");

};

Share this post


Link to post
Share on other sites

so maybe this

//Make sure Functions Module is loaded
waituntil {!isnil "bis_fnc_init"};

[color="#0000FF"]if isserver then 
{[/color]

//create task Marker
_taskMARKERposition = ["center_positon", false, ["safezone"]] call SHK_pos;
_createTASKmarker = createmarker ["taskarea", _taskMARKERposition];
_createTASKmarker setMarkerType "mil_objective";
_createTASKmarker setMarkerColor "ColorRed";
sleep 0.5;

//setup Enemy Airborn Units Patrol Marker
_createREINFORCEMENTSmarker1 = createmarker ["E_Patrol",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker1 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker1 setmarkersize [400,400];
   _createREINFORCEMENTSmarker1 setMarkerAlpha 0;

   //setup Enemy Airborn Reinforcements Marker
_createREINFORCEMENTSmarker2 = createmarker ["REIN",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker2 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker2 setmarkersize [600,600];
   //_createREINFORCEMENTSmarker2 setMarkerAlpha 0;

//setup Enemy Task Area Chopper Patrol Marker
_createREINFORCEMENTSmarker3 = createmarker ["Task_Choppers",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker3 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker3 setmarkersize [1500,1500];
   _createREINFORCEMENTSmarker3 setMarkerAlpha 0;
sleep 0.5;

[color="#0000FF"]};[/color]	

[color="#FF0000"]  //Calls Task info
//create the task for players
HOGtask = player createsimpleTask ["Destroy Enemy Supplies"];
   HOGtask setsimpletaskdescription ["Search and destroy  Enemy Units and Enemy H.Q and Supply Dump within the task area.","Destroy Enemy Supplies",""];
HOGtask setTaskState "Assigned";
   player setcurrenttask HOGtask;
taskhint ["New Task Created\nCheck Map For Location", [0.600000,0.839215,0.466666,1], "taskCurrent"];[/color]

[color="#0000FF"]if isserver then 
{[/color]	
//Create Task Targets
  [] spawn Task_Targets;
sleep 0.5;		
//Setup Enemy Units
  [] spawn Task_Enemy;
sleep 0.5;	
//setup Enemy Static Units
  [] spawn Task_Static;
sleep 0.5;	
//setup Enemy Chopper Patrol
   [] spawn Task_choppers;
sleep 0.5;
//Setup Enemy Airborne Reinforcements
  [] spawn Task_reinforce_Start;
  sleep 10;
  //Setup EAST units Checker
  [] spawn Task_East_chkr;
	sleep 0.5;  
  //setup End Of Task
  waitUntil{(Target1_active ==0) && (Target2_active ==0) && (Enemy_Dead ==1)}; 
  sleep 0.5;

[color="#0000FF"]}; [/color]
[color="#FF0000"]   taskhint ["Task Accomplished\nGood Job", [0.600000,0.839215,0.466666,1], "taskDone"];
  HOGtask setTaskState "Succeeded";   [/color] 

[color="#0000FF"]if isserver then 
{  [/color] 

 //Setup Task Cleaning
  [] spawn Task_Cleaner;  

[color="#0000FF"]};  [/color] 


---------- Post added at 10:49 ---------- Previous post was at 10:41 ----------

nope that diddnt work ;(

Share this post


Link to post
Share on other sites

Looks better. Beware though, in your first post, the red bits were accomplished via functions. If you decide to get back at that:

your task-preloader.sqf is executed on server only, meaning clients won't know what addtasks and endtasks are (not preprocessed). In which case you'd have to get those out of the isServer too.

Share this post


Link to post
Share on other sites

yeah i took the addtask and endtask preprocessed parts out and just put it all back on the main script but that still dont work

Share this post


Link to post
Share on other sites

Seeing that you seem to like having everything executed server-side only, let's see how you call createtask.sqf.

Other than that, could be a typo, but i don't see any. Then again, it might be another error that i can't/won't see.

Share this post


Link to post
Share on other sites

this starts the tasks

if (isServer) then {

for "_x" from 1 to 50 do {[] call Task_Creator;};

};

thanks _MaSSive

that was a mistake in a few of my sqf's ;)

Share this post


Link to post
Share on other sites

got it working ------ YEP all that addiction to running everything by if (isServer) got me in a pickle

so i had to remove all that if (isServer) and only wrap it around the spawning stuff.

cheers for the help guys really appreciate it and learnt alot about if (isServer).

;)

Share this post


Link to post
Share on other sites

Yup, locality is really THE thing you have to understand well when coding for multiplayer.

Everytime you use a command, check the wiki as the locality of this command is usually indicated there, and adjust your code accordingly. I take tou got my terse response in your parameters thread then.

skipTime might or might not broadcast to all clients, so execute it on all clients, i.e. outside any if (isServer).

Share this post


Link to post
Share on other sites

Ok so i got the tasks working and showing on the dedi BUT now everytime a player joins he gets a task and then the task markers are moved to a new spot

so its like the server gives the JIP player a new task.

this is what the code now looks like

p.s i untagged the markers code at top from isServer tags due to JIP players not seing any markers at all

//Make sure Functions Module is loaded
waituntil {!isnil "bis_fnc_init"};


//create task Marker
_taskMARKERposition = ["center_positon", false, ["safezone"]] call SHK_pos;
_createTASKmarker = createmarker ["taskarea", _taskMARKERposition];
_createTASKmarker setMarkerType "mil_objective";
_createTASKmarker setMarkerColor "ColorRed";
sleep 0.5;

//setup Enemy Airborn Units Patrol Marker
_createREINFORCEMENTSmarker1 = createmarker ["E_Patrol",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker1 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker1 setmarkersize [400,400];
   _createREINFORCEMENTSmarker1 setMarkerAlpha 0;

   //setup Enemy Airborn Reinforcements Marker
_createREINFORCEMENTSmarker2 = createmarker ["REIN",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker2 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker2 setmarkersize [600,600];
   //_createREINFORCEMENTSmarker2 setMarkerAlpha 0;

//setup Enemy Task Area Chopper Patrol Marker
_createREINFORCEMENTSmarker3 = createmarker ["Task_Choppers",getMarkerPos "taskarea"];
   _createREINFORCEMENTSmarker3 setmarkershape "ELLIPSE";
   _createREINFORCEMENTSmarker3 setmarkersize [1500,1500];
   _createREINFORCEMENTSmarker3 setMarkerAlpha 0;
sleep 0.5;

if (isServer) then 
{

//Create Task Targets
  [] spawn Task_Targets;
sleep 0.5;		
//Setup Enemy Units
  [] spawn Task_Enemy;
sleep 0.5;	
//setup Enemy Static Units
  [] spawn Task_Static;
sleep 0.5;	
//setup Enemy Chopper Patrol
   [] spawn Task_choppers;
sleep 0.5;
//Setup Enemy Airborne Reinforcements
  [] spawn Task_reinforce_Start;
  sleep 10;
  //Setup EAST units Checker
  [] spawn Task_East_chkr;
	sleep 0.5;  
  //setup End Of Task

}; 

//create the task for players
HOGtask = player createsimpleTask ["Destroy Enemy Supplies"];
   HOGtask setsimpletaskdescription ["Search and destroy  Enemy Units and Enemy H.Q and Supply Dump within the task area.","Destroy Enemy Supplies",""];
HOGtask setTaskState "Assigned";
   player setcurrenttask HOGtask;
taskhint ["New Task Created\nCheck Map For Location", [0.600000,0.839215,0.466666,1], "taskCurrent"];

  waitUntil{(Target1_active ==0) && (Target2_active ==0) && (Enemy_Dead ==1)}; 
  sleep 0.5;

  taskhint ["Task Accomplished\nGood Job", [0.600000,0.839215,0.466666,1], "taskDone"];
  HOGtask setTaskState "Succeeded";  
  sleep 0.5;

  [] spawn Task_Cleaner;    


Share this post


Link to post
Share on other sites

JIP? Oh boy. Honestly you're getting into a shitload of trouble.

Not an expert, but here's my take on this: you want to set up a JIP-able mission, you better think about it first and take it into account when developing every single aspect of the mission.

About those markers, though: if you really want them to be created on each client, have a look at this.

I'm afraid i won't be able to help you much any further. Never tinkered much with JIP myself, and i use a mission template for the mission that need it.

Edit: just a quick thought. Public variables are synchronized with JIPs. So one trick could be to set a public variable to make sure the tasks are already set up, and prevent the server from doing it again on JIP connection.

Something along the line of :

if (isServer && !(Target1_active ==0) && !(Target2_active ==0) && !(Enemy_Dead ==1)) then 
{

//Create Task Targets
  [] spawn Task_Targets;
sleep 0.5;		
//Setup Enemy Units
  [] spawn Task_Enemy;
sleep 0.5;	
//setup Enemy Static Units
  [] spawn Task_Static;
sleep 0.5;	
//setup Enemy Chopper Patrol
   [] spawn Task_choppers;
sleep 0.5;
//Setup Enemy Airborne Reinforcements
  [] spawn Task_reinforce_Start;
  sleep 10;
  //Setup EAST units Checker
  [] spawn Task_East_chkr;
	sleep 0.5;  
  //setup End Of Task

};

Now this is more of a general idea, doesn't work as is.

Edited by BlackMamb

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  

×