Jump to content
Sign in to follow this  
avibird 1

Need help to add a sleep command to the script for support units!

Recommended Posts

hello This may be very simple but can't get the sleep command to work on this script. The script calls in armor units for support. They spawn around 1000 meters away and move to the players location with a SAD waypoint if no enemy units are still present in the location then the units get deleted and the player is allowed to call back the support units. I would like to add a 20 minute delay between the use of this script.

Here is the call script

armor = false;

publicVariable "armor";

[] exec "lkscripts\menu\close_menu.sqf";

player sideChat "HQ we need armor support on my location ASAP, Over";

sleep 2;

GroupTank1 = CreateGroup West;

Tank1 = createVehicle ["M1A2_TUSK_MG", [(getpos player) select 0,(getpos player) select 1,0], [], 1000, "FORM"];

tankc1 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,1], [], 0, "CAN_COLLIDE"];

tankc1 moveInDriver Tank1;

tankc2 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,2], [], 0, "CAN_COLLIDE"];

tankc2 moveInGunner Tank1;

tankc3 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,3], [], 0, "CAN_COLLIDE"];

tankc3 moveInCommander Tank1;

tankc4 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,4], [], 0, "CAN_COLLIDE"];

tankc4 moveInTurret [Tank1, [0,1]];

Tank2 = createVehicle ["M1A2_TUSK_MG", [(getpos player) select 0,(getpos player) select 1,0], [], 1050, "FORM"];

tank2c1 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,1], [], 0, "CAN_COLLIDE"];

tank2c1 moveInDriver Tank2;

tank2c2 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,2], [], 0, "CAN_COLLIDE"];

tank2c2 moveInGunner Tank2;

tank2c3 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,3], [], 0, "CAN_COLLIDE"];

tank2c3 moveInCommander Tank2;

tank2c4 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,4], [], 0, "CAN_COLLIDE"];

tank2c4 moveInTurret [Tank2, [0,1]];

Tank3 = createVehicle ["M1A2_TUSK_MG", [(getpos player) select 0,(getpos player) select 1,0], [], 1020, "FORM"];

tank3c1 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,1], [], 0, "CAN_COLLIDE"];

tank3c1 moveInDriver Tank3;

tank3c2 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,2], [], 0, "CAN_COLLIDE"];

tank3c2 moveInGunner Tank3;

tank3c3 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,3], [], 0, "CAN_COLLIDE"];

tank3c3 moveInCommander Tank3;

tank3c4 = GroupTank1 createUnit ["USMC_Soldier_Crew", [0,0,4], [], 0, "CAN_COLLIDE"];

tank3c4 moveInTurret [Tank3, [0,1]];

tank3c1 sideChat "ARMOR DIVISON: Roger that armor is on route to your location for support";

sleep 1;

tank3c1 sideChat "ARMOR DIVISON: Over";

wp1 = GroupTank1 addwaypoint [position player, 0];

wp1 setwaypointtype "SAD";

wp1 setWaypointCompletionRadius 100;

armor1 = createTrigger ["EmptyDetector",getPos player];

armor1 setTriggerArea [500, 500, 0, false];

armor1 setTriggerActivation ["EAST", "NOT PRESENT", false];

armor1 setTriggerTimeout [60, 60, 60, false ];

armor1 setTriggerStatements ["this", "tank3c1 sideChat ""ARMOR DIVISON: our mission is done here, returning back to base, OVER""; GroupTank1 exec ""lkscripts\support-req\donearmor.sqf""" , ""];

armor2 = createTrigger ["EmptyDetector", getPos player];

armor2 setTriggerArea [0, 0, 0, false];

armor2 setTriggerActivation ["NONE", "NOT PRESENT", false];

armor2 setTriggerStatements ["!(alive Tank1) && !(alive Tank2) && !(alive Tank3)", "PAPABEAR SideChat ""Armor Division has been destroyed""; [] exec ""lkscripts\support-req\donearmor.sqf""" , ""];

AND HERE IS THE DONE script part

{deleteVehicle _x} forEach (units GroupTank1);

deleteVehicle Tank1;

deleteVehicle Tank2;

deleteVehicle Tank3;

deletevehicle armor1;

deletevehicle armor2;

sleep 50;

hint "Armor Support is available again!";

armor = true;

publicVariable "armor";

AND HERE IS A DIFFERENT PART OF THE SCRIPT within the folder

respawn_west = createMarker ["respawn_west", position ussupport];

respawn_west setMarkerType "Faction_US";

respawn_west setMarkerText " HQ";

respawn_west setMarkerSize [1.2,0.7];

respawn_west_1 = createMarker ["respawn_west_1", getMarkerPos "respawn_west"];

respawn_west_2 = createMarker ["respawn_west_2", getMarkerPos "respawn_west"];

createcenter sidelogic;

_grp = creategroup sidelogic;

coin = _grp createunit ["ConstructionManager", [0,0,1],[], 0,"none"];

[coin] execVM "lkscripts\othr\coin.sqf";

coin2 = _grp createunit ["ConstructionManager", [0,0,1],[], 0,"none"];

[coin2] execVM "lkscripts\othr\coin2.sqf";

UAVmod = _grp createunit ["UAVManager", [0,0,1],[], 0,"none"];

UAVmod setvariable ["name","RQ-1 Predator"];

UAVmod setvariable ["rules",[west]];

logicSOM = _grp createunit ["SecOpManager", [0,0,1],[], 0,"none"];

logicSOM synchronizeObjectsAdd [player];

logicSOM setVariable ["settings", [[], true, nil, nil, false]];

nul=ussupport addAction ["Base deployment", "lkscripts\Dialogs\Respawn_Dialog.sqf", [], 3, false, true, ""]

armor = true;

inf = true;

heli = true;

lavhq = true;

mvhq = true;

som = true;

para = true;

thuse = false;

hint "US Support Menu is now available";

I have tryed to add sleep commands in a few spots but no luck. Any input would be appreciated. This is a great script but overall to strong if you can call in all the support units anytime you want.

Edited by AVIBIRD 1
lol i use the link tab in my thread

Share this post


Link to post
Share on other sites

No time to answer, but CODE tags are much easier to read than TinyFontPrettyParagraph or whatever that is. :)

You can type out code tags manually. :)

[code]
sleep 10;
[/code]


To limit it just set a variable that limits it.

Depends on how you're actually calling it, but basically something like this at the top of your code:

if (!((player getVariable "supportAvailable") == "SupportAvailable")) exitWith {hint "Support not available"};
player setVariable ["supportAvailable", "supportUNAvailable"];
...
// all yer code

sleep 1200;
player setVariable ["supportAvailable", "supportAvailable"];

So the first thing the script does it check if it's available, if not it quits.

Then you mark the script as being in use by setting the variable. Once the script has run we sleep 20 min then set the variable available again.

Edited by kylania

Share this post


Link to post
Share on other sites

Hey kylania the script I am using and trying to get to work in a new mission mode that I am working on is US SUPPORT here is the link

http://forums.bistudio.com/showthrea...ght=US-Support

US Support v1.5 Armaholic

The script uses multiple support squads from a main menu and the ability to call in two FOB's both with other support units that can be used Once the FOB is up. The support units from the FOB's can be called in allow once and can only be used again if the FOB is repack and called to a new location. I want to prevent the main support squads to be over used. Right now you can call them back right after theyget destroyed or leave the area of operations if no opfor units are left. I think what you said above will stop/prevent all the support units to be called once the script was called at first for 20 minutes (1200). I am trying to get each support group in the main menu to have a time lmited to be use again. The way it is right now its to strong of an assist.

The other issue is the inital script is set for west side so any unit on the west side can call the script. I only want three SL to use the support menu that i have in the mission.

This is the code

setPitchBank = compile preprocessfile "lkscripts\tomahawk\setPitchBank.sqf";

player execVM "lkscripts\Dscripts\respawn_player.sqf"; // infinite loop, controls respawning

//player addeventhandler ["Killed", {_this execVM "lkscripts\Dscripts\respawn_player.sqf"}]; // would rather use event handler

if ( (!isServer) && (player != player) ) then

{

waitUntil {player == player};

waitUntil {time > 10};

};

if !(isnull player) then {

null = [] execvm "briefing.sqf";

if (playerSide == west) then {null = [] execVM "lkscripts\menu\close_menu.sqf"};

};

This is what I tryed

if (playerSide == west;"captain") then {null = [] execVM "lkscripts\menu\close_menu.sqf"};

And this

if (playerSide == west then;"captain") then {null = [] execVM "lkscripts\menu\close_menu.sqf"};

I am very lost at this point making this work the way I needed it to work. If you can help or anyone else I would be grateful Avibird.

---------- Post added at 03:14 ---------- Previous post was at 02:23 ----------

Hey kylania messed around with your tips I got it to work for the most part, just some logistics with the menu appears and Dialogs boxs with hints. Thanks. if you have any input on the whole playerSide thing please let me know(:

Edited by AVIBIRD 1

Share this post


Link to post
Share on other sites

If you want only three specific SL to have the action, you need to pass that information to the script. I don't know what your support menu script is calling for...

If you want to limit the list just to WEST and "CAPTAIN", then you could use this:

if (playerSide == west && rank player == "CAPTAIN") then {...}

Share this post


Link to post
Share on other sites

Thanks I did not try the rank player code line in the above attempts

1. if (playerSide == west then;"captain") then {null = [] execVM "lkscripts\menu\close_menu.sqf"};

2. if (playerSide == west;"captain") then {null = [] execVM "lkscripts\menu\close_menu.sqf"};

I will give it a go! This is why I love most of the community members (:

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  

×