Jump to content
eviljack109

Need help with final touches to the scrpits

Recommended Posts

This is going to be a long explanation just please stick with it. I've been trying various ways to make the mission but no matter what I do it just doesn't work.

 

Mission goal:

This is a pvp mission where in the middle of a peninsula There is 2 downed pilots without maps or NVG's Opfor only has ground vehicles to find and kill them. While Bluefor get's Heli's, NVG's, and fewer people to rescue the pilots. To help find these two pilots, both teams can see a big red circle on the map that gives their approximate location. The downed Pilots will also spawn randomly so nobody can know where the pilots will be. Ace3 BFT will also be on, but I turned this off specifically for the pilots.

 

Problems:

So I almost everything working in the mission, except for the part where the downed pilots spawn at one of the selected sites. IDK why but the setPos command will just not work. I have everything in the init.sqf, take a look...

 

[] spawn {
  while {not isnull obj1} do { 
  _unitPos = getpos obj1;
  _home = getPos home;
  _unitPos setPos [getPos _home select 0];
  _xRand = [50,35,80,120] call BIS_fnc_selectRandom;
  _yRand =[50,35,80,120] call BIS_fnc_selectRandom; 
  _offSet = [(_unitPos select 0) + _xRand , (_unitPos select 1) + _yRand, 0];
  "mrk_obj1" setmarkerpos _offSet; sleep 300; }; // the "sleep 300" is to tell the script how many seconds the script needs to wait before updating the position of the marker.
};

[] spawn {
  while {not isnull obj2} do { 
  _unitPos = getpos obj2; 
  _xRand = [50,35,80,120] call BIS_fnc_selectRandom;
  _yRand =[50,35,80,120] call BIS_fnc_selectRandom; 
  _offSet = [(_unitPos select 0) + _xRand , (_unitPos select 1) + _yRand, 0];
  "mrk_obj2" setmarkerpos _offSet; sleep 300; };
};

Key:

obj1, obj2 = These are the downed pilots

home = This is the object that I have move randomly at the start of the mission. The pilots are supposed to move to this object after they spawn as well.

mrk_obj1, mrk_obj2 = These are the markers that follow the pilots around helping to give everybody else the approx location.

 

Both sections of the code are what set the markers in place to help find the pilots. That's working and I don't need help on that. What I do need help on is I was wondering if in both of these sections I could set the position of the units to home. But no matter what i get an error that says I am missing a ; or something else and idk what to do. I've tried moving the setPos command to each unit's init, and the home's init but that still doesn't work.

I also don't know how to properly turn off BTF on the downed pilots, but I am currently on the ACE team's slack chat for that. So if you don't know the answer to that, that's fine.

 

Thanks for you time

Share this post


Link to post
Share on other sites
25 minutes ago, eviljack109 said:

IDK why but the setPos command will just not work.

 

  _unitPos = [x,y,z]
  _home = [x,y,z]
  [x,y,z] setPos [getPos [x,y,z] select 0];
 
  _unitpos is an array you cant set position on arrays, object only
  (getPos [x,y,z])  _home is an array you cant get position on arrays, object only

Share this post


Link to post
Share on other sites
2 minutes ago, davidoss said:

 

  _unitPos = [x,y,z]
  _home = [x,y,z]
  _unitPos setPos [getPos _home select 0];
 
  _unitpos is an array you cant set position on arrays, object only
  (getPos _home)  _home is an array you cant set position on arrays, object only

 

Okay, then how would I link it to an object that is supposed to spawn randomly through the map?

Share this post


Link to post
Share on other sites

Oh! I thought you meant to set _home to a set position. the...

 

10 minutes ago, davidoss said:

  _home = [x,y,z]

  Had me confused.

Share this post


Link to post
Share on other sites

Sorry your code besides markers handle  has low senese for me.

You want to set  obj1 and obj2 to the home object position?

Share this post


Link to post
Share on other sites

Lol sorry, still new to scripting. 

But yeah, I have the object set to spawn randomly with some markers on the map. Then once it's where it starts I want to have the two units move to said object.

Share this post


Link to post
Share on other sites
[] spawn {
  while {!isnull obj1} do { 
  
  _home = getPos home;
  obj1 setPos _home;
  _unitPos = getpos obj1;
  _xRand = selectRandom [50,35,80,120];
  _yRand = selectRandom [50,35,80,120]; 
  _offSet = [(_unitPos select 0) + _xRand , (_unitPos select 1) + _yRand, 0];
  "mrk_obj1" setmarkerpos _offSet; 
  sleep 300; 
  };
};

[] spawn {
  while {!isnull obj2} do { 
 
  _home = getPos home;
  obj2 setPos _home;
  _unitPos = getpos obj2;
  _xRand = selectRandom [50,35,80,120];
  _yRand = selectRandom [50,35,80,120]; 
  _offSet = [(_unitPos select 0) + _xRand , (_unitPos select 1) + _yRand, 0];
  "mrk_obj2" setmarkerpos _offSet;
  sleep 300; 
  };
};

 

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

×