Jump to content
Sign in to follow this  
CMajor28

Script Won't Work

Recommended Posts

Measle groupchat "What in the world is going on up here?"; sleep 3.5;
Scarecrow groupchat "I don't know."; sleep 3;  
player groupchat "Proceed with caution."; 
car1 setvehiclelock "unlocked"; 
unassignVehicle Measle; Dogetout Measle; sleep .5; 
{unassignvehicle _x} foreach units (group player); {doGetOut _X} forEach units (group player);
sleep 5; 
Logic globalchat "Friedrich Klein: We got a flat tire. Think you guys can help?"; sleep 3.5; 
player groupchat "Yeah, but who are you."; sleep 3; 
Logic globalchat "Friedrich Klein: We are from KSK."; sleep 3; 
player groupchat "German special forces?"; sleep 3; 
Logic globalchat "Friedrich Klein: Yeah."; sleep 1; 
Logic globalchat "Friedrich Klein: It's a little more than flat tire."; sleep 2; 
player groupchat "What is it?"; sleep 3; 
Logic globalchat "Friedrich Klein: Just come look."; sleep 2; 
rifle enableAI "move"; sleep 3;  
Logic globalchat "Friedrich Klein: As you can see, it's pretty bad."; sleep 3; 
player groupchat "I can see. I think we have a spare. We might can make it work."; sleep 4; 
Logic globalchat "Friedrich Klein: Alright, thanks. By the way..."; sleep 2; 
Sniper fire "ksvk"; sleep 1; 
bomb = "B_127x107_Ball" createvehicle (getpos rifle); 
Rifle sethit ["head", 1]; Rifle setdamage 1; 
obj setdamage 1; 
sleep 2; 
Team switchmove "aidlpercmstpsraswrfldnon_idlesteady01n"; 
Medic switchmove "aidlpercmstpsraswrfldnon_idlesteady01n"; 
player groupchat "Fuck! Sniper! Measle, get the M107"; sleep 2; 
{if ((side _x) == West) then {_x setbehaviour "combat";};} forEach allUnits;
Measle domove (position car1);  
while {alive objshooting} do {Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; sleep 1;}; 
while {alive objshooting} do {Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1"; sleep .8;}; 
while {alive objshooting} do {Ripper lookat sniper; Ripper fire "MK_48_Des_EP1"; sleep .1;}; 
while {alive objshooting} do {Slasher lookat sniper; Slasher fire "M24_Des_EP1"; sleep 2;}; 
while {alive objshooting} do {Measle lookat sniper; Measle fire "M4A3_CCO_EP1"; sleep .1;}; 
while {alive objshooting} do {Axe lookat sniper; Axe fire "M4A3_CCO_EP1"; sleep 1.3;}; 
while {alive objshooting} do {Team lookat sniper; Team fire "G36_Camo"; sleep .55;}; 
while {alive objshooting} do {Scout lookat sniper; Scout fire "G36A_Camo"; sleep .9;}; 
while {alive objshooting} do {Auto lookat sniper; Auto fire "MG36_Camo"; sleep .1;}; 
while {alive objshooting} do {Medic lookat sniper; Medic fire "G36_Camo"; sleep 1.1;};  
sleep 5; 
Measle action ["TAKEWEAPON", car1, "m107"]; 
Measle domove (getmarkerpos "hidemeasle"); 
sleep 3; 
Sniper fire "ksvk"; sleep 1; 
bomb = "B_127x107_Ball" createvehicle (getpos auto); auto setdamage 1;  
sleep 2; 
player groupchat "Fuck! Everybody find cover!"; sleep 1.5; 
objshooting setdamage 1; 
hint "Hide behind the car."; 
Measle action ["DROPWEAPON", Measle, "m107"]; sleep .5; 
Measle action ["TAKEWEAPON", car1, "M4A3_CCO_EP1"]; 
{if ((side _x) == West) then {_x domove (getmarkerpos "carhiding"};} forEach allUnits;
sleep 3; 
Player groupchat "I'll use the M107 and look for that sniper."; sleep 1; 
hint "Pick up the M107 behind the car. Use it to take out the sniper."; objsniper setdamage 1; 

A lot of the commands in this script won't work. I have no idea why. So basically my goal in this section of the mission is to make it almost like the counter sniper part in The Hurt Locker. In my mission you come across a group of KSK soldiers and you get ambushed by a single sniper. At one point I want all the men to hide behind a car while you look for the sniper. Note: When I say obj__ setdamage 1; that activates something else that is almost totally unrelated.

Share this post


Link to post
Share on other sites

One Issue I see right away is the while commands

your script whill stall here until objshooting is dead, the othere while commands will then be skipped as he is dead already.

while {alive objshooting} do {Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; sleep 1;};

while {alive objshooting} do {
Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; sleep 1; 
Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1"; sleep .8; 
Ripper lookat sniper; Ripper fire "MK_48_Des_EP1"; sleep .1; 
Slasher lookat sniper; Slasher fire "M24_Des_EP1"; sleep 2; 
Measle lookat sniper; Measle fire "M4A3_CCO_EP1"; sleep .1; 
Axe lookat sniper; Axe fire "M4A3_CCO_EP1"; sleep 1.3; 
Team lookat sniper; Team fire "G36_Camo"; sleep .55; 
Scout lookat sniper; Scout fire "G36A_Camo"; sleep .9; 
Auto lookat sniper; Auto fire "MG36_Camo"; sleep .1; 
Medic lookat sniper; Medic fire "G36_Camo"; sleep 1.1;
};

The other issue now is that from the first unit to the last there will be about a 5 second delay as all the sleeps will have to run before the script tells him to lookat and fire.

You will have to spawn each line or find another way.

while {alive objshooting} do {
Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; 
spawn {sleep 1;Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1";}
spawn  (sleep .8;Ripper lookat sniper; Ripper fire "MK_48_Des_EP1";};
// rest of cammands go here ect.
};

That will allow the commnds to run parallel to each other.

Share this post


Link to post
Share on other sites

Okay thanks. I'll try it out. After that is where it started messing up so I'm going to assume that your right. I didn't know that about the while statements. But one question, do the sleeps really need to go before the statements or is it okay after the statements?

EDIT: Okay this is my new script, but I can't seam to get it to work.

while {alive objshooting} do {Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; sleep 1; 
Spawn {Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1"; sleep .8;} 
Spawn {Ripper lookat sniper; Ripper fire "MK_48_Des_EP1"; sleep .1;} 
Spawn {Slasher lookat sniper; Slasher fire "M24_Des_EP1"; sleep 2;} 
Spawn {Measle lookat sniper; Measle fire "M4A3_CCO_EP1"; sleep .1;} 
Spawn {Axe lookat sniper; Axe fire "M4A3_CCO_EP1"; sleep 1.3;} 
Spawn {Team lookat sniper; Team fire "G36_Camo"; sleep .55;} 
Spawn {Scout lookat sniper; Scout fire "G36A_Camo"; sleep .9;} 
Spawn {Auto lookat sniper; Auto fire "MG36_Camo"; sleep .1;} 
Spawn {Medic lookat sniper; Medic fire "G36_Camo"; sleep 1.1;};
}; 

I also tried

while {alive objshooting} do {Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1"; 
Spawn {sleep 1; Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1";} 
Spawn {sleep .8; Ripper lookat sniper; Ripper fire "MK_48_Des_EP1";} 
Spawn {sleep .1; Slasher lookat sniper; Slasher fire "M24_Des_EP1";} 
Spawn {sleep 2; {Measle lookat sniper; Measle fire "M4A3_CCO_EP1";} 
Spawn {sleep .1; Axe lookat sniper; Axe fire "M4A3_CCO_EP1";} 
Spawn {sleep 1.3Team lookat sniper; Team fire "G36_Camo";} 
Spawn {sleep .55; Scout lookat sniper; Scout fire "G36A_Camo";} 
Spawn {sleep .9; Auto lookat sniper; Auto fire "MG36_Camo";} 
Spawn {sleep .1; Medic lookat sniper; Medic fire "G36_Camo";};
};

Edited by CMajor28

Share this post


Link to post
Share on other sites

There were a couple of bugs the main one being I'd missed the brackets

while {alive objshooting} do {

Scarecrow lookat sniper; Scarecrow fire "M4A3_CCO_EP1";

[] Spawn {sleep 1; Vandal lookat sniper; Vandal fire "M4A3_RCO_GL_EP1";}; 
[] Spawn {sleep .8; Ripper lookat sniper; Ripper fire "MK_48_Des_EP1";}; 
[] Spawn {sleep .1; Slasher lookat sniper; Slasher fire "M24_Des_EP1";}; 
[] Spawn {sleep 2; Measle lookat sniper; Measle fire "M4A3_CCO_EP1";}; 
[] Spawn {sleep .1; Axe lookat sniper; Axe fire "M4A3_CCO_EP1";}; 
[] Spawn {sleep 1.3;Team lookat sniper; Team fire "G36_Camo";}; 
[] Spawn {sleep .55; Scout lookat sniper; Scout fire "G36A_Camo";}; 
[] Spawn {sleep .9; Auto lookat sniper; Auto fire "MG36_Camo";}; 
[] Spawn {sleep .1; Medic lookat sniper; Medic fire "G36_Camo";};
sleep 2;
};

Share this post


Link to post
Share on other sites

Okay so I tried that and it didn't work. It kinda worked, but the commandwas delayed by 10 seconds. then they all fired like 3 shoots each, then it delayed for another 10 seconds. That process was continuous. You may have a better idea though. All I was trying to accomplish was making AI shoot full auto, or rapid single shot fire. Do you know of any other way to do that?

Edited by CMajor28

Share this post


Link to post
Share on other sites

What is objshooting is it a man or object.

Share this post


Link to post
Share on other sites

replace the while commands and insert this

[sniper,objshooting,[scarecrow,Vandal,Ripper,Slasher,Measle,Axe,Team,Scout,Auto,Medic]] execvm "force_fire.sqf";

then save the next script as force_fire.sqf

//null=[sniper,objshooting,[scarecrow,Vandal,Ripper,Slasher,Measle,Axe,Team,Scout,Auto,Medic]] execvm "force_fire.sqf"

_targ = _this select 0;// sniper
_logic = _this select 1;// needs a game logic
_units = _this select 2;// array of units doing the shooting

 missionnamespace setvariable ["timeout",true];

{
 [_x,_targ,_logic] spawn {

_unit = _this select 0;
_targ = _this select 1;
 _logic = _this select 2;

_unit dotarget _targ;
sleep ((random 1) + 0.8);

while {alive _unit and missionnamespace getvariable "timeout" } do {
sleep 0.3;// rate of fire; 
  _logic action ["useweapon",vehicle _unit,_unit,0];// force weapon fire
};

};

} foreach  _units;

sleep 8;// firing duration
missionnamespace setvariable ["timeout",false];// cancel firing

Share this post


Link to post
Share on other sites

So I don't need to change anything in the script? Nothing at all?

EDIT: Yeah, I can't get it to work at all.

Edited by CMajor28

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  

×