Jump to content
Sign in to follow this  
iceman77

Paradrop script

Recommended Posts

I've made a paradrop script for a coop that will send a loaded helo to the players pos via waypoint once blufor is discovered by opfor and eject the cargo via an eject counter.The script is called like so via trigger: null = ["mi24_p",pad1] spawn paradrop_ice ... On a dedicated server, after the units are para out of the helo, the helo will not continue on with his wps.He just hovers there up and down. In preview through the editor it works fine and the helo will even engage me rather than continuing on with WPs (thats fine)

init.sqf

Ice_Roe = compile PreprocessFile "server\AIroe\Ice_roe.sqf";
yellow_Roe = compile PreprocessFile "server\AIroe\yellow_roe.sqf";
red_Roe = compile PreprocessFile "server\AIroe\red_roe.sqf";
copCheck = compile PreprocessFile "server\AIroe\copCheck.sqf";
paradrop_Ice = compile PreprocessFile "server\AIroe\Paradrop.sqf";
PDcounter = compile PreprocessFile "server\AIroe\PDcounter.sqf";
PDloc = compile PreprocessFile "server\AIroe\PDloc.sqf";
PDroe = compile PreprocessFile "server\AIroe\PDroe.sqf";
mhq_marker = compile PreprocessFile "server\mhq_marker.sqf";
random_camp = compile preprocessfile "common\random_camp.sqf";
heloWP = compile preprocessfile "server\AIroe\heloWP.sqf";

setterrainGrid 50;

camp1=false;
camp2=false;
camp3=false;
camp4=false;
camp5=false;
camp6=false;
camp7=false;

paradropz = false;
danger = false;
plans = false;
deployedC = false;
stowed = false;

onplayerconnected {[] execVM "jip.sqf"};

onMapSingleClick "leader xray setpos _pos";
leader Xray allowdammage false;

execVM "server\DW_init.sqf";
execVM "briefing.sqf";
execVM "server\server_init.sqf";
execVM "client\client_init.sqf";
[20,120] execVM "server\cly_deletedead.sqf";

enablesaving [false, false];
titletext ["", "black faded"];
if not isserver exitwith {};
execvm "playerinit.sqf";

paradrop.sqf

/*
File: paradrop.sqf

Author: ***1cem@n***

Description:
Cycling AI Paradrop.Spawns an empty vehicle (helo pref) and fills it up with crew and paraSquad.
       Aswell as assigning waypoints to the trans vehicle and parasquad.When the transport helo and paraSquad 
       group are dead it deletes currenttransport vehicle and creates a new transport and parasquad to become 
       inbount to the para location for another paraDrop.

Parameters:
_this select 0: helo class name
_this select 1: helo/crew/parasquad spawn location

       Called like:
       null = ["mi24_p",pad1] spawn paradrop_ice   


*/

      if (isServer) then {

//Declare the local variables private
private ["_vehClass","_spawnLocation","_transGroup","_pilot","_copilot","_co1","_ftl1","_scout1","_operatorSD1","_operator1","_Marksman1","_assaultman","_saboteurz","_wp1","_wp3","_wp4","_wp5","_wp6"];

//Setup the _local variable index
_VehClass = _this select 0;
_SpawnLocation = _this select 1;

//Create the empty trans vehicle and face it the way _spawnlocation (pad1) is facing.Setvector it to "settle" the object??
Support_veh = _vehClass createVehicle position _Spawnlocation;
Support_veh setDir getDir _spawnlocation;
Support_veh setVectorUp [0,0,0.001];

sleep 1;

//Create the pilot and gunner in the helos pilot/gunner pos
_transGroup = Creategroup EAST;
_pilot =  "RU_Soldier_Pilot" createUnit [getPos _spawnlocation, _transGroup, "this moveindriver Support_veh", 1, "Sergeant "];
_coPilot =  "RU_Soldier_Pilot" createUnit [getPos _spawnlocation, _transGroup, "this moveingunner Support_veh",1, "Corporal"];

sleep 1;

//Create the paraSquad in the helos cargo
parasquad = Creategroup EAST;
_Co1 = "RUS_Commander" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh", 1, "Sergeant "];
_FTL1 =  "RUS_Soldier_TL" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_scout1 = "RUS_Soldier3" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_operatorSD1 = "RUS_Soldier2" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_operator1 = "RUS_Soldier1" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_Marksman1 = "RUS_Soldier_Marksman" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_Assaultman1 = "RUS_Soldier_GL" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];
_Saboteurz = "RUS_Soldier_Sab" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

sleep 1;

//Create some waypoints for the support_veh and parasquad
_WP1 = _transgroup addWaypoint [position Pad2, 0]; 
_wp1 setWaypointBehaviour "aware";  
_wp1 setWaypointCombatMode "green";  
_wp1 setWaypointSpeed "FULL";  
_wp1 setWaypointStatements ["true",""]; 
_wp1 setWaypointTimeout [0, 0, 0];  
_wp1 setWaypointType "move"; 
_wp1 showWaypoint "ALWAYS";

WP2 = _transgroup addWaypoint [position leader xray, 0]; 
wp2 setWaypointBehaviour "aware";  
wp2 setWaypointCombatMode "green";  
wp2 setWaypointSpeed "FULL";  
wp2 setWaypointStatements ["true","paradropz = true,null = [] spawn PDroe,deleteWaypoint Wp2"]; 
wp2 setWaypointTimeout [0, 0, 0];  
wp2 setWaypointType "move"; 
wp2 showWaypoint "ALWAYS";

_WP3 = _transgroup addWaypoint [position Pad4, 0]; 
_wp3 setWaypointBehaviour "combat";  
_wp3 setWaypointCombatMode "RED";  
_wp3 setWaypointSpeed "FULL";  
_wp3 setWaypointStatements ["true",""]; 
_wp3 setWaypointTimeout [0, 0, 0];  
_wp3 setWaypointType "move"; 
_wp3 showWaypoint "ALWAYS";

_WP4 = _transgroup addWaypoint [position Pad5, 0]; 
_wp4 setWaypointBehaviour "combat";  
_wp4 setWaypointCombatMode "RED";  
_wp4 setWaypointSpeed "FULL";  
_wp4 setWaypointStatements ["true",""]; 
_wp4 setWaypointTimeout [0, 0, 0];  
_wp4 setWaypointType "move"; 
_wp4 showWaypoint "ALWAYS";

_WP5 = _transgroup addWaypoint [position Pad6, 0]; 
_wp5 setWaypointBehaviour "combat";  
_wp5 setWaypointCombatMode "RED";  
_wp5 setWaypointSpeed "FULL";  
_wp5 setWaypointStatements ["true",""]; 
_wp5 setWaypointTimeout [0, 0, 0];  
_wp5 setWaypointType "cycle"; 
_wp5 showWaypoint "ALWAYS";

sleep 1;

null = [] spawn PDloc;

sleep 5;

//Set the helos fly height to make a good para drop
Support_veh flyInHeight 80;

null = [] spawn PDcounter;

sleep 1;

//Waituntil the trans vehicle and parasquad are dead to create a new inc paraDrop squad/helo.
WaitUntil {sleep 0.3; {alive _x} count units parasquad == 0 && !canMove Support_veh};

sleep 20;

if (({alive _x} count units parasquad == 0) && (!canMove Support_veh)) then {deleteVehicle support_veh; deletegroup parasquad; null = ["mi24_p",pad1] spawn paradrop_ice} else {exitWith};

} else {exitWith};

PDloc.sqf

if (isServer) then {

    while {leader parasquad in support_veh} do {

             sleep 1;
              WP2 setWppos getPos leader xray;

              };

}

else


{exitWith};

PDcounter.sqf

if (isServer) then {

waitUntil {sleep 0.3; paradropz};

private ["_para","_v","_Gcount"];

_para = units parasquad;
_v = 0;
_Gcount = count _para;

while {_Gcount > _v} do { 

(_para select _v) action ["EJECT", Support_veh]; 
unAssignVehicle (_para select _v); 
_v=_v+1;

 sleep 0.7;      

               };

paradropz = false;

};

PDroe.sqf

///////////////////////////////////
//                               //
//                               //
//        PARASQUAD ROE          //
//                               //
//                               //
///////////////////////////////////

/*
File: PDroe.sqf

Author: ***1cem@n***

Description:
        sets the ROE of the parasquad based on distance from the enemy player leader (S1)


Parameters:
 none

       Called from:
        paraDrop.sqf - _transgroup waypoint2 (wp2)
                                       ^   ^   ^
                                 null = [] spawn PDroe;


*/

if (isServer) then {

if (leader parasquad distance support_veh < 25) then {

   Parasquad setBehaviour "aware";
   Parasquad setCombatMode "yellow";
   Parasquad setSpeedMode "Full";
   Parasquad setFormation "wedge";
   //hint"initializing parasquad roe...";
              };

if (alive leader parasquad) then {

  while {leader parasquad distance leader xray > 10} do {

                  {_x doMove getPos leader xray} foreach units ParaSquad;

                  sleep 2;

                  {_x reveal Player} foreach list trig2;

                            sleep 2;

        if (leader parasquad distance leader xray < 125 && leader xray distance leader parasquad > 100) then {

                            leader parasquad doTarget leader xray;
                            leader parasquad fire ["SmokeShellMuzzle", "SmokeShellMuzzle", "SmokeShell"];

                                                                               };
                                         sleep 1;  

                         if (leader parasquad distance leader xray < 100 && leader xray distance leader parasquad > 85) then {

                                                leader parasquad doTarget s1;
                                                leader parasquad fire ["HandGrenadeMuzzle", "HandGrenadeMuzzle", "HandGrenade_east"];

                                                                                             };
                                                                 sleep 1;

                                               if (leader parasquad distance leader xray < 100) then {

                                                            Parasquad setBehaviour "combat";
                                                            Parasquad setCombatMode "RED";
                                                            Parasquad setSpeedMode "full";
                                                            Parasquad setFormation "wedge";
                                                            //hint"combat roe";

                                                                          } 
                                                                          else
                                                                          {

                                                            Parasquad setBehaviour "aware";
                                                            Parasquad setCombatMode "yellow";
                                                            Parasquad setSpeedMode "normal";
                                                            Parasquad setFormation "wedge";
                                                            //hint"aware roe";               

                                                      };

                                                sleep 2;      

                };


 } 
  else
 {
  exitWith
 };

                 waitUntil {leader parasquad distance leader xray > 25};
                 null = [] spawn PDRoe

} 
else
{exitWith};

How do I get the helo to continue on with its waypoints and/or engage my team instead of hovering there?

Any help will be appreciated, iam 1 step away from a solid reworked re-release of one of my 1st mp maps.

PS, please no replys with links, telling me to use a diffrent paradrop system/scripts, unless it has a piece of code that can be integrated into mine and fix the problem

Share this post


Link to post
Share on other sites
PS, please no replys with links, telling me to use a diffrent paradrop system/scripts, unless it has a piece of code that can be integrated into mine and fix the problem

How about a link telling you to search before posting?

Basically every question that will ever be asked has already been answered dozens of times and there's dozens of examples of all of it out there, so rather then reinventing the wheel people post links to save you from the apparently insurmountable trouble of actually looking up your question before posting it. If you don't like that, well, that's a shame really. We shouldn't have to type out answer after answer when we've already done it thousands of times. :)

Also what's with all the hand coded AI ROE stuff? You seem really interested in doing everything that's already been done.

Share this post


Link to post
Share on other sites
How about a link telling you to search before posting?

Basically every question that will ever be asked has already been answered dozens of times and there's dozens of examples of all of it out there, so rather then reinventing the wheel people post links to save you from the apparently insurmountable trouble of actually looking up your question before posting it. If you don't like that, well, that's a shame really. We shouldn't have to type out answer after answer when we've already done it thousands of times. :)

Also what's with all the hand coded AI ROE stuff? You seem really interested in doing everything that's already been done.

whoa whoa, i do search before i post or I wouldnt post. If I do post, then what ive found isnt what iam looking for. There's no need to be a super prick, ive read many of your posts and you always have some degrading things to say to people.Why reply at all if all your gonna do is be mean?I mean..its like you sit home allday and troll... 4400 posts since 09'... rofl, i wonder how many of those are degrading to others...

And no every question ive ever had hasnt been answered here.mabey a similar "question" but not exactly what iam looking for or as i said I wouldn't post.So your telling me theres aperson out there with the exact ame scripts as me and have had problems with the helo hovering instead of continuing? Please link me the thread.

I guess if thats the case then EVERY question thats being asked here has been asked before in SOME form or another and people shouldnt bother posting because their stupid and shouldnt have the right to ask a question here in the editing forums pretaining to their own personal scripts wich more times than not differ from what everyone else has?i mean, I know for a fact that you didnt read my scripts before you replyed...so how could you know where the problem lys?

And what do you mean whatsup with the AIroe stuff? Once again, you didn't take even a glance to se what the scripts did.. (many of those scripts arent even visible in the post rofl) so how do you know im doing stuff thats alreay been done?The AIroe stuff your seeing in the init, is meerly a directory for files that pretain to anything the ai do.. including setting the AIs roe..The Airoe is to set the artificial intelligence rules of engagement. The patrols start in safe mode, when a player is detected, a script is ran to place them in alert mode.... and also for the parasquad, When they are a certain distance away from leaer of xray then they go aware and standup..when they get closer they go into combat mode.. i dont want them always in Cm when they are far away.. Is that ok with you kyliana?

another thing... what's wrong with me writing my own scripts (reinvinting the wheel) instead of using others scripts? I guess slapping the map together as fast as possible via stealing code is the way to go when one is trying to learn??or how does it work?

But, just so your not pissed off, I wont bother posting anymore since it upsets you.Not that you wont jump on someone elses case, but atleast not mine.

If anyone has any information regarding my OP, then please share via PM..Im trying to learn.And it would really be appreciated .Thanks, have a pleasent day.

PS, please close or delete this burning thread.Thanks.

Edited by Iceman77

Share this post


Link to post
Share on other sites

INTERESTING READING :)

-- it has to be a locality issue --

take out the

if (isServer) then {

};

in the paradrop_ice script

and try that :)

Share this post


Link to post
Share on other sites
INTERESTING READING :)

-- it has to be a locality issue --

take out the

if (isServer) then {

};

in the paradrop_ice script

and try that :)

In that script, it creates a vehicle and units.if I took out isServer, then 1 would be created for the server and each client? As far as isServer being a problem, which part of the script is it effecting? The waypoints? Thanks for the reply

Share this post


Link to post
Share on other sites

I'm not sure but does using else {exitWith}; like this actually work , in my test it throws up no errors but doesn't exit.

In this example as the player is still alive the else part should run which it does, it should then exit the script

but it doesn't.

if (!alive player)  then {hint "dead"} else {hint "alive";exitwith};
sleep 2;
Hint "still working";

Share this post


Link to post
Share on other sites

it exits the current scope only? to be honest, idk why i used else {exitWith}.Do you think it could be part of my problem?

Share this post


Link to post
Share on other sites

I thought it may be scope related, I couldn't always see the scope it was related to.

As long as you know what's going on it should be fine.

Share this post


Link to post
Share on other sites

its your WP2 you have a global with only the server making changes to it not the client - eitherway the script has 2 responces to wether the WP2 is completed - so try this

/*

File: paradrop.sqf

Author: ***1cem@n***

Description:

Cycling AI Paradrop.Spawns an empty vehicle (helo pref) and fills it up with crew and paraSquad.

Aswell as assigning waypoints to the trans vehicle and parasquad.When the transport helo and paraSquad

group are dead it deletes currenttransport vehicle and creates a new transport and parasquad to become

inbount to the para location for another paraDrop.

Parameters:

_this select 0: helo class name

_this select 1: helo/crew/parasquad spawn location

Called like:

null = ["mi24_p",pad1] spawn paradrop_ice

*/

if (isServer) then {

//Declare the local variables private

private ["_vehClass","_spawnLocation","_transGroup","_pilot","_copilot","_co1","_ftl1","_scout1","_operatorSD1","_operator1","_Marksman1","_assaultman","_saboteurz","_wp1","_wp3","_wp4","_wp5","_wp6"];

//Setup the _local variable index

_VehClass = _this select 0;

_SpawnLocation = _this select 1;

//Create the empty trans vehicle and face it the way _spawnlocation (pad1) is facing.Setvector it to "settle" the object??

Support_veh = _vehClass createVehicle position _Spawnlocation;

Support_veh setDir getDir _spawnlocation;

Support_veh setVectorUp [0,0,0.001];

sleep 1;

//Create the pilot and gunner in the helos pilot/gunner pos

_transGroup = Creategroup EAST;

_pilot = "RU_Soldier_Pilot" createUnit [getPos _spawnlocation, _transGroup, "this moveindriver Support_veh", 1, "Sergeant "];

_coPilot = "RU_Soldier_Pilot" createUnit [getPos _spawnlocation, _transGroup, "this moveingunner Support_veh",1, "Corporal"];

sleep 1;

//Create the paraSquad in the helos cargo

parasquad = Creategroup EAST;

_Co1 = "RUS_Commander" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh", 1, "Sergeant "];

_FTL1 = "RUS_Soldier_TL" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_scout1 = "RUS_Soldier3" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_operatorSD1 = "RUS_Soldier2" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_operator1 = "RUS_Soldier1" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_Marksman1 = "RUS_Soldier_Marksman" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_Assaultman1 = "RUS_Soldier_GL" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

_Saboteurz = "RUS_Soldier_Sab" createUnit [getPos _spawnlocation, paraSquad, "this moveincargo Support_veh",1, "Corporal"];

sleep 1;

//Create some waypoints for the support_veh and parasquad

_WP1 = _transgroup addWaypoint [position Pad2, 0];

_wp1 setWaypointBehaviour "aware";

_wp1 setWaypointCombatMode "green";

_wp1 setWaypointSpeed "FULL";

_wp1 setWaypointStatements ["true",""];

_wp1 setWaypointTimeout [0, 0, 0];

_wp1 setWaypointType "move";

_wp1 showWaypoint "ALWAYS";

};

//--Let the client and server know about this WP

WP2 = _transgroup addWaypoint [position leader xray, 0];

wp2 setWaypointBehaviour "aware";

wp2 setWaypointCombatMode "green";

wp2 setWaypointSpeed "FULL";

wp2 setWaypointStatements ["true","paradropz = true,_nil = [] spawn PDroe,deleteWaypoint Wp2"];

wp2 setWaypointTimeout [0, 0, 0];

wp2 setWaypointType "move";

wp2 showWaypoint "ALWAYS";

//Dont use null = [] anything, it wont work with CBA, its good practice not to use a global for things like that-----------

if (isServer) then {

_WP3 = _transgroup addWaypoint [position Pad4, 0];

_wp3 setWaypointBehaviour "combat";

_wp3 setWaypointCombatMode "RED";

_wp3 setWaypointSpeed "FULL";

_wp3 setWaypointStatements ["true",""];

_wp3 setWaypointTimeout [0, 0, 0];

_wp3 setWaypointType "move";

_wp3 showWaypoint "ALWAYS";

_WP4 = _transgroup addWaypoint [position Pad5, 0];

_wp4 setWaypointBehaviour "combat";

_wp4 setWaypointCombatMode "RED";

_wp4 setWaypointSpeed "FULL";

_wp4 setWaypointStatements ["true",""];

_wp4 setWaypointTimeout [0, 0, 0];

_wp4 setWaypointType "move";

_wp4 showWaypoint "ALWAYS";

_WP5 = _transgroup addWaypoint [position Pad6, 0];

_wp5 setWaypointBehaviour "combat";

_wp5 setWaypointCombatMode "RED";

_wp5 setWaypointSpeed "FULL";

_wp5 setWaypointStatements ["true",""];

_wp5 setWaypointTimeout [0, 0, 0];

_wp5 setWaypointType "cycle";

_wp5 showWaypoint "ALWAYS";

sleep 1;

null = [] spawn PDloc;

sleep 5;

//Set the helos fly height to make a good para drop

Support_veh flyInHeight 80;

null = [] spawn PDcounter;

sleep 1;

//Waituntil the trans vehicle and parasquad are dead to create a new inc paraDrop squad/helo.

WaitUntil {sleep 0.3; {alive _x} count units parasquad == 0 && !canMove Support_veh};

sleep 20;

if (({alive _x} count units parasquad == 0) && (!canMove Support_veh)) then {deleteVehicle support_veh; deletegroup parasquad; null = ["mi24_p",pad1] spawn paradrop_ice} else {exitWith};

};

Edited by Zonekiller

Share this post


Link to post
Share on other sites

Thanks for the reply zonekiller. I tried this, an now the helo stops on _wp1 and hovers there ~100m in the air.Any more ideas?

I'll gladly send this map to someone if they want to see the problem 1st hand.Im really stumped now =(

Share this post


Link to post
Share on other sites
i sent you my email in a PM i will gladly have a look

thanks zonekiller <3

Share this post


Link to post
Share on other sites

have you tried defining scopes and using breakTo/breakOut? if you want to exit the entire scope of the script with that else exitWith, just name the setScope "Main" on the main scope and use breakTo "Main" - that will effectively exit the script.

if you already solved this, then nevermind

Share this post


Link to post
Share on other sites
have you tried defining scopes and using breakTo/breakOut? if you want to exit the entire scope of the script with that else exitWith, just name the setScope "Main" on the main scope and use breakTo "Main" - that will effectively exit the script.

if you already solved this, then nevermind

Thanks for the reply Ingeous. The "exitWith" dicussion in this thread was off the topic and wasn't a problem (that i know of), and really didn't need to be discussed here. however, thanks for sharing knowledge. Appreciated.

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  

×