Jump to content
copper2010

Shoreline (Mission concept and editing questions [lots of them])

Recommended Posts

@Dan Thanks! That helped out a lot!

@Iceman Thanks for cleaning up the code!

Well, the loadouts are complete, respawnloadouts are working, sectors are working, this is moving along nicely :).

Share this post


Link to post
Share on other sites
@Dan Thanks! That helped out a lot!

@Iceman Thanks for cleaning up the code!

Well, the loadouts are complete, respawnloadouts are working, sectors are working, this is moving along nicely :).

Good to hear! If you have anything else you need to ask, feel free to shoot away on this thread.

Share this post


Link to post
Share on other sites

Ok, a few more questions.

How do I get respawns to only work for the side who controls the sector? A.K.A If BLUFOR owns sector A, they can respawn there.

I've tried to sync a trigger with the "Seized by BLUFOR" activation, but when I sync it to the sector module and the respawn point, the game freezes on the loading screen when I start up the mission.

Also, I tired to create a single vehicle creation script based off of Reaper's script...it didn't work XD

Here is the script I typed up before I gave up, it probably isn't what I originally typed up, since I know this won't work just by looking, I was probably just trying out a new combination. I simply gave up after awhile and quit without saving.

private ["_vehiclespawn"];
_vehiclespawn = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
cutText ["","BLACK", 0.3];  
sleep 1; 
player moveInDriver "B_Quadbike_01_F";
cutText ["","BLACK IN", 5];

case "quadbike": {
vehicle = "B_Quadbike_01_F";
(_vehiclespawn) do;	 

};

case "ltank": { 
_vehicle = "B_APC_Wheeled_01_cannon_F"
};  

Any suggestions/corrects?

Share this post


Link to post
Share on other sites

I think the script has some logical errors too. For example you create a quadbike at the beginning, and then in your case structure you just put the classname of the vehicles with no other coding or even telling it what to do with it. You also didn't put the switch statements into it.

I will help you rewrite it, but what exactly do you want to do with it?

Do you want it to spawn any type of vehicle (based upon a preset list) based upon whichever one was selected by the user in the addAction in a 1 script does all style?

I am not really sure about the respawns at the moment, but will have a look or play later if you haven't found a solution by then.

Share this post


Link to post
Share on other sites

@Copper2010 Try using these two scripts that I put together really quick, unfortunately I haven't gotten around to testing them yet. However I am quite concerned that there may need to be a value for "_veh" in the "selectVehicle.sqf" script below.

selectVehicleAct.sqf

// Add this to init box of object: null = [this] execVM "selectVehicleAct.sqf";  
private ["_obj"];
_obj = _this select 0;

_obj addAction ["Spawn QuadBike", "selectVehicle.sqf", "quadbike"];
_obj addAction ["Spawn APC", "selectVehicle.sqf", "ltank"];

selectVehicle.sqf

private ["_unit", "_vehType"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
case "quadbike": {
	_veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];	 

};
case "ltank": { 
	_veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn"); 
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];
};
};

Edited by JSF 82nd Reaper

Share this post


Link to post
Share on other sites

Don't worry about the _veh, that is just a local variable and only references the vehicle you are spawning whilst the script is running. The server automatically will give it a proper name.

Share this post


Link to post
Share on other sites

@Reaper, Thanks! It worked like a charm.

The next thing probably goes hand-in-hand with my respawn question, but 10 times harder. MHQs that aren't on the map to begin with. My plan is to have the tracked APC on each team act as a mobile respawn, so players can continue an assault without flying back and forth. While I could probably implement an MHQ but myself, the problem I have here is that there are no pre-existing APCs on the map, and vehicle is spawned by the player. I am pretty sure there is a way to add code to a vehicle's description when it spawns, but to add a marker (or respawn point) that will follow the APC when it is spawned is a different story.

My guess is that I would put a respawn point at the edge of the map that is disabled until an action (like "Deploy MHQ") is selected. When the respawn point/marker detects that action is select, it attaches itself to the APC with the getPos command, and when the APC is destroyed, the respawn point/marker is disabled again until a new APC spawns (my guess is to have the respawn point/marker check if the vehicle is alive, with an if statement saying that if it is not alive, the module is disabled). I do not know how to disable modules via command however, so any tips would be nice. Also, this would probably mean a one MHQ limit, but that is the only way I can think of right now.

Share this post


Link to post
Share on other sites

@Copper2010 Here's an update of the "selectVehicle.sqf" of what you are wanting, but I believe the "preProccessInit" command was disabled in ArmA 3, at least that's what the BI wiki said. Anyhow try this out, make sure you update the "setVehicleInit" command line to what you want in it.

selectVehicle.sqf:

private ["_unit", "_vehType"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
case "quadbike": {
	_veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];	 

};
case "ltank": { 
	_veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
	_veh setVehicleInit "your init field code goes here";
	processInitCommands;
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];
};
};

Share this post


Link to post
Share on other sites
@Copper2010 Here's an update of the "selectVehicle.sqf" of what you are wanting, but I believe the "preProccessInit" command was disabled in ArmA 3, at least that's what the BI wiki said. Anyhow try this out, make sure you update the "setVehicleInit" command line to what you want in it.

selectVehicle.sqf:

private ["_unit", "_vehType"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
case "quadbike": {
	_veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn"); 
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];	 

};
case "ltank": { 
	_veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
	_veh setVehicleInit "your init field code goes here";
	processInitCommands;
	cutText ["", "BLACK", 0.3];  
	sleep 1; 
	_unit moveInDriver _veh;
	_unit assignAsDriver _veh;
	cutText ["", "BLACK IN", 5];
};
};

Hate to bring bad news, but that only broke the script, nothing happens when I select an action :(

Share this post


Link to post
Share on other sites

@Copper2010 Unfortunately BI disabled the only commands "setVehicleInit" and "processInitCommands" that I know of so far that allows a script like this to set a vehicles init when it is spawned. If anyone knows of another way please let us know.

selectVehicleAct.sqf

// Add this to init box of object: null = [this] execVM "scripts\selectVehicleAct.sqf";  
private ["_obj"];
_obj = _this select 0;

_obj addAction ["Spawn QuadBike", "selectVehicle.sqf", "Quadbike"];
_obj addAction ["Spawn Marshall", "selectVehicle.sqf", "AMV-7 Marshall"];
_obj addAction ["Spawn Panther", "selectVehicle.sqf", "IFV-6c Panther"];
_obj addAction ["Spawn Slammer", "selectVehicle.sqf", "M2A1 Slammer"];

selectVehicle.sqf

private ["_unit", "_vehType", "_veh"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
   case "Quadbike": {
       _veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
   case "AMV-7 Marshall": { 
       _veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
   case "IFV-6c Panther": {
       _veh = "B_APC_Tracked_01_rcws_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];     

   };
   case "M2A1 Slammer": {
       _veh = "B_MBT_01_cannon_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
};

Edited by JSF 82nd Reaper

Share this post


Link to post
Share on other sites

This is how I have used it in the past:

[[[],"playerConnected.sqf"],"BIS_fnc_execVM",false,true] spawn BIS_fnc_MP;

[[],"playerConnected.sqf"] - this is your script you want to run JIP. the first pair of [] is any arguments you want to pass through to the script and works exactly the same as execVM normally does.

BIS_fnc_execVM - this is the particular function you want to use in JIP, I don't know them all but I haven't needed any but this.

false,true - the first false is the target, it can be named, or you can use true or false where false on makes the script run on the server and if its true it will run for everyone. The second value (true in this case), dictates whether the script should run for JIP users as well.

Be careful with using the second value as true, as it can lead to a lot of lag, so if you don't need to, don't use it. (vehicle respawn only needs to run serverside for example, so you can use false in that case).

Hope that explains it a bit better.

Share this post


Link to post
Share on other sites

@[EVO] Dan Thanks for the update, so all I would have to do is put the command under whichever vehicle case that we want to be the MHQ? If so that's a lot easier than I thought it was going to be.

Share this post


Link to post
Share on other sites

In the arguments, put the local variable reference to the unit in there, and it'll pass it through to the new script that affects it.

Share this post


Link to post
Share on other sites

@[EVO] Dan Could you give me an example? This is what I'm gathering from your statement and I'm not sure if it's correct.

selectVehicleAct.sqf

_obj addAction ["Spawn Marshall", "scripts\selectVehicle.sqf", ["AMV-7 Marshall", _this select 3]];

selectVehicle.sqf

    case "AMV-7 Marshall": { 
       _veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
	[[[],"scripts/mhqRespawn.sqf"], "BIS_fnc_execVM", false, true] spawn BIS_fnc_MP;
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };

Share this post


Link to post
Share on other sites

yes, that should work, but you haven't passed any arguments through to the script you executing in JIP. But besides that yeah your right.

So put _veh in the first pair of [] in order to pass the reference to the JIP script.

Share this post


Link to post
Share on other sites

@[EVO] Dan I tried that and then tested it but when I select the action to spawn the MHQ nothing happens anymore. I'm going to post what I have for an MHQ script (which I don't know if it works or not) and then what I have put in the other scripts. If anyone can help us out with this next major script it'll be greatly appreciated.

mhqRespawn.sqf

private ["_marker", "_veh"];
while {true} do {
if (alive _veh) then {
	_marker = createMarker ["respawn_west", position _veh];
	"respawn_west" setMarkerPos position _veh;
};
if (!alive _veh) exitWith {
	"respawn_west" setMarkerPos getMarkerPos "respawn_base";
};
sleep 0.5;
};

selectVehicleAct.sqf

// Add this to init box of object: null = [this] execVM "scripts\selectVehicleAct.sqf";  
private ["_obj"];
_obj = _this select 0;

_obj addAction ["Spawn QuadBike", "scripts\selectVehicle.sqf", "Quadbike"];
_obj addAction ["Spawn Marshall", "scripts\selectVehicle.sqf", ["AMV-7 Marshall", _this select 3]];
_obj addAction ["Spawn Panther", "scripts\selectVehicle.sqf", "IFV-6c Panther"];
_obj addAction ["Spawn Slammer", "scripts\selectVehicle.sqf", "M2A1 Slammer"];

selectVehicle.sqf

private ["_unit", "_vehType", "_veh"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
   case "Quadbike": {
       _veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
   case "AMV-7 Marshall": { 
       _veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
	[[[_veh],"scripts/mhqRespawn.sqf"], "BIS_fnc_execVM", false, true] spawn BIS_fnc_MP;
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
   case "IFV-6c Panther": {
       _veh = "B_APC_Tracked_01_rcws_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];     

   };
   case "M2A1 Slammer": {
       _veh = "B_MBT_01_cannon_F" createVehicle (getMarkerPos "vspawn");
       cutText ["", "BLACK", 0.3];  
       sleep 1; 
       _unit moveInDriver _veh;
       _unit assignAsDriver _veh;
       cutText ["", "BLACK IN", 5];
   };
};

Share this post


Link to post
Share on other sites

@Reapeer- for the Marshall you are passing an array to the script called by addaction.

It appears you are sending the vehicle type and the array itself inside the array you are sending inside the array you are sending! confused yet? <- i am surprised this isn't an infinite loop.

i might have to test putting _this select 3 inside the parameters of an addaction. I know you can use it if you are using {} code instead of a script.

Try this:

Line 3 in selectvehicle.sqf should be

_vehType = _this select 3 select 0;

Share this post


Link to post
Share on other sites

@KevsnoTrev I made the change to the "_vehType" and the vehicle is now spawning again, but the mhq script isn't working, I tested it using the {} instead of the using the brackets and it still didn't work.

Share this post


Link to post
Share on other sites

try changing the / to a \ in the scripts\mhqRespawn.sqf

can never seem to remember which way it is supposed to go. I think \ for a file name

I think I may have got you to change the wrong _vehType - well sort of, now the other vehicles won't work

Let me think a little!!

EDIT:

Ok, I think I got it. Partially. Change Line 3 to this:

if (typename _this select 3 == typename []) then {_vehType = _this select 3 select 0};
if (typename _this select 3 == typename "") then {_vehType = _this select 3};

Edited by KevsnoTrev

Share this post


Link to post
Share on other sites

@KevsnoTrev Ok, where would I put that, and do you want me to test both of those?

Share this post


Link to post
Share on other sites

@KevsnoTrev I didn't have any success in trying to get it to work, or incorporating what you mentioned above. Could you post what you have so far?

Share this post


Link to post
Share on other sites

Try these, I think you were missing the part in the respawn script that told it what _veh was.

mhqRespawn.sqf

private ["_marker", "_veh"];
_veh = _this select 0;
while {true} do {
   if (alive _veh) then {
       _marker = createMarker ["respawn_west", position _veh];
       "respawn_west" setMarkerPos position _veh;
   };
    if (!alive _veh) exitWith {
       "respawn_west" setMarkerPos getMarkerPos "respawn_base";
    };
    sleep 0.5;
};

selectVehicleAct.sqf

// Add this to init box of object: null = [this] execVM "scripts\selectVehicleAct.sqf";   private ["_obj"]; 
_obj = _this select 0; 


_obj addAction ["Spawn QuadBike", "scripts\selectVehicle.sqf", "Quadbike"]; 
_obj addAction ["Spawn Marshall", "scripts\selectVehicle.sqf", "AMV-7 Marshall"]; 
_obj addAction ["Spawn Panther", "scripts\selectVehicle.sqf", "IFV-6c Panther"]; 
_obj addAction ["Spawn Slammer", "scripts\selectVehicle.sqf", "M2A1 Slammer"]; 

selectVehicle.sqf

private ["_unit", "_vehType", "_veh"];
_unit = _this select 1;
_vehType = _this select 3;

sleep 0.001;
waitUntil {!isNull _unit};
waitUntil {alive _unit};

switch (_vehType) do {
    case "Quadbike": {
        _veh = "B_Quadbike_01_F" createVehicle (getMarkerPos "vspawn");
        cutText ["", "BLACK", 0.3];
          sleep 1;
         _unit moveInDriver _veh;
        _unit assignAsDriver _veh;
        cutText ["", "BLACK IN", 5];
    };
    case "AMV-7 Marshall": {
         _veh = "B_APC_Wheeled_01_cannon_F" createVehicle (getMarkerPos "vspawn");
        [[[_veh],"scripts\mhqRespawn.sqf"], "BIS_fnc_execVM", false, true] spawn BIS_fnc_MP;
        cutText ["", "BLACK", 0.3];
          sleep 1; 
        _unit moveInDriver _veh;
        _unit assignAsDriver _veh; 
       cutText ["", "BLACK IN", 5];
    };
    case "IFV-6c Panther": {
        _veh = "B_APC_Tracked_01_rcws_F" createVehicle (getMarkerPos "vspawn");
        cutText ["", "BLACK", 0.3];
        sleep 1;
        _unit moveInDriver _veh; 
        _unit assignAsDriver _veh;
        cutText ["", "BLACK IN", 5];     
   };
    case "M2A1 Slammer": {
        _veh = "B_MBT_01_cannon_F" createVehicle (getMarkerPos "vspawn");
        cutText ["", "BLACK", 0.3];
        sleep 1; 
       _unit moveInDriver _veh; 
       _unit assignAsDriver _veh;
        cutText ["", "BLACK IN", 5];
    };
};  

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

×